mk-lib1521.pl: updated to match the test changes in 916ec30a

This commit is contained in:
Dan Fandrich 2017-06-13 22:03:35 +02:00
Родитель 9f54ad8f15
Коммит 49ff939034
1 изменённых файлов: 22 добавлений и 15 удалений

Просмотреть файл

@ -22,7 +22,7 @@
########################################################################### ###########################################################################
# Usage: # Usage:
# cat ../../include/curl/curl.h | perl mk-lib1521.pl > lib1521.c # perl mk-lib1521.pl < ../../include/curl/curl.h > lib1521.c
# minimum and maximum long signed values # minimum and maximum long signed values
my $minlong = "LONG_MIN"; my $minlong = "LONG_MIN";
@ -106,9 +106,10 @@ curl_xferinfo_callback xferinfocb;
int test(char *URL) int test(char *URL)
{ {
CURL *curl; int res = 0;
CURL *dep; CURL *curl = NULL;
CURLSH *share; CURL *dep = NULL;
CURLSH *share = NULL;
char errorbuffer[CURL_ERROR_SIZE]; char errorbuffer[CURL_ERROR_SIZE];
void *conv_from_network_cb = NULL; void *conv_from_network_cb = NULL;
void *conv_to_network_cb = NULL; void *conv_to_network_cb = NULL;
@ -118,19 +119,23 @@ int test(char *URL)
struct curl_slist *slist=NULL; struct curl_slist *slist=NULL;
struct curl_httppost *httppost=NULL; struct curl_httppost *httppost=NULL;
FILE *stream = stderr; FILE *stream = stderr;
struct data object;
(void)URL; /* not used */ (void)URL; /* not used */
dep = curl_easy_init(); easy_init(dep);
easy_init(curl);
share = curl_share_init(); share = curl_share_init();
curl = curl_easy_init(); if(!share) {
if(curl) { res = CURLE_OUT_OF_MEMORY;
struct data object; goto test_cleanup;
}
HEADER HEADER
; ;
while(<STDIN>) { while(<STDIN>) {
if($_ =~ /^ CINIT\(([^ ]*), ([^ ]*), (\d*)\)/) { if($_ =~ /^ CINIT\(([^ ]*), ([^ ]*), (\d*)\)/) {
my ($name, $type, $val)=($1, $2, $3); my ($name, $type, $val)=($1, $2, $3);
my $w=" "; my $w=" ";
my $pref = "$w(void)curl_easy_setopt(curl, CURLOPT_$name,"; my $pref = "$w(void)curl_easy_setopt(curl, CURLOPT_$name,";
my $i = ' ' x (length($w) + 23); my $i = ' ' x (length($w) + 23);
if($type eq "STRINGPOINT") { if($type eq "STRINGPOINT") {
@ -203,12 +208,14 @@ while(<STDIN>) {
print <<FOOTER print <<FOOTER
curl_easy_setopt(curl, 1, 0); curl_easy_setopt(curl, 1, 0);
curl_easy_cleanup(curl);
curl_easy_cleanup(dep); test_cleanup:
curl_share_cleanup(share); curl_easy_cleanup(curl);
} curl_easy_cleanup(dep);
return 0; curl_share_cleanup(share);
return res;
} }
FOOTER FOOTER
; ;