--- embedaddon/libnet/src/libnet_cq.c 2021/03/16 23:47:28 1.1.1.3 +++ embedaddon/libnet/src/libnet_cq.c 2023/09/27 11:11:38 1.1.1.4 @@ -1,5 +1,5 @@ /* - * $Id: libnet_cq.c,v 1.1.1.3 2021/03/16 23:47:28 misho Exp $ + * $Id: libnet_cq.c,v 1.1.1.4 2023/09/27 11:11:38 misho Exp $ * * libnet * libnet_cq.c - context queue management routines @@ -31,14 +31,7 @@ * */ -#if (HAVE_CONFIG_H) -#include "../include/config.h" -#endif -#if (!(_WIN32) || (__CYGWIN__)) -#include "../include/libnet.h" -#else -#include "../include/win32/libnet.h" -#endif +#include "common.h" /* private function prototypes */ static libnet_cq_t *libnet_cq_find_internal(libnet_t *); @@ -51,7 +44,7 @@ static libnet_cqd_t l_cqd = {0, CQ_LOCK_UNLOCKED, NULL static int -set_cq_lock(uint x) +set_cq_lock(uint32_t x) { if (check_cq_lock(x)) { @@ -63,7 +56,7 @@ set_cq_lock(uint x) } static int -clear_cq_lock(uint x) +clear_cq_lock(uint32_t x) { if (!check_cq_lock(x)) { @@ -88,14 +81,14 @@ libnet_cq_add(libnet_t *l, char *label) if (cq_is_wlocked()) { snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, - "%s(): can't add, context queue is write locked\n", __func__); + "%s(): can't add, context queue is write locked", __func__); return (-1); } /* ensure there is a label */ if (label == NULL) { - snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): empty label\n", + snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): empty label", __func__); return (-1); } @@ -107,7 +100,7 @@ libnet_cq_add(libnet_t *l, char *label) if (l_cq == NULL) { snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, - "%s(): can't malloc initial context queue: %s\n", + "%s(): can't malloc initial context queue: %s", __func__, strerror(errno)); return (-1); } @@ -138,7 +131,7 @@ libnet_cq_add(libnet_t *l, char *label) if (l_cq == NULL) { snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, - "%s(): can't malloc new context queue: %s\n", + "%s(): can't malloc new context queue: %s", __func__, strerror(errno)); return (-1); } @@ -170,7 +163,7 @@ libnet_cq_remove(libnet_t *l) if (l_cq == NULL) { snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, - "%s(): can't remove from empty context queue\n", __func__); + "%s(): can't remove from empty context queue", __func__); return (NULL); } @@ -183,7 +176,7 @@ libnet_cq_remove(libnet_t *l) if (cq_is_wlocked()) { snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, - "%s(): can't remove, context queue is write locked\n", + "%s(): can't remove, context queue is write locked", __func__); return (NULL); } @@ -191,7 +184,7 @@ libnet_cq_remove(libnet_t *l) if ((p = libnet_cq_find_internal(l)) == NULL) { snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, - "%s(): context not present in context queue\n", __func__); + "%s(): context not present in context queue", __func__); return (NULL); } @@ -282,13 +275,13 @@ libnet_cq_dup_check(libnet_t *l, char *label) if (p->context == l) { snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, - "%s(): context already in context queue\n", __func__); + "%s(): context already in context queue", __func__); return (1); } if (strncmp(p->context->label, label, LIBNET_LABEL_SIZE) == 0) { snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, - "%s(): duplicate label %s\n", __func__, label); + "%s(): duplicate label %s", __func__, label); return (1); } } @@ -407,3 +400,9 @@ libnet_cq_end_loop() return (1); } +/** + * Local Variables: + * indent-tabs-mode: nil + * c-file-style: "stroustrup" + * End: + */