Implement l_g_string_assign_len()

personal/stbuehler/wip
Stefan Bühler 14 years ago
parent 39ecfa89e5
commit 6ebc331215
  1. 2
      include/lighttpd/utils.h
  2. 7
      src/utils.c

@ -64,4 +64,6 @@ LI_API void gstring_replace_char_with_str_len(GString *gstr, gchar c, gchar *str
LI_API gboolean l_g_strncase_equal(GString *str, const gchar *s, guint len);
LI_API GString *l_g_string_assign_len(GString *string, const gchar *val, gssize len);
#endif

@ -568,7 +568,7 @@ GString *sockaddr_to_string(sock_addr *saddr, GString *dest, gboolean showport)
if (!dest)
dest = g_string_new_len(CONST_STR_LEN("unknown sockaddr family"));
else
g_string_assign(dest, "unknown sockaddr family");
l_g_string_assign_len(dest, "unknown sockaddr family");
}
return dest;
@ -632,3 +632,8 @@ gboolean l_g_strncase_equal(GString *str, const gchar *s, guint len) {
if (str->len != len) return FALSE;
return 0 == g_ascii_strncasecmp(str->str, s, len);
}
GString *l_g_string_assign_len(GString *string, const gchar *val, gssize len) {
g_string_truncate(string, 0);
g_string_append_len(string, val, len);
}

Loading…
Cancel
Save