Fixed the code style in *.c files to two spaces indentation and add a linter named funstx to Fun. (0.39.0)
This commit is contained in:
parent
33001a7ad2
commit
03b2532474
237 changed files with 17550 additions and 13911 deletions
15
src/external/curl.c
vendored
15
src/external/curl.c
vendored
|
|
@ -12,18 +12,23 @@
|
|||
/* Ensure libcurl headers and helpers are defined at file scope (not inside vm_run) */
|
||||
#ifdef FUN_WITH_CURL
|
||||
#include <curl/curl.h>
|
||||
typedef struct { char *d; size_t n; } FunCurlBuf;
|
||||
typedef struct {
|
||||
char *d;
|
||||
size_t n;
|
||||
} FunCurlBuf;
|
||||
static size_t fun_curl_write_cb(void *ptr, size_t sz, size_t nm, void *ud) {
|
||||
size_t add = sz * nm;
|
||||
FunCurlBuf *b = (FunCurlBuf*)ud;
|
||||
char *p = (char*)realloc(b->d, b->n + add + 1);
|
||||
FunCurlBuf *b = (FunCurlBuf *)ud;
|
||||
char *p = (char *)realloc(b->d, b->n + add + 1);
|
||||
if (!p) return 0;
|
||||
memcpy(p + b->n, ptr, add);
|
||||
b->d = p; b->n += add; b->d[b->n] = '\0';
|
||||
b->d = p;
|
||||
b->n += add;
|
||||
b->d[b->n] = '\0';
|
||||
return add;
|
||||
}
|
||||
static size_t fun_curl_file_write_cb(void *ptr, size_t sz, size_t nm, void *ud) {
|
||||
FILE *f = (FILE*)ud;
|
||||
FILE *f = (FILE *)ud;
|
||||
return fwrite(ptr, sz, nm, f);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue