Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mongoose
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
Container 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
Ganil-acq
GANILinux
linux-service
library
mongoose
Commits
b9fead4d
Commit
b9fead4d
authored
9 years ago
by
Sergey Lyubka
Browse files
Options
Downloads
Plain Diff
Merge pull request #525 from NickCis/mg_vprintf
Adding mg_vprintf and mg_vprintf_data.
parents
c6a04e17
c839a61f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mongoose.c
+21
-5
21 additions, 5 deletions
mongoose.c
mongoose.h
+2
-0
2 additions, 0 deletions
mongoose.h
with
23 additions
and
5 deletions
mongoose.c
+
21
−
5
View file @
b9fead4d
...
...
@@ -1951,13 +1951,21 @@ static void write_chunk(struct connection *conn, const char *buf, int len) {
}
size_t
mg_printf
(
struct
mg_connection
*
conn
,
const
char
*
fmt
,
...)
{
struct
connection
*
c
=
MG_CONN_2_CONN
(
conn
);
va_list
ap
;
int
ret
;
va_start
(
ap
,
fmt
);
ns
_vprintf
(
c
->
ns_
conn
,
fmt
,
ap
);
ret
=
mg
_vprintf
(
conn
,
fmt
,
ap
);
va_end
(
ap
);
return
ret
;
}
size_t
mg_vprintf
(
struct
mg_connection
*
conn
,
const
char
*
fmt
,
va_list
ap
)
{
struct
connection
*
c
=
MG_CONN_2_CONN
(
conn
);
ns_vprintf
(
c
->
ns_conn
,
fmt
,
ap
);
return
c
->
ns_conn
->
send_iobuf
.
len
;
}
...
...
@@ -2790,16 +2798,24 @@ size_t mg_send_data(struct mg_connection *c, const void *data, int data_len) {
}
size_t
mg_printf_data
(
struct
mg_connection
*
c
,
const
char
*
fmt
,
...)
{
struct
connection
*
conn
=
MG_CONN_2_CONN
(
c
);
va_list
ap
;
int
ret
;
va_start
(
ap
,
fmt
);
ret
=
mg_vprintf_data
(
c
,
fmt
,
ap
);
va_end
(
ap
);
return
ret
;
}
size_t
mg_vprintf_data
(
struct
mg_connection
*
c
,
const
char
*
fmt
,
va_list
ap
)
{
struct
connection
*
conn
=
MG_CONN_2_CONN
(
c
);
int
len
;
char
mem
[
IOBUF_SIZE
],
*
buf
=
mem
;
terminate_headers
(
c
);
va_start
(
ap
,
fmt
);
len
=
ns_avprintf
(
&
buf
,
sizeof
(
mem
),
fmt
,
ap
);
va_end
(
ap
);
if
(
len
>=
0
)
{
write_chunk
((
struct
connection
*
)
conn
,
buf
,
len
);
...
...
This diff is collapsed.
Click to expand it.
mongoose.h
+
2
−
0
View file @
b9fead4d
...
...
@@ -104,8 +104,10 @@ void mg_send_status(struct mg_connection *, int status_code);
void
mg_send_header
(
struct
mg_connection
*
,
const
char
*
name
,
const
char
*
val
);
size_t
mg_send_data
(
struct
mg_connection
*
,
const
void
*
data
,
int
data_len
);
size_t
mg_printf_data
(
struct
mg_connection
*
,
const
char
*
format
,
...);
size_t
mg_vprintf_data
(
struct
mg_connection
*
,
const
char
*
format
,
va_list
ap
);
size_t
mg_write
(
struct
mg_connection
*
,
const
void
*
buf
,
size_t
len
);
size_t
mg_printf
(
struct
mg_connection
*
conn
,
const
char
*
fmt
,
...);
size_t
mg_vprintf
(
struct
mg_connection
*
conn
,
const
char
*
fmt
,
va_list
ap
);
size_t
mg_websocket_write
(
struct
mg_connection
*
,
int
opcode
,
const
char
*
data
,
size_t
data_len
);
...
...
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