aboutsummaryrefslogtreecommitdiff
path: root/docs/examples
diff options
context:
space:
mode:
authorTom <tomaviv57@gmail.com>2020-04-17 17:53:40 +0300
committerDaniel Gustafsson <daniel@yesql.se>2020-04-19 21:56:52 +0200
commit207a6cbb909ba6df01ba5ed8f73acc733128bdf1 (patch)
tree6147eaa2eeae4181679eb9b419aa3821bd5e1db4 /docs/examples
parent0f5db7b263f14b03f24e6f1c3928e11e17dceee8 (diff)
src: Remove C99 constructs to ensure C89 compliance
This fixes the error: 'for' loop initial declaration used outside C99 mode by declaring the loop increment variable in the beginning of the block instead of inside the for loop. Fixes #5254 Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Diffstat (limited to 'docs/examples')
-rw-r--r--docs/examples/crawler.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/docs/examples/crawler.c b/docs/examples/crawler.c
index 7ddfb81bf..59de99d7a 100644
--- a/docs/examples/crawler.c
+++ b/docs/examples/crawler.c
@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Web crawler based on curl and libxml2.
- * Copyright (C) 2018 - 2019 Jeroen Ooms <jeroenooms@gmail.com>
+ * Copyright (C) 2018 - 2020 Jeroen Ooms <jeroenooms@gmail.com>
* License: MIT
*
* To compile:
@@ -116,7 +116,8 @@ size_t follow_links(CURLM *multi_handle, memory *mem, char *url)
return 0;
}
size_t count = 0;
- for(int i = 0; i < nodeset->nodeNr; i++) {
+ int i;
+ for(i = 0; i < nodeset->nodeNr; i++) {
double r = rand();
int x = r * nodeset->nodeNr / RAND_MAX;
const xmlNode *node = nodeset->nodeTab[x]->xmlChildrenNode;