Skip to content

Commit 11d44d6

Browse files
committed
Debug build
1 parent a9874c7 commit 11d44d6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/lcmulti.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "lcerror.h"
2525
#include "lcutils.h"
2626
#include "lchttppost.h"
27+
#include <stdio.h>
2728

2829
#define LCURL_MULTI_NAME LCURL_PREFIX" Multi"
2930
static const char *LCURL_MULTI = LCURL_MULTI_NAME;
@@ -433,24 +434,29 @@ static int lcurl_opt_set_string_array_(lua_State *L, int opt){
433434
n = lua_rawlen(L, 2);
434435
}
435436

437+
fprintf(stderr, "\n>>> array size %d\n", n);
438+
436439
if(n == 0){
437440
code = curl_multi_setopt(p->curl, opt, 0);
438441
}
439442
else{
440443
int i;
441444
char const* *val = malloc(sizeof(char*) * (n + 1));
445+
fprintf(stderr, ">>> allocate size %d: %p\n", sizeof(char*) * (n + 1), val);
442446
if(!*val){
443447
return lcurl_fail_ex(L, p->err_mode, LCURL_ERROR_MULTI, CURLM_OUT_OF_MEMORY);
444448
}
445449
for(i = 1; i <= n; ++i){
446450
lua_rawgeti(L, 2, i);
451+
fprintf(stderr, ">>> add string %s\n", lua_tostring(L, -1));
447452
val[i-1] = lua_tostring(L, -1);
448453
lua_pop(L, 1);
449454
}
450455
val[n] = NULL;
451456
code = curl_multi_setopt(p->curl, opt, val);
452457
free((void*)val);
453458
}
459+
fprintf(stderr, ">>> setopt result %d\n", code);
454460

455461
if(code != CURLM_OK){
456462
return lcurl_fail_ex(L, p->err_mode, LCURL_ERROR_MULTI, code);

0 commit comments

Comments
 (0)