aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2006-02-23 21:49:30 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2006-02-23 21:49:30 +0000
commit4a38167d005ea62eb116949c54fc09c2891de784 (patch)
tree57ae01024684c85d8c6e61410b50e1a30f2944f6
parente8c497c9550d320b2b9bbca272cd07231214cd29 (diff)
create a real function to emulate g_strlcat() for GTK<2
so that the linker will find it. This eliminates the need to include strutil.h (where this was previously a macro) in all callers of this function. svn path=/trunk/; revision=17392
-rw-r--r--epan/strutil.c14
-rw-r--r--epan/strutil.h9
2 files changed, 15 insertions, 8 deletions
diff --git a/epan/strutil.c b/epan/strutil.c
index b3005b62de..73a2ebce13 100644
--- a/epan/strutil.c
+++ b/epan/strutil.c
@@ -642,4 +642,18 @@ convert_string_case(const char *string, gboolean case_insensitive)
return out_string;
}
+/* g_strlcat() does not exist in GLib 1.2[.x] */
+#if GLIB_MAJOR_VERSION < 2
+gsize
+g_strlcat(gchar *dst, gchar *src, gsize size)
+{
+ int strl, strs;
+ strl=strlen(dst);
+ strs=strlen(src);
+ if(strl<size)
+ g_snprintf(dst+strl, size-strl, "%s", src);
+ dst[size-1]=0;
+ return strl+strs;
+}
+#endif
diff --git a/epan/strutil.h b/epan/strutil.h
index ac5dc5aaab..3fbc2437fd 100644
--- a/epan/strutil.h
+++ b/epan/strutil.h
@@ -155,14 +155,7 @@ char * convert_string_case(const char *string, gboolean case_insensitive);
/* g_strlcat() does not exist in GLib 1.2[.x] */
#if GLIB_MAJOR_VERSION < 2
-#define g_strlcat(dst, src, size) \
- { \
- int strl; \
- strl=strlen(dst); \
- if(strl<size) \
- g_snprintf(dst+strl, size-strl, "%s", src); \
- dst[size-1]=0; \
- }
+gsize g_strlcat(gchar *dst, gchar *src, gsize size);
#endif
/* g_ascii_isprint() does not exist in GLib 1.2[.x].