Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
00ffb29f
Commit
00ffb29f
authored
Apr 27, 2020
by
James R.
Browse files
Options
Downloads
Patches
Plain Diff
Use malloc for hms
parent
ff8987f7
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!940
HTTP Based Master Server + Multithreading
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/hms123311.c
+8
-9
8 additions, 9 deletions
src/hms123311.c
with
8 additions
and
9 deletions
src/hms123311.c
+
8
−
9
View file @
00ffb29f
...
@@ -22,7 +22,6 @@ Documentation available here.
...
@@ -22,7 +22,6 @@ Documentation available here.
#include
"m_menu.h"
#include
"m_menu.h"
#include
"mserv.h"
#include
"mserv.h"
#include
"i_tcp.h"
/* for current_port */
#include
"i_tcp.h"
/* for current_port */
#include
"z_zone.h"
/* I just stop myself from making macros anymore. */
/* I just stop myself from making macros anymore. */
#define Blame( ... ) \
#define Blame( ... ) \
...
@@ -105,7 +104,7 @@ HMS_connect (const char *format, ...)
...
@@ -105,7 +104,7 @@ HMS_connect (const char *format, ...)
seek
=
strlen
(
ms_API
)
+
1
;
/* + '/' */
seek
=
strlen
(
ms_API
)
+
1
;
/* + '/' */
va_start
(
ap
,
format
);
va_start
(
ap
,
format
);
url
=
ZZ_A
lloc
(
seek
+
vsnprintf
(
0
,
0
,
format
,
ap
)
+
1
);
url
=
ma
lloc
(
seek
+
vsnprintf
(
0
,
0
,
format
,
ap
)
+
1
);
va_end
(
ap
);
va_end
(
ap
);
sprintf
(
url
,
"%s/"
,
ms_API
);
sprintf
(
url
,
"%s/"
,
ms_API
);
...
@@ -116,11 +115,11 @@ HMS_connect (const char *format, ...)
...
@@ -116,11 +115,11 @@ HMS_connect (const char *format, ...)
CONS_Printf
(
"HMS: connecting '%s'...
\n
"
,
url
);
CONS_Printf
(
"HMS: connecting '%s'...
\n
"
,
url
);
buffer
=
ZZ_A
lloc
(
sizeof
*
buffer
);
buffer
=
ma
lloc
(
sizeof
*
buffer
);
buffer
->
curl
=
curl
;
buffer
->
curl
=
curl
;
/* I just allocated 4k and fuck it! */
/* I just allocated 4k and fuck it! */
buffer
->
end
=
4096
;
buffer
->
end
=
4096
;
buffer
->
buffer
=
ZZ_A
lloc
(
buffer
->
end
);
buffer
->
buffer
=
ma
lloc
(
buffer
->
end
);
buffer
->
needle
=
0
;
buffer
->
needle
=
0
;
if
(
cv_masterserver_debug
.
value
)
if
(
cv_masterserver_debug
.
value
)
...
@@ -135,7 +134,7 @@ HMS_connect (const char *format, ...)
...
@@ -135,7 +134,7 @@ HMS_connect (const char *format, ...)
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
HMS_on_read
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
HMS_on_read
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
buffer
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
buffer
);
Z_F
ree
(
url
);
f
ree
(
url
);
return
buffer
;
return
buffer
;
}
}
...
@@ -189,8 +188,8 @@ static void
...
@@ -189,8 +188,8 @@ static void
HMS_end
(
struct
HMS_buffer
*
buffer
)
HMS_end
(
struct
HMS_buffer
*
buffer
)
{
{
curl_easy_cleanup
(
buffer
->
curl
);
curl_easy_cleanup
(
buffer
->
curl
);
Z_F
ree
(
buffer
->
buffer
);
f
ree
(
buffer
->
buffer
);
Z_F
ree
(
buffer
);
f
ree
(
buffer
);
}
}
int
int
...
@@ -343,7 +342,7 @@ HMS_register (void)
...
@@ -343,7 +342,7 @@ HMS_register (void)
if
(
ok
)
if
(
ok
)
{
{
hms_server_token
=
Z_S
tr
D
up
(
strtok
(
hms
->
buffer
,
"
\n
"
));
hms_server_token
=
s
tr
d
up
(
strtok
(
hms
->
buffer
,
"
\n
"
));
}
}
HMS_end
(
hms
);
HMS_end
(
hms
);
...
@@ -366,7 +365,7 @@ HMS_unlist (void)
...
@@ -366,7 +365,7 @@ HMS_unlist (void)
HMS_do
(
hms
);
HMS_do
(
hms
);
HMS_end
(
hms
);
HMS_end
(
hms
);
Z_F
ree
(
hms_server_token
);
f
ree
(
hms_server_token
);
}
}
int
int
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment