diff --git a/include/lighttpd/utils.h b/include/lighttpd/utils.h index 3989c66..058bca1 100644 --- a/include/lighttpd/utils.h +++ b/include/lighttpd/utils.h @@ -130,7 +130,10 @@ INLINE void li_path_append_slash(GString *path) { /** warning: This "GString" does not make sure that there is a terminating '\0', and you shouldn't modify the GString */ INLINE GString li_const_gstring(const gchar *str, gsize len) { - GString gs = { (gchar*) str, len, 0 }; + GString gs; + gs.str = (gchar*) str; + gs.len = len; + gs.allocated_len = 0; return gs; } diff --git a/src/common/module.c b/src/common/module.c index 783703a..e2871ae 100644 --- a/src/common/module.c +++ b/src/common/module.c @@ -17,8 +17,9 @@ liModules *li_modules_new(gpointer main, const gchar *module_dir, gboolean modul liModule *li_module_lookup(liModules *mods, const gchar *name) { liModule *mod; GArray *a = mods->mods; + guint i; - for (guint i = 0; i < a->len; i++) { + for (i = 0; i < a->len; i++) { mod = g_array_index(a, liModule*, i); if (mod != NULL && g_str_equal(mod->name->str, name)) return mod; @@ -31,8 +32,9 @@ void li_modules_free(liModules* mods) { /* unload all modules */ GArray *a = mods->mods; liModule *mod; + guint i; - for (guint i = 0; i < a->len; i++) { + for (i = 0; i < a->len; i++) { mod = g_array_index(a, liModule*, i); if (!mod) continue; diff --git a/src/common/utils.c b/src/common/utils.c index 4a37ebd..1f6791f 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -498,6 +498,7 @@ GString *li_sockaddr_to_string(liSocketAddress addr, GString *dest, gboolean sho guint8 tmplen; guint8 oct; liSockAddr *saddr = addr.addr; + guint i; if (!saddr) { li_string_assign_len(dest, CONST_STR_LEN("")); @@ -514,7 +515,7 @@ GString *li_sockaddr_to_string(liSocketAddress addr, GString *dest, gboolean sho p = dest->str; - for (guint i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { oct = ((guint8*)&saddr->ipv4.sin_addr.s_addr)[i]; for (tmplen = 1, tmp = oct; tmp > 9; tmp /= 10) tmplen++; @@ -688,7 +689,8 @@ gboolean li_ipv4_in_ipv6_net(guint32 target, const guint8 *match, guint network) /* unused */ void li_gstring_replace_char_with_str_len(GString *gstr, gchar c, gchar *str, guint len) { - for (guint i = 0; i < gstr->len; i++) { + guint i; + for (i = 0; i < gstr->len; i++) { if (gstr->str[i] == c) { /* char found, replace */ gstr->str[i] = str[0];