- tests/libtest: move exception to `stub_gssapi.h`.
- tests/libtest: move remaining exception to `testtrace.c`.
- tests/server: drop obsolete exception.
- docs/examples: move `BANNEDFUNC` exceptions to local files (3 lines).
- docs/examples: move `ERRNOVAR` exception to `ephiperfifo.c`.
- docs/examples: drop `typedef struct` (8 files).
- lib/curlx: add `.checksrc` with banned funcs copied from lib.
- checksrc: ban `strncpy`, `strtok_r`, `strtoul` by default.
Drop local bans. Add exception for `strtoul` to `tests/server'.
- lib, src: sync banned funcs.
Also:
- REUSE: drop `stunnel.pem`, it no longer exists.
- docs/examples: formatting.
- docs/examples: simplify some `sizeof()`s.
Closes #17764
"renovate.json",
"tests/certs/**",
"tests/data/test**",
- "tests/stunnel.pem",
"tests/valgrind.supp",
# checksrc control files
- "docs/examples/.checksrc",
"lib/.checksrc",
+ "lib/curlx/.checksrc",
"lib/vauth/.checksrc",
"lib/vquic/.checksrc",
"lib/vssh/.checksrc",
"lib/vtls/.checksrc",
"src/.checksrc",
- "tests/libtest/.checksrc",
"tests/server/.checksrc",
]
SPDX-FileCopyrightText = "Daniel Stenberg, <daniel@haxx.se>, et al."
+++ /dev/null
-disable BANNEDFUNC
-disable ERRNOVAR
-disable TYPEDEFSTRUCT
AUTOMAKE_OPTIONS = foreign nostdinc
-EXTRA_DIST = README.md Makefile.example CMakeLists.txt \
- $(COMPLICATED_EXAMPLES) .checksrc
+EXTRA_DIST = CMakeLists.txt README.md Makefile.example $(COMPLICATED_EXAMPLES)
# Specify our include paths here, and do it relative to $(top_srcdir) and
# $(top_builddir), to ensure that these paths which belong to the library
}
/* resizable buffer */
-typedef struct {
+struct memory {
char *buf;
size_t size;
-} memory;
+};
static size_t grow_buffer(void *contents, size_t sz, size_t nmemb, void *ctx)
{
size_t realsize = sz * nmemb;
- memory *mem = (memory*) ctx;
+ struct memory *mem = (struct memory*) ctx;
char *ptr = realloc(mem->buf, mem->size + realsize);
if(!ptr) {
/* out of memory */
static CURL *make_handle(const char *url)
{
CURL *handle = curl_easy_init();
- memory *mem;
+ struct memory *mem;
/* Important: use HTTP2 over HTTPS */
curl_easy_setopt(handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS);
curl_easy_setopt(handle, CURLOPT_URL, url);
/* buffer body */
- mem = malloc(sizeof(memory));
+ mem = malloc(sizeof(*mem));
mem->size = 0;
mem->buf = malloc(1);
curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, grow_buffer);
}
/* HREF finder implemented in libxml2 but could be any HTML parser */
-static size_t follow_links(CURLM *multi_handle, memory *mem, const char *url)
+static size_t follow_links(CURLM *multi_handle, struct memory *mem,
+ const char *url)
{
int opts = HTML_PARSE_NOBLANKS | HTML_PARSE_NOERROR | \
HTML_PARSE_NOWARNING | HTML_PARSE_NONET;
if(m->msg == CURLMSG_DONE) {
CURL *handle = m->easy_handle;
char *url;
- memory *mem;
+ struct memory *mem;
curl_easy_getinfo(handle, CURLINFO_PRIVATE, &mem);
curl_easy_getinfo(handle, CURLINFO_EFFECTIVE_URL, &url);
if(m->data.result == CURLE_OK) {
/* Global information, common to all connections */
-typedef struct _GlobalInfo
-{
+struct GlobalInfo {
int epfd; /* epoll filedescriptor */
int tfd; /* timer filedescriptor */
int fifofd; /* fifo filedescriptor */
CURLM *multi;
int still_running;
FILE *input;
-} GlobalInfo;
+};
/* Information associated with a specific easy handle */
-typedef struct _ConnInfo
-{
+struct ConnInfo {
CURL *easy;
char *url;
- GlobalInfo *global;
+ struct GlobalInfo *global;
char error[CURL_ERROR_SIZE];
-} ConnInfo;
+};
/* Information associated with a specific socket */
-typedef struct _SockInfo
-{
+struct SockInfo {
curl_socket_t sockfd;
CURL *easy;
int action;
long timeout;
- GlobalInfo *global;
-} SockInfo;
+ struct GlobalInfo *global;
+};
#define mycase(code) \
case code: s = __STRING(code)
}
}
-static void timer_cb(GlobalInfo* g, int revents);
+static void timer_cb(struct GlobalInfo *g, int revents);
/* Update the timer after curl_multi library does its thing. Curl informs the
* application through this callback what it wants the new timeout to be,
* after it does some work. */
-static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g)
+static int multi_timer_cb(CURLM *multi, long timeout_ms, struct GlobalInfo *g)
{
struct itimerspec its;
its.it_value.tv_nsec = 1;
}
else {
- memset(&its, 0, sizeof(struct itimerspec));
+ memset(&its, 0, sizeof(its));
}
timerfd_settime(g->tfd, /* flags= */0, &its, NULL);
/* Check for completed transfers, and remove their easy handles */
-static void check_multi_info(GlobalInfo *g)
+static void check_multi_info(struct GlobalInfo *g)
{
char *eff_url;
CURLMsg *msg;
int msgs_left;
- ConnInfo *conn;
+ struct ConnInfo *conn;
CURL *easy;
CURLcode res;
}
/* Called by libevent when we get action on a multi socket filedescriptor */
-static void event_cb(GlobalInfo *g, int fd, int revents)
+static void event_cb(struct GlobalInfo *g, int fd, int revents)
{
CURLMcode rc;
struct itimerspec its;
check_multi_info(g);
if(g->still_running <= 0) {
fprintf(MSG_OUT, "last transfer done, kill timeout\n");
- memset(&its, 0, sizeof(struct itimerspec));
+ memset(&its, 0, sizeof(its));
timerfd_settime(g->tfd, 0, &its, NULL);
}
}
/* Called by main loop when our timeout expires */
-static void timer_cb(GlobalInfo* g, int revents)
+static void timer_cb(struct GlobalInfo *g, int revents)
{
CURLMcode rc;
uint64_t count = 0;
/* Clean up the SockInfo structure */
-static void remsock(SockInfo *f, GlobalInfo* g)
+static void remsock(struct SockInfo *f, struct GlobalInfo *g)
{
if(f) {
if(f->sockfd) {
/* Assign information to a SockInfo structure */
-static void setsock(SockInfo *f, curl_socket_t s, CURL *e, int act,
- GlobalInfo *g)
+static void setsock(struct SockInfo *f, curl_socket_t s, CURL *e, int act,
+ struct GlobalInfo *g)
{
struct epoll_event ev;
int kind = ((act & CURL_POLL_IN) ? EPOLLIN : 0) |
/* Initialize a new SockInfo structure */
-static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g)
+static void addsock(curl_socket_t s, CURL *easy, int action,
+ struct GlobalInfo *g)
{
- SockInfo *fdp = (SockInfo*)calloc(1, sizeof(SockInfo));
+ struct SockInfo *fdp = (struct SockInfo*)calloc(1, sizeof(struct SockInfo));
fdp->global = g;
setsock(fdp, s, easy, action, g);
/* CURLMOPT_SOCKETFUNCTION */
static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
{
- GlobalInfo *g = (GlobalInfo*) cbp;
- SockInfo *fdp = (SockInfo*) sockp;
+ struct GlobalInfo *g = (struct GlobalInfo*) cbp;
+ struct SockInfo *fdp = (struct SockInfo*) sockp;
const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" };
fprintf(MSG_OUT,
static int prog_cb(void *p, double dltotal, double dlnow, double ult,
double uln)
{
- ConnInfo *conn = (ConnInfo *)p;
+ struct ConnInfo *conn = (struct ConnInfo *)p;
(void)ult;
(void)uln;
/* Create a new easy handle, and add it to the global curl_multi */
-static void new_conn(const char *url, GlobalInfo *g)
+static void new_conn(const char *url, struct GlobalInfo *g)
{
- ConnInfo *conn;
+ struct ConnInfo *conn;
CURLMcode rc;
- conn = (ConnInfo*)calloc(1, sizeof(ConnInfo));
+ conn = (struct ConnInfo*)calloc(1, sizeof(*conn));
conn->error[0] = '\0';
conn->easy = curl_easy_init();
}
/* This gets called whenever data is received from the fifo */
-static void fifo_cb(GlobalInfo* g, int revents)
+static void fifo_cb(struct GlobalInfo *g, int revents)
{
char s[1024];
long int rv = 0;
/* Create a named pipe and tell libevent to monitor it */
static const char *fifo = "hiper.fifo";
-static int init_fifo(GlobalInfo *g)
+static int init_fifo(struct GlobalInfo *g)
{
struct stat st;
curl_socket_t sockfd;
return 0;
}
-static void clean_fifo(GlobalInfo *g)
+static void clean_fifo(struct GlobalInfo *g)
{
epoll_ctl(g->epfd, EPOLL_CTL_DEL, g->fifofd, NULL);
fclose(g->input);
int main(int argc, char **argv)
{
- GlobalInfo g;
+ struct GlobalInfo g;
struct itimerspec its;
struct epoll_event ev;
struct epoll_event events[10];
g_should_exit_ = 0;
signal(SIGINT, sigint_handler);
- memset(&g, 0, sizeof(GlobalInfo));
+ memset(&g, 0, sizeof(g));
g.epfd = epoll_create1(EPOLL_CLOEXEC);
if(g.epfd == -1) {
perror("epoll_create1 failed");
return 1;
}
- memset(&its, 0, sizeof(struct itimerspec));
+ memset(&its, 0, sizeof(its));
its.it_interval.tv_sec = 0;
its.it_value.tv_sec = 1;
timerfd_settime(g.tfd, 0, &its, NULL);
int err = epoll_wait(g.epfd, events,
sizeof(events)/sizeof(struct epoll_event), 10000);
if(err == -1) {
+ /* !checksrc! disable ERRNOVAR 1 */
if(errno == EINTR) {
fprintf(MSG_OUT, "note: wait interrupted\n");
continue;
/* Global information, common to all connections */
-typedef struct _GlobalInfo
-{
+struct GlobalInfo {
struct ev_loop *loop;
struct ev_io fifo_event;
struct ev_timer timer_event;
CURLM *multi;
int still_running;
FILE *input;
-} GlobalInfo;
+};
/* Information associated with a specific easy handle */
-typedef struct _ConnInfo
-{
+struct ConnInfo {
CURL *easy;
char *url;
- GlobalInfo *global;
+ struct GlobalInfo *global;
char error[CURL_ERROR_SIZE];
-} ConnInfo;
+};
/* Information associated with a specific socket */
-typedef struct _SockInfo
-{
+struct SockInfo {
curl_socket_t sockfd;
CURL *easy;
int action;
long timeout;
struct ev_io ev;
int evset;
- GlobalInfo *global;
-} SockInfo;
+ struct GlobalInfo *global;
+};
static void timer_cb(EV_P_ struct ev_timer *w, int revents);
/* Update the event timer after curl_multi library calls */
-static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g)
+static int multi_timer_cb(CURLM *multi, long timeout_ms, struct GlobalInfo *g)
{
(void)multi;
printf("%s %li\n", __PRETTY_FUNCTION__, timeout_ms);
/* Check for completed transfers, and remove their easy handles */
-static void check_multi_info(GlobalInfo *g)
+static void check_multi_info(struct GlobalInfo *g)
{
char *eff_url;
CURLMsg *msg;
int msgs_left;
- ConnInfo *conn;
+ struct ConnInfo *conn;
CURL *easy;
CURLcode res;
/* Called by libevent when we get action on a multi socket */
static void event_cb(EV_P_ struct ev_io *w, int revents)
{
- GlobalInfo *g;
+ struct GlobalInfo *g;
CURLMcode rc;
int action;
printf("%s w %p revents %i\n", __PRETTY_FUNCTION__, (void *)w, revents);
- g = (GlobalInfo*) w->data;
+ g = (struct GlobalInfo*) w->data;
action = ((revents & EV_READ) ? CURL_POLL_IN : 0) |
((revents & EV_WRITE) ? CURL_POLL_OUT : 0);
/* Called by libevent when our timeout expires */
static void timer_cb(EV_P_ struct ev_timer *w, int revents)
{
- GlobalInfo *g;
+ struct GlobalInfo *g;
CURLMcode rc;
printf("%s w %p revents %i\n", __PRETTY_FUNCTION__, (void *)w, revents);
- g = (GlobalInfo *)w->data;
+ g = (struct GlobalInfo *)w->data;
rc = curl_multi_socket_action(g->multi, CURL_SOCKET_TIMEOUT, 0,
&g->still_running);
}
/* Clean up the SockInfo structure */
-static void remsock(SockInfo *f, GlobalInfo *g)
+static void remsock(struct SockInfo *f, struct GlobalInfo *g)
{
printf("%s \n", __PRETTY_FUNCTION__);
if(f) {
/* Assign information to a SockInfo structure */
-static void setsock(SockInfo *f, curl_socket_t s, CURL *e, int act,
- GlobalInfo *g)
+static void setsock(struct SockInfo *f, curl_socket_t s, CURL *e, int act,
+ struct GlobalInfo *g)
{
int kind = ((act & CURL_POLL_IN) ? EV_READ : 0) |
((act & CURL_POLL_OUT) ? EV_WRITE : 0);
/* Initialize a new SockInfo structure */
-static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g)
+static void addsock(curl_socket_t s, CURL *easy, int action,
+ struct GlobalInfo *g)
{
- SockInfo *fdp = calloc(1, sizeof(SockInfo));
+ struct SockInfo *fdp = calloc(1, sizeof(struct SockInfo));
fdp->global = g;
setsock(fdp, s, easy, action, g);
/* CURLMOPT_SOCKETFUNCTION */
static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
{
- GlobalInfo *g = (GlobalInfo*) cbp;
- SockInfo *fdp = (SockInfo*) sockp;
+ struct GlobalInfo *g = (struct GlobalInfo*) cbp;
+ struct SockInfo *fdp = (struct SockInfo*) sockp;
const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE"};
printf("%s e %p s %i what %i cbp %p sockp %p\n",
static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)
{
size_t realsize = size * nmemb;
- ConnInfo *conn = (ConnInfo*) data;
+ struct ConnInfo *conn = (struct ConnInfo*) data;
(void)ptr;
(void)conn;
return realsize;
static int xferinfo_cb(void *p, curl_off_t dltotal, curl_off_t dlnow,
curl_off_t ult, curl_off_t uln)
{
- ConnInfo *conn = (ConnInfo *)p;
+ struct ConnInfo *conn = (struct ConnInfo *)p;
(void)ult;
(void)uln;
/* Create a new easy handle, and add it to the global curl_multi */
-static void new_conn(const char *url, GlobalInfo *g)
+static void new_conn(const char *url, struct GlobalInfo *g)
{
- ConnInfo *conn;
+ struct ConnInfo *conn;
CURLMcode rc;
- conn = calloc(1, sizeof(ConnInfo));
+ conn = calloc(1, sizeof(*conn));
conn->error[0]='\0';
conn->easy = curl_easy_init();
char s[1024];
long int rv = 0;
int n = 0;
- GlobalInfo *g = (GlobalInfo *)w->data;
+ struct GlobalInfo *g = (struct GlobalInfo *)w->data;
(void)revents;
}
/* Create a named pipe and tell libevent to monitor it */
-static int init_fifo(GlobalInfo *g)
+static int init_fifo(struct GlobalInfo *g)
{
struct stat st;
static const char *fifo = "hiper.fifo";
int main(int argc, char **argv)
{
- GlobalInfo g;
+ struct GlobalInfo g;
(void)argc;
(void)argv;
- memset(&g, 0, sizeof(GlobalInfo));
+ memset(&g, 0, sizeof(g));
g.loop = ev_default_loop(0);
if(init_fifo(&g))
#define SHOW_PROGRESS 0 /* Set to non-zero to enable progress callback */
/* Global information, common to all connections */
-typedef struct _GlobalInfo {
+struct GlobalInfo {
CURLM *multi;
guint timer_event;
int still_running;
-} GlobalInfo;
+};
/* Information associated with a specific easy handle */
-typedef struct _ConnInfo {
+struct ConnInfo {
CURL *easy;
char *url;
- GlobalInfo *global;
+ struct GlobalInfo *global;
char error[CURL_ERROR_SIZE];
-} ConnInfo;
+};
/* Information associated with a specific socket */
-typedef struct _SockInfo {
+struct SockInfo {
curl_socket_t sockfd;
CURL *easy;
int action;
long timeout;
GIOChannel *ch;
guint ev;
- GlobalInfo *global;
-} SockInfo;
+ struct GlobalInfo *global;
+};
/* Die if we get a bad CURLMcode somewhere */
static void mcode_or_die(const char *where, CURLMcode code)
}
/* Check for completed transfers, and remove their easy handles */
-static void check_multi_info(GlobalInfo *g)
+static void check_multi_info(struct GlobalInfo *g)
{
CURLMsg *msg;
int msgs_left;
CURL *easy = msg->easy_handle;
CURLcode res = msg->data.result;
char *eff_url;
- ConnInfo *conn;
+ struct ConnInfo *conn;
curl_easy_getinfo(easy, CURLINFO_PRIVATE, &conn);
curl_easy_getinfo(easy, CURLINFO_EFFECTIVE_URL, &eff_url);
MSG_OUT("DONE: %s => (%d) %s\n", eff_url, res, conn->error);
/* Called by glib when our timeout expires */
static gboolean timer_cb(gpointer data)
{
- GlobalInfo *g = (GlobalInfo *)data;
+ struct GlobalInfo *g = (struct GlobalInfo *)data;
CURLMcode rc;
rc = curl_multi_socket_action(g->multi,
static int update_timeout_cb(CURLM *multi, long timeout_ms, void *userp)
{
struct timeval timeout;
- GlobalInfo *g = (GlobalInfo *)userp;
+ struct GlobalInfo *g = (struct GlobalInfo *)userp;
timeout.tv_sec = timeout_ms/1000;
timeout.tv_usec = (timeout_ms%1000)*1000;
/* Called by glib when we get action on a multi socket */
static gboolean event_cb(GIOChannel *ch, GIOCondition condition, gpointer data)
{
- GlobalInfo *g = (GlobalInfo*) data;
+ struct GlobalInfo *g = (struct GlobalInfo*) data;
CURLMcode rc;
int fd = g_io_channel_unix_get_fd(ch);
}
/* Clean up the SockInfo structure */
-static void remsock(SockInfo *f)
+static void remsock(struct SockInfo *f)
{
if(!f) {
return;
}
/* Assign information to a SockInfo structure */
-static void setsock(SockInfo *f, curl_socket_t s, CURL *e, int act,
- GlobalInfo *g)
+static void setsock(struct SockInfo *f, curl_socket_t s, CURL *e, int act,
+ struct GlobalInfo *g)
{
GIOCondition kind =
((act & CURL_POLL_IN) ? G_IO_IN : 0) |
}
/* Initialize a new SockInfo structure */
-static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g)
+static void addsock(curl_socket_t s, CURL *easy, int action,
+ struct GlobalInfo *g)
{
- SockInfo *fdp = g_malloc0(sizeof(SockInfo));
+ struct SockInfo *fdp = g_malloc0(sizeof(struct SockInfo));
fdp->global = g;
fdp->ch = g_io_channel_unix_new(s);
/* CURLMOPT_SOCKETFUNCTION */
static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
{
- GlobalInfo *g = (GlobalInfo*) cbp;
- SockInfo *fdp = (SockInfo*) sockp;
+ struct GlobalInfo *g = (struct GlobalInfo*) cbp;
+ struct SockInfo *fdp = (struct SockInfo*) sockp;
static const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" };
MSG_OUT("socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]);
static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)
{
size_t realsize = size * nmemb;
- ConnInfo *conn = (ConnInfo*) data;
+ struct ConnInfo *conn = (struct ConnInfo*) data;
(void)ptr;
(void)conn;
return realsize;
static int xferinfo_cb(void *p, curl_off_t dltotal, curl_off_t dlnow,
curl_off_t ult, curl_off_t uln)
{
- ConnInfo *conn = (ConnInfo *)p;
+ struct ConnInfo *conn = (struct ConnInfo *)p;
(void)ult;
(void)uln;
}
/* Create a new easy handle, and add it to the global curl_multi */
-static void new_conn(const char *url, GlobalInfo *g)
+static void new_conn(const char *url, struct GlobalInfo *g)
{
- ConnInfo *conn;
+ struct ConnInfo *conn;
CURLMcode rc;
- conn = g_malloc0(sizeof(ConnInfo));
+ conn = g_malloc0(sizeof(*conn));
conn->error[0] = '\0';
conn->easy = curl_easy_init();
if(!conn->easy) {
if(tp) {
buf[tp]='\0';
}
- new_conn(buf, (GlobalInfo*)data);
+ new_conn(buf, (struct GlobalInfo*)data);
g_free(buf);
}
else {
}
}
if(all) {
- new_conn(all, (GlobalInfo*)data);
+ new_conn(all, (struct GlobalInfo*)data);
g_free(all);
}
g_free(buf);
int main(void)
{
- GlobalInfo *g = g_malloc0(sizeof(GlobalInfo));
+ struct GlobalInfo *g = g_malloc0(sizeof(struct GlobalInfo));
GMainLoop*gmain;
int fd;
GIOChannel* ch;
/* Global information, common to all connections */
-typedef struct _GlobalInfo
-{
+struct GlobalInfo {
struct event_base *evbase;
struct event fifo_event;
struct event timer_event;
int still_running;
FILE *input;
int stopped;
-} GlobalInfo;
+};
/* Information associated with a specific easy handle */
-typedef struct _ConnInfo
-{
+struct ConnInfo {
CURL *easy;
char *url;
- GlobalInfo *global;
+ struct GlobalInfo *global;
char error[CURL_ERROR_SIZE];
-} ConnInfo;
+};
/* Information associated with a specific socket */
-typedef struct _SockInfo
-{
+struct SockInfo {
curl_socket_t sockfd;
CURL *easy;
int action;
long timeout;
struct event ev;
- GlobalInfo *global;
-} SockInfo;
+ struct GlobalInfo *global;
+};
#define mycase(code) \
case code: s = __STRING(code)
/* Update the event timer after curl_multi library calls */
-static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g)
+static int multi_timer_cb(CURLM *multi, long timeout_ms, struct GlobalInfo *g)
{
struct timeval timeout;
(void)multi;
/* Check for completed transfers, and remove their easy handles */
-static void check_multi_info(GlobalInfo *g)
+static void check_multi_info(struct GlobalInfo *g)
{
char *eff_url;
CURLMsg *msg;
int msgs_left;
- ConnInfo *conn;
+ struct ConnInfo *conn;
CURL *easy;
CURLcode res;
/* Called by libevent when we get action on a multi socket */
static void event_cb(int fd, short kind, void *userp)
{
- GlobalInfo *g = (GlobalInfo*) userp;
+ struct GlobalInfo *g = (struct GlobalInfo*) userp;
CURLMcode rc;
int action =
/* Called by libevent when our timeout expires */
static void timer_cb(int fd, short kind, void *userp)
{
- GlobalInfo *g = (GlobalInfo *)userp;
+ struct GlobalInfo *g = (struct GlobalInfo *)userp;
CURLMcode rc;
(void)fd;
(void)kind;
/* Clean up the SockInfo structure */
-static void remsock(SockInfo *f)
+static void remsock(struct SockInfo *f)
{
if(f) {
if(event_initialized(&f->ev)) {
/* Assign information to a SockInfo structure */
-static void setsock(SockInfo *f, curl_socket_t s, CURL *e, int act,
- GlobalInfo *g)
+static void setsock(struct SockInfo *f, curl_socket_t s, CURL *e, int act,
+ struct GlobalInfo *g)
{
int kind =
((act & CURL_POLL_IN) ? EV_READ : 0) |
/* Initialize a new SockInfo structure */
-static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g)
+static void addsock(curl_socket_t s, CURL *easy, int action,
+ struct GlobalInfo *g)
{
- SockInfo *fdp = calloc(1, sizeof(SockInfo));
+ struct SockInfo *fdp = calloc(1, sizeof(struct SockInfo));
fdp->global = g;
setsock(fdp, s, easy, action, g);
/* CURLMOPT_SOCKETFUNCTION */
static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
{
- GlobalInfo *g = (GlobalInfo*) cbp;
- SockInfo *fdp = (SockInfo*) sockp;
+ struct GlobalInfo *g = (struct GlobalInfo*) cbp;
+ struct SockInfo *fdp = (struct SockInfo*) sockp;
const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" };
fprintf(MSG_OUT,
static int xferinfo_cb(void *p, curl_off_t dltotal, curl_off_t dlnow,
curl_off_t ult, curl_off_t uln)
{
- ConnInfo *conn = (ConnInfo *)p;
+ struct ConnInfo *conn = (struct ConnInfo *)p;
(void)ult;
(void)uln;
/* Create a new easy handle, and add it to the global curl_multi */
-static void new_conn(const char *url, GlobalInfo *g)
+static void new_conn(const char *url, struct GlobalInfo *g)
{
- ConnInfo *conn;
+ struct ConnInfo *conn;
CURLMcode rc;
- conn = calloc(1, sizeof(ConnInfo));
+ conn = calloc(1, sizeof(*conn));
conn->error[0] = '\0';
conn->easy = curl_easy_init();
char s[1024];
long int rv = 0;
int n = 0;
- GlobalInfo *g = (GlobalInfo *)arg;
+ struct GlobalInfo *g = (struct GlobalInfo *)arg;
(void)fd;
(void)event;
/* Create a named pipe and tell libevent to monitor it */
static const char *fifo = "hiper.fifo";
-static int init_fifo(GlobalInfo *g)
+static int init_fifo(struct GlobalInfo *g)
{
struct stat st;
curl_socket_t sockfd;
return 0;
}
-static void clean_fifo(GlobalInfo *g)
+static void clean_fifo(struct GlobalInfo *g)
{
event_del(&g->fifo_event);
fclose(g->input);
int main(int argc, char **argv)
{
- GlobalInfo g;
+ struct GlobalInfo g;
(void)argc;
(void)argv;
- memset(&g, 0, sizeof(GlobalInfo));
+ memset(&g, 0, sizeof(g));
g.evbase = event_base_new();
if(init_fifo(&g))
return 1;
known_offset = 1;
}
secs = epoch_offset + tv.tv_sec;
+ /* !checksrc! disable BANNEDFUNC 1 */
now = localtime(&secs); /* not thread safe but we do not care */
curl_msnprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld",
now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
static CURLM *curl_handle;
static struct event *timeout;
-typedef struct curl_context_s {
+struct curl_context {
struct event *event;
curl_socket_t sockfd;
-} curl_context_t;
+};
static void curl_perform(int fd, short event, void *arg);
-static curl_context_t *create_curl_context(curl_socket_t sockfd)
+static struct curl_context *create_curl_context(curl_socket_t sockfd)
{
- curl_context_t *context;
+ struct curl_context *context;
- context = (curl_context_t *) malloc(sizeof(*context));
+ context = (struct curl_context *) malloc(sizeof(*context));
context->sockfd = sockfd;
return context;
}
-static void destroy_curl_context(curl_context_t *context)
+static void destroy_curl_context(struct curl_context *context)
{
event_del(context->event);
event_free(context->event);
{
int running_handles;
int flags = 0;
- curl_context_t *context;
+ struct curl_context *context;
(void)fd;
if(event & EV_WRITE)
flags |= CURL_CSELECT_OUT;
- context = (curl_context_t *) arg;
+ context = (struct curl_context *) arg;
curl_multi_socket_action(curl_handle, context->sockfd, flags,
&running_handles);
static int handle_socket(CURL *easy, curl_socket_t s, int action, void *userp,
void *socketp)
{
- curl_context_t *curl_context;
+ struct curl_context *curl_context;
int events = 0;
(void)easy;
case CURL_POLL_OUT:
case CURL_POLL_INOUT:
curl_context = socketp ?
- (curl_context_t *) socketp : create_curl_context(s);
+ (struct curl_context *) socketp : create_curl_context(s);
curl_multi_assign(curl_handle, s, (void *) curl_context);
break;
case CURL_POLL_REMOVE:
if(socketp) {
- event_del(((curl_context_t*) socketp)->event);
- destroy_curl_context((curl_context_t*) socketp);
+ event_del(((struct curl_context*) socketp)->event);
+ destroy_curl_context((struct curl_context*) socketp);
curl_multi_assign(curl_handle, s, NULL);
}
break;
CURLM *multi;
};
-typedef struct curl_context_s {
+struct curl_context {
uv_poll_t poll_handle;
curl_socket_t sockfd;
struct datauv *uv;
-} curl_context_t;
+};
-static curl_context_t *create_curl_context(curl_socket_t sockfd,
- struct datauv *uv)
+static struct curl_context *create_curl_context(curl_socket_t sockfd,
+ struct datauv *uv)
{
- curl_context_t *context;
+ struct curl_context *context;
- context = (curl_context_t *) malloc(sizeof(*context));
+ context = (struct curl_context *) malloc(sizeof(*context));
context->sockfd = sockfd;
context->uv = uv;
static void curl_close_cb(uv_handle_t *handle)
{
- curl_context_t *context = (curl_context_t *) handle->data;
+ struct curl_context *context = (struct curl_context *) handle->data;
free(context);
}
-static void destroy_curl_context(curl_context_t *context)
+static void destroy_curl_context(struct curl_context *context)
{
uv_close((uv_handle_t *) &context->poll_handle, curl_close_cb);
}
fprintf(stderr, "Added download %s -> %s\n", url, filename);
}
-static void check_multi_info(curl_context_t *context)
+static void check_multi_info(struct curl_context *context)
{
char *done_url;
CURLMsg *message;
{
int running_handles;
int flags = 0;
- curl_context_t *context = (curl_context_t *) req->data;
+ struct curl_context *context = (struct curl_context *) req->data;
(void)status;
if(events & UV_READABLE)
flags |= CURL_CSELECT_IN;
/* callback from libuv when timeout expires */
static void on_uv_timeout(uv_timer_t *req)
{
- curl_context_t *context = (curl_context_t *) req->data;
+ struct curl_context *context = (struct curl_context *) req->data;
if(context) {
int running_handles;
curl_multi_socket_action(context->uv->multi, CURL_SOCKET_TIMEOUT, 0,
struct datauv *uv,
void *socketp)
{
- curl_context_t *curl_context;
+ struct curl_context *curl_context;
int events = 0;
(void)easy;
case CURL_POLL_OUT:
case CURL_POLL_INOUT:
curl_context = socketp ?
- (curl_context_t *) socketp : create_curl_context(s, uv);
+ (struct curl_context *) socketp : create_curl_context(s, uv);
curl_multi_assign(uv->multi, s, (void *) curl_context);
break;
case CURL_POLL_REMOVE:
if(socketp) {
- uv_poll_stop(&((curl_context_t*)socketp)->poll_handle);
- destroy_curl_context((curl_context_t*) socketp);
+ uv_poll_stop(&((struct curl_context*)socketp)->poll_handle);
+ destroy_curl_context((struct curl_context*) socketp);
curl_multi_assign(uv->multi, s, NULL);
}
break;
#define SYNCTIME_UA "synctime/1.0"
-typedef struct
-{
+struct conf {
char http_proxy[MAX_STRING1];
char proxy_user[MAX_STRING1];
char timeserver[MAX_STRING1];
-} conf_t;
+};
static const char DefaultTimeServer[3][MAX_STRING1] =
{
return;
}
-static int conf_init(conf_t *conf)
+static int conf_init(struct conf *conf)
{
int i;
- *conf->http_proxy = 0;
+ *conf->http_proxy = 0;
for(i = 0; i < MAX_STRING1; i++)
- conf->proxy_user[i] = 0; /* Clean up password from memory */
- *conf->timeserver = 0;
+ conf->proxy_user[i] = 0; /* Clean up password from memory */
+ *conf->timeserver = 0;
return 1;
}
int main(int argc, char *argv[])
{
- CURL *curl;
- conf_t conf[1];
- int RetValue;
+ CURL *curl;
+ struct conf conf[1];
+ int RetValue;
ShowAllHeader = 0; /* Do not show HTTP Header */
AutoSyncTime = 0; /* Do not synchronise computer clock */
/* Calculating time diff between GMT and localtime */
tt = time(0);
+ /* !checksrc! disable BANNEDFUNC 1 */
lt = localtime(&tt);
tt_local = mktime(lt);
+ /* !checksrc! disable BANNEDFUNC 1 */
gmt = gmtime(&tt);
tt_gmt = mktime(gmt);
tzonediffFloat = difftime(tt_local, tt_gmt);
struct ParserStruct state;
/* Initialize the state structure for parsing. */
- memset(&state, 0, sizeof(struct ParserStruct));
+ memset(&state, 0, sizeof(state));
state.ok = 1;
/* Initialize a namespace-aware parser. */
-banfunc strerror
-banfunc strncpy
-banfunc sscanf
banfunc snprintf
-banfunc vsnprint
-banfunc strtoul
+banfunc sscanf
+banfunc strerror
banfunc strtol
-banfunc strtok_r
+banfunc vsnprint
CMAKE_DIST = CMakeLists.txt curl_config.h.cmake
-CHECKSRC_DIST = .checksrc vauth/.checksrc vquic/.checksrc vssh/.checksrc \
- vtls/.checksrc
+CHECKSRC_DIST = .checksrc \
+ curlx/.checksrc vauth/.checksrc vquic/.checksrc vssh/.checksrc vtls/.checksrc
EXTRA_DIST = config-mac.h config-os400.h config-plan9.h config-riscos.h \
config-win32.h curl_config.h.in $(LIB_RCFILES) libcurl.def \
--- /dev/null
+banfunc snprintf
+banfunc sscanf
+banfunc strerror
+banfunc strtol
+banfunc vsnprint
-banfunc strerror
-banfunc strncpy
+banfunc snprintf
banfunc sscanf
+banfunc strerror
+banfunc strtol
+banfunc vsnprint
-banfunc strerror
-banfunc strncpy
+banfunc snprintf
banfunc sscanf
-banfunc strtoul
+banfunc strerror
banfunc strtol
+banfunc vsnprint
-banfunc strerror
-banfunc strncpy
+banfunc snprintf
banfunc sscanf
+banfunc strerror
+banfunc strtol
+banfunc vsnprint
-banfunc strerror
-banfunc strncpy
+banfunc snprintf
banfunc sscanf
-banfunc strtoul
+banfunc strerror
banfunc strtol
+banfunc vsnprint
"vsprintf" => 1,
"strcat" => 1,
"strncat" => 1,
+ "strncpy" => 1,
+ "strtok_r" => 1,
+ "strtoul" => 1,
"_mbscat" => 1,
"_mbsncat" => 1,
"_tcscat" => 1,
enable STDERR
-banfunc strncpy
+banfunc snprintf
banfunc sscanf
banfunc strtol
-banfunc strtoul
+banfunc vsnprint
+++ /dev/null
-disable TYPEDEFSTRUCT
-allowfunc localtime
# Get BUNDLE, FIRST_C, FIRST_H, UTILS_C, UTILS_H, CURLX_C, TESTS_C, STUB_GSS_C, STUB_GSS_H variables
include Makefile.inc
-EXTRA_DIST = CMakeLists.txt .checksrc $(FIRST_C) $(FIRST_H) $(UTILS_C) $(UTILS_H) $(TESTS_C) \
+EXTRA_DIST = CMakeLists.txt $(FIRST_C) $(FIRST_H) $(UTILS_C) $(UTILS_H) $(TESTS_C) \
test307.pl test610.pl test613.pl test1013.pl test1022.pl mk-lib1521.pl
CFLAGS += @CURL_CFLAG_EXTRAS@
/* Roughly based on Heimdal's gssapi.h */
+/* !checksrc! disable TYPEDEFSTRUCT all */
+
#include <stdint.h>
#include <stddef.h>
known_offset = 1;
}
secs = epoch_offset + tv.tv_sec;
+ /* !checksrc! disable BANNEDFUNC 1 */
now = localtime(&secs); /* not thread safe but we don't care */
curl_msnprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld ",
now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
-banfunc strncpy
+allowfunc strtoul