Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lactozilla
SRB2
Commits
00ffb29f
Commit
00ffb29f
authored
5 years ago
by
James R.
Browse files
Options
Downloads
Patches
Plain Diff
Use malloc for hms
parent
ff8987f7
Branches
Branches containing commit
No related tags found
No related merge requests found
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.
#include
"m_menu.h"
#include
"mserv.h"
#include
"i_tcp.h"
/* for current_port */
#include
"z_zone.h"
/* I just stop myself from making macros anymore. */
#define Blame( ... ) \
...
...
@@ -105,7 +104,7 @@ HMS_connect (const char *format, ...)
seek
=
strlen
(
ms_API
)
+
1
;
/* + '/' */
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
);
sprintf
(
url
,
"%s/"
,
ms_API
);
...
...
@@ -116,11 +115,11 @@ HMS_connect (const char *format, ...)
CONS_Printf
(
"HMS: connecting '%s'...
\n
"
,
url
);
buffer
=
ZZ_A
lloc
(
sizeof
*
buffer
);
buffer
=
ma
lloc
(
sizeof
*
buffer
);
buffer
->
curl
=
curl
;
/* I just allocated 4k and fuck it! */
buffer
->
end
=
4096
;
buffer
->
buffer
=
ZZ_A
lloc
(
buffer
->
end
);
buffer
->
buffer
=
ma
lloc
(
buffer
->
end
);
buffer
->
needle
=
0
;
if
(
cv_masterserver_debug
.
value
)
...
...
@@ -135,7 +134,7 @@ HMS_connect (const char *format, ...)
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
HMS_on_read
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
buffer
);
Z_F
ree
(
url
);
f
ree
(
url
);
return
buffer
;
}
...
...
@@ -189,8 +188,8 @@ static void
HMS_end
(
struct
HMS_buffer
*
buffer
)
{
curl_easy_cleanup
(
buffer
->
curl
);
Z_F
ree
(
buffer
->
buffer
);
Z_F
ree
(
buffer
);
f
ree
(
buffer
->
buffer
);
f
ree
(
buffer
);
}
int
...
...
@@ -343,7 +342,7 @@ HMS_register (void)
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
);
...
...
@@ -366,7 +365,7 @@ HMS_unlist (void)
HMS_do
(
hms
);
HMS_end
(
hms
);
Z_F
ree
(
hms_server_token
);
f
ree
(
hms_server_token
);
}
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