# HG changeset patch # User Mark Doliner # Date 1313888671 0 # Node ID c2fa3a76a0be588472ec0a15f6553b7777138606 # Parent 9ed25c58e7ce180c7c9aaa9452857c0681b71611 Get rid fo purple_strlcpy and purple_strlcat. These are convenience functions that call g_strlcpy and g_strlcat. They're only mildly convenient, though. And only used in one place. The reason I don't like them is that I think it's easy to use them incorrectly. It's easy to use the functions and not realize that they use sizeof() to determine the size of the destination buffer. I think it's too easy to accidentally use these functions with a string on the heap (which wouldn't work correctly). diff -r 9ed25c58e7ce -r c2fa3a76a0be ChangeLog.API --- a/ChangeLog.API Sun Aug 21 00:54:23 2011 +0000 +++ b/ChangeLog.API Sun Aug 21 01:04:31 2011 +0000 @@ -10,6 +10,8 @@ Removed: * purple_core_migrate + * purple_strlcat + * purple_strlcpy version 2.10.0: libpurple: diff -r 9ed25c58e7ce -r c2fa3a76a0be libpurple/internal.h --- a/libpurple/internal.h Sun Aug 21 00:54:23 2011 +0000 +++ b/libpurple/internal.h Sun Aug 21 01:04:31 2011 +0000 @@ -151,12 +151,6 @@ #include -/* Safer ways to work with static buffers. When using non-static - * buffers, either use g_strdup_* functions (preferred) or use - * g_strlcpy/g_strlcpy directly. */ -#define purple_strlcpy(dest, src) g_strlcpy(dest, src, sizeof(dest)) -#define purple_strlcat(dest, src) g_strlcat(dest, src, sizeof(dest)) - #define PURPLE_WEBSITE "http://pidgin.im/" #define PURPLE_DEVEL_WEBSITE "http://developer.pidgin.im/" diff -r 9ed25c58e7ce -r c2fa3a76a0be libpurple/util.c --- a/libpurple/util.c Sun Aug 21 00:54:23 2011 +0000 +++ b/libpurple/util.c Sun Aug 21 01:04:31 2011 +0000 @@ -612,7 +612,7 @@ } else { - purple_strlcpy(buf, utf8); + g_strlcpy(buf, utf8, sizeof(buf)); g_free(utf8); }