From d821525cee3fb43f746fdebf6dcc2dd8daa2bb7f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 14 Feb 2013 10:32:04 +0100 Subject: [PATCH] Curl_FormBoundary: made static As Curl_FormBoundary() is no longer used outside of this file (since commit ad7291c1a9d), it is now renamed to formboundary() and is made static. --- lib/formdata.c | 67 ++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/lib/formdata.c b/lib/formdata.c index 2ba58dda1..308b33a85 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -56,6 +56,7 @@ static char *Curl_basename(char *path); #endif static size_t readfromfile(struct Form *form, char *buffer, size_t size); +static char *formboundary(void); /* What kind of Content-Type to use on un-specified files with unrecognized extensions. */ @@ -1100,7 +1101,7 @@ CURLcode Curl_getformdata(struct SessionHandle *data, if(!post) return result; /* no input => no output! */ - boundary = Curl_FormBoundary(); + boundary = formboundary(); if(!boundary) return CURLE_OUT_OF_MEMORY; @@ -1156,7 +1157,7 @@ CURLcode Curl_getformdata(struct SessionHandle *data, the magic to include several files with the same field name */ Curl_safefree(fileboundary); - fileboundary = Curl_FormBoundary(); + fileboundary = formboundary(); if(!fileboundary) { result = CURLE_OUT_OF_MEMORY; break; @@ -1459,6 +1460,34 @@ char *Curl_formpostheader(void *formp, size_t *len) return header; } +/* + * formboundary() creates a suitable boundary string and returns an allocated + * one. + */ +static char *formboundary(void) +{ + char *retstring; + size_t i; + + static const char table16[]="0123456789abcdef"; + + retstring = malloc(BOUNDARY_LENGTH+1); + + if(!retstring) + return NULL; /* failed */ + + strcpy(retstring, "----------------------------"); + + for(i=strlen(retstring); i