aboutsummaryrefslogtreecommitdiff
path: root/src/examples/post_example.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/post_example.c')
-rw-r--r--src/examples/post_example.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/examples/post_example.c b/src/examples/post_example.c
index 6bb81a0b..69091dc2 100644
--- a/src/examples/post_example.c
+++ b/src/examples/post_example.c
@@ -22,10 +22,6 @@
22 * @author Christian Grothoff 22 * @author Christian Grothoff
23 */ 23 */
24 24
25/* needed for asprintf */
26#define _GNU_SOURCE
27
28
29#include <stdlib.h> 25#include <stdlib.h>
30#include <string.h> 26#include <string.h>
31#include <stdio.h> 27#include <stdio.h>
@@ -319,13 +315,11 @@ fill_v1_form (const void *cls,
319 char *reply; 315 char *reply;
320 struct MHD_Response *response; 316 struct MHD_Response *response;
321 317
322 if (-1 == asprintf (&reply, 318 reply = malloc (strlen (form) + strlen (session->value_1) + 1);
323 form, 319 snprintf (reply,
324 session->value_1)) 320 strlen (form) + strlen (session->value_1) + 1,
325 { 321 form,
326 /* oops */ 322 session->value_1);
327 return MHD_NO;
328 }
329 /* return static form */ 323 /* return static form */
330 response = MHD_create_response_from_buffer (strlen (reply), 324 response = MHD_create_response_from_buffer (strlen (reply),
331 (void *) reply, 325 (void *) reply,
@@ -361,14 +355,11 @@ fill_v1_v2_form (const void *cls,
361 char *reply; 355 char *reply;
362 struct MHD_Response *response; 356 struct MHD_Response *response;
363 357
364 if (-1 == asprintf (&reply, 358 reply = malloc (strlen (form) + strlen (session->value_1) + strlen (session->value_2) + 1);
365 form, 359 snprintf (reply,
366 session->value_1, 360 strlen (form) + strlen (session->value_1) + strlen (session->value_2) + 1,
367 session->value_2)) 361 form,
368 { 362 session->value_1);
369 /* oops */
370 return MHD_NO;
371 }
372 /* return static form */ 363 /* return static form */
373 response = MHD_create_response_from_buffer (strlen (reply), 364 response = MHD_create_response_from_buffer (strlen (reply),
374 (void *) reply, 365 (void *) reply,