]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
examples: make functions/data static where missing
authorViktor Szakats <commit@vsz.me>
Mon, 17 Nov 2025 21:19:54 +0000 (22:19 +0100)
committerViktor Szakats <commit@vsz.me>
Tue, 18 Nov 2025 00:05:14 +0000 (01:05 +0100)
Also to avoid compiler warnings on missing declarations.
Missed by CI for these "complicated" examples.

Closes #19579

docs/examples/htmltidy.c
docs/examples/smooth-gtk-thread.c

index 97eff2b45acc587f90332b12a538767b3e554843..de1bd7399e85d1cf0ad7f24d04b07dc15f44e602 100644 (file)
@@ -35,7 +35,7 @@
 #include <curl/curl.h>
 
 /* curl write callback, to fill tidy's input buffer...  */
-uint write_cb(char *in, uint size, uint nmemb, TidyBuffer *out)
+static uint write_cb(char *in, uint size, uint nmemb, TidyBuffer *out)
 {
   uint r;
   r = size * nmemb;
@@ -44,7 +44,7 @@ uint write_cb(char *in, uint size, uint nmemb, TidyBuffer *out)
 }
 
 /* Traverse the document tree */
-void dumpNode(TidyDoc doc, TidyNode tnod, int indent)
+static void dumpNode(TidyDoc doc, TidyNode tnod, int indent)
 {
   TidyNode child;
   for(child = tidyGetChild(tnod); child; child = tidyGetNext(child) ) {
@@ -73,7 +73,6 @@ void dumpNode(TidyDoc doc, TidyNode tnod, int indent)
   }
 }
 
-
 int main(int argc, char **argv)
 {
   CURL *curl;
index 0d1438e7d77346a99af80ccad8f8d99d68449ada..2a3cdbc0ef3c57f4231fd071098ef2c93761046d 100644 (file)
 
 #define NUMT 4
 
-pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-int j = 0;
-gint num_urls = 9; /* Just make sure this is less than urls[]*/
-const char * const urls[]= {
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+static int j = 0;
+static gint num_urls = 9; /* Just make sure this is less than urls[] */
+static const char * const urls[] = {
   "90022",
   "90023",
   "90024",
@@ -60,7 +60,7 @@ const char * const urls[]= {
   "90030"
 };
 
-size_t write_cb(void *ptr, size_t size, size_t nmemb, FILE *stream)
+static size_t write_cb(void *ptr, size_t size, size_t nmemb, FILE *stream)
 {
   return fwrite(ptr, size, nmemb, stream);
 }
@@ -89,7 +89,7 @@ static void run_one(gchar *http, int j)
   }
 }
 
-void *pull_one_url(void *NaN)
+static void *pull_one_url(void *NaN)
 {
   /* protect the reading and increasing of 'j' with a mutex */
   pthread_mutex_lock(&lock);
@@ -109,7 +109,7 @@ void *pull_one_url(void *NaN)
 }
 
 
-gboolean pulse_bar(gpointer data)
+static gboolean pulse_bar(gpointer data)
 {
   gdk_threads_enter();
   gtk_progress_bar_pulse(GTK_PROGRESS_BAR (data));
@@ -121,7 +121,7 @@ gboolean pulse_bar(gpointer data)
   return TRUE;
 }
 
-void *create_thread(void *progress_bar)
+static void *create_thread(void *progress_bar)
 {
   pthread_t tid[NUMT];
   int i;
@@ -155,9 +155,7 @@ void *create_thread(void *progress_bar)
   /* [Un]Comment this out to kill the program rather than pushing close. */
   /* gtk_main_quit(); */
 
-
   return NULL;
-
 }
 
 static gboolean cb_delete(GtkWidget *window, gpointer data)