← Commit list

8ffe0db8f8

Viktor Szakats
Viktor Szakats
2026-03-21
SUCCESS Duration: 267s

Subject

lib: move all UNITTEST prototypes to C files (cont.)

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/cf-ip-happy.c+4 -2
@@ -92,8 +92,10 @@ static cf_ip_connect_create *get_cf_create(uint8_t transport)
#ifdef UNITTESTS
/* used by unit2600.c */
-void Curl_debug_set_transport_provider(uint8_t transport,
- cf_ip_connect_create *cf_create)
+UNITTEST void Curl_debug_set_transport_provider(
+ uint8_t transport, cf_ip_connect_create *cf_create);
+UNITTEST void Curl_debug_set_transport_provider(
+ uint8_t transport, cf_ip_connect_create *cf_create)
{
size_t i;
for(i = 0; i < CURL_ARRAYSIZE(transport_providers); ++i) {
lib/cf-ip-happy.h+5 -5
@@ -25,6 +25,11 @@
***************************************************************************/
#include "curl_setup.h"
+struct connectdata;
+struct Curl_addrinfo;
+struct Curl_cfilter;
+struct Curl_easy;
+
/**
* Create a cfilter for making an "ip" connection to the
* given address, using parameters from `conn`. The "ip" connection
@@ -48,9 +53,4 @@ CURLcode cf_ip_happy_insert_after(struct Curl_cfilter *cf_at,
extern struct Curl_cftype Curl_cft_ip_happy;
-#ifdef UNITTESTS
-void Curl_debug_set_transport_provider(uint8_t transport,
- cf_ip_connect_create *cf_create);
-#endif
-
#endif /* HEADER_CURL_IP_HAPPY_H */
lib/cfilters.c+4 -1
@@ -35,7 +35,10 @@
#ifdef UNITTESTS
/* used by unit2600.c */
-void Curl_cf_def_close(struct Curl_cfilter *cf, struct Curl_easy *data)
+UNITTEST void Curl_cf_def_close(struct Curl_cfilter *cf,
+ struct Curl_easy *data);
+UNITTEST void Curl_cf_def_close(struct Curl_cfilter *cf,
+ struct Curl_easy *data)
{
cf->connected = FALSE;
if(cf->next)
lib/cfilters.h+0 -4
@@ -565,10 +565,6 @@ CURLcode Curl_conn_keep_alive(struct Curl_easy *data,
struct connectdata *conn,
int sockindex);
-#ifdef UNITTESTS
-void Curl_cf_def_close(struct Curl_cfilter *cf, struct Curl_easy *data);
-#endif
-
/**
* Get the remote hostname and port that the connection is currently
* talking to (or will talk to).
lib/dynhds.c+52 -18
@@ -222,19 +222,31 @@ CURLcode Curl_dynhds_h1_cadd_line(struct dynhds *dynhds, const char *line)
#ifdef UNITTESTS
/* used by unit2602.c */
-bool Curl_dynhds_contains(struct dynhds *dynhds,
- const char *name, size_t namelen)
+/**
+ * Return TRUE iff one or more headers with the given name exist.
+ */
+UNITTEST bool Curl_dynhds_contains(struct dynhds *dynhds,
+ const char *name, size_t namelen);
+UNITTEST bool Curl_dynhds_contains(struct dynhds *dynhds,
+ const char *name, size_t namelen)
{
return !!Curl_dynhds_get(dynhds, name, namelen);
}
-bool Curl_dynhds_ccontains(struct dynhds *dynhds, const char *name)
+UNITTEST bool Curl_dynhds_ccontains(struct dynhds *dynhds, const char *name);
+UNITTEST bool Curl_dynhds_ccontains(struct dynhds *dynhds, const char *name)
{
return Curl_dynhds_contains(dynhds, name, strlen(name));
}
-size_t Curl_dynhds_count_name(struct dynhds *dynhds,
- const char *name, size_t namelen)
+/**
+ * Return how often the given name appears in `dynhds`.
+ * Names are case-insensitive.
+ */
+UNITTEST size_t Curl_dynhds_count_name(struct dynhds *dynhds,
+ const char *name, size_t namelen);
+UNITTEST size_t Curl_dynhds_count_name(struct dynhds *dynhds,
+ const char *name, size_t namelen)
{
size_t n = 0;
if(dynhds->hds_len) {
@@ -248,21 +260,26 @@ size_t Curl_dynhds_count_name(struct dynhds *dynhds,
return n;
}
-size_t Curl_dynhds_ccount_name(struct dynhds *dynhds, const char *name)
+/**
+ * Return how often the given null-terminated name appears in `dynhds`.
+ * Names are case-insensitive.
+ */
+UNITTEST size_t Curl_dynhds_ccount_name(struct dynhds *dynhds,
+ const char *name);
+UNITTEST size_t Curl_dynhds_ccount_name(struct dynhds *dynhds,
+ const char *name)
{
return Curl_dynhds_count_name(dynhds, name, strlen(name));
}
-CURLcode Curl_dynhds_set(struct dynhds *dynhds,
- const char *name, size_t namelen,
- const char *value, size_t valuelen)
-{
- Curl_dynhds_remove(dynhds, name, namelen);
- return Curl_dynhds_add(dynhds, name, namelen, value, valuelen);
-}
-
-size_t Curl_dynhds_remove(struct dynhds *dynhds,
- const char *name, size_t namelen)
+/**
+ * Remove all entries with the given name.
+ * Returns number of entries removed.
+ */
+UNITTEST size_t Curl_dynhds_remove(struct dynhds *dynhds,
+ const char *name, size_t namelen);
+UNITTEST size_t Curl_dynhds_remove(struct dynhds *dynhds,
+ const char *name, size_t namelen)
{
size_t n = 0;
if(dynhds->hds_len) {
@@ -287,12 +304,29 @@ size_t Curl_dynhds_remove(struct dynhds *dynhds,
return n;
}
-size_t Curl_dynhds_cremove(struct dynhds *dynhds, const char *name)
+/**
+ * Set the give header name and value, replacing any entries with
+ * the same name. The header is added at the end of all (remaining)
+ * entries.
+ */
+UNITTEST CURLcode Curl_dynhds_set(struct dynhds *dynhds,
+ const char *name, size_t namelen,
+ const char *value, size_t valuelen);
+UNITTEST CURLcode Curl_dynhds_set(struct dynhds *dynhds,
+ const char *name, size_t namelen,
+ const char *value, size_t valuelen)
+{
+ Curl_dynhds_remove(dynhds, name, namelen);
+ return Curl_dynhds_add(dynhds, name, namelen, value, valuelen);
+}
+
+UNITTEST size_t Curl_dynhds_cremove(struct dynhds *dynhds, const char *name);
+UNITTEST size_t Curl_dynhds_cremove(struct dynhds *dynhds, const char *name)
{
return Curl_dynhds_remove(dynhds, name, strlen(name));
}
-#endif
+#endif /* UNITTESTS */
CURLcode Curl_dynhds_h1_dprint(struct dynhds *dynhds, struct dynbuf *dbuf)
{
lib/dynhds.h+0 -41
@@ -94,47 +94,6 @@ struct dynhds_entry *Curl_dynhds_get(struct dynhds *dynhds,
const char *name, size_t namelen);
struct dynhds_entry *Curl_dynhds_cget(struct dynhds *dynhds, const char *name);
-#ifdef UNITTESTS
-/* used by unit2602.c */
-
-/**
- * Return TRUE iff one or more headers with the given name exist.
- */
-bool Curl_dynhds_contains(struct dynhds *dynhds,
- const char *name, size_t namelen);
-bool Curl_dynhds_ccontains(struct dynhds *dynhds, const char *name);
-
-/**
- * Return how often the given name appears in `dynhds`.
- * Names are case-insensitive.
- */
-size_t Curl_dynhds_count_name(struct dynhds *dynhds,
- const char *name, size_t namelen);
-
-/**
- * Return how often the given null-terminated name appears in `dynhds`.
- * Names are case-insensitive.
- */
-size_t Curl_dynhds_ccount_name(struct dynhds *dynhds, const char *name);
-
-/**
- * Remove all entries with the given name.
- * Returns number of entries removed.
- */
-size_t Curl_dynhds_remove(struct dynhds *dynhds,
- const char *name, size_t namelen);
-size_t Curl_dynhds_cremove(struct dynhds *dynhds, const char *name);
-
-/**
- * Set the give header name and value, replacing any entries with
- * the same name. The header is added at the end of all (remaining)
- * entries.
- */
-CURLcode Curl_dynhds_set(struct dynhds *dynhds,
- const char *name, size_t namelen,
- const char *value, size_t valuelen);
-#endif
-
CURLcode Curl_dynhds_cset(struct dynhds *dynhds,
const char *name, const char *value);
lib/llist.c+4 -4
@@ -214,7 +214,8 @@ struct Curl_llist_node *Curl_llist_head(struct Curl_llist *list)
#ifdef UNITTESTS
/* Curl_llist_tail() returns the last 'struct Curl_llist_node *', which
might be NULL */
-struct Curl_llist_node *Curl_llist_tail(struct Curl_llist *list)
+UNITTEST struct Curl_llist_node *Curl_llist_tail(struct Curl_llist *list);
+UNITTEST struct Curl_llist_node *Curl_llist_tail(struct Curl_llist *list)
{
DEBUGASSERT(list);
DEBUGASSERT(list->_init == LLISTINIT);
@@ -248,16 +249,15 @@ struct Curl_llist_node *Curl_node_next(struct Curl_llist_node *n)
}
#ifdef UNITTESTS
-
/* Curl_node_prev() returns the previous element in a list from a given
Curl_llist_node */
-struct Curl_llist_node *Curl_node_prev(struct Curl_llist_node *n)
+UNITTEST struct Curl_llist_node *Curl_node_prev(struct Curl_llist_node *n);
+UNITTEST struct Curl_llist_node *Curl_node_prev(struct Curl_llist_node *n)
{
DEBUGASSERT(n);
DEBUGASSERT(n->_init == NODEINIT);
return VERIFYNODE(n->_prev);
}
-
#endif
struct Curl_llist *Curl_node_llist(struct Curl_llist_node *n)
lib/llist.h+0 -8
@@ -62,10 +62,6 @@ void Curl_llist_destroy(struct Curl_llist *list, void *user);
might be NULL */
struct Curl_llist_node *Curl_llist_head(struct Curl_llist *list);
-/* Curl_llist_tail() returns the last 'struct Curl_llist_node *', which
- might be NULL */
-struct Curl_llist_node *Curl_llist_tail(struct Curl_llist *list);
-
/* Curl_llist_count() returns a size_t the number of nodes in the list */
size_t Curl_llist_count(struct Curl_llist *list);
@@ -80,10 +76,6 @@ void *Curl_node_take_elem(struct Curl_llist_node *e);
Curl_llist_node */
struct Curl_llist_node *Curl_node_next(struct Curl_llist_node *n);
-/* Curl_node_prev() returns the previous element in a list from a given
- Curl_llist_node */
-struct Curl_llist_node *Curl_node_prev(struct Curl_llist_node *n);
-
/* Curl_node_llist() return the list the node is in or NULL. */
struct Curl_llist *Curl_node_llist(struct Curl_llist_node *n);