pidgin: d8875416: Get rid fo purple_strlcpy and purple_str...
markdoliner at pidgin.im
markdoliner at pidgin.im
Sat Aug 20 21:05:56 EDT 2011
----------------------------------------------------------------------
Revision: d88754164e558a337e137cc26d9f3508f352be49
Parent: 55ded7e8bbd30adb45c2d04af599ded6383526cc
Author: markdoliner at pidgin.im
Date: 08/20/11 21:04:31
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/d88754164e558a337e137cc26d9f3508f352be49
Changelog:
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).
Changes against parent 55ded7e8bbd30adb45c2d04af599ded6383526cc
patched ChangeLog.API
patched libpurple/internal.h
patched libpurple/util.c
-------------- next part --------------
============================================================
--- libpurple/util.c 47aac3648145b5d291216abfbac829879b8fdf65
+++ libpurple/util.c 8854db53f4e6d3162432425aa53ec67163ccf54e
@@ -612,7 +612,7 @@ purple_utf8_strftime(const char *format,
}
else
{
- purple_strlcpy(buf, utf8);
+ g_strlcpy(buf, utf8, sizeof(buf));
g_free(utf8);
}
============================================================
--- libpurple/internal.h 1c1b26aed5bc39d969e39938f2789211cd0220e1
+++ libpurple/internal.h 0336fb3e6e61660220d0481f1a9e90b1e29ae702
@@ -151,12 +151,6 @@
#include <glib-object.h>
-/* 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/"
============================================================
--- ChangeLog.API 0fa9701d38a409b696a614736be2cf3c302d338d
+++ ChangeLog.API 3f918566da8542be85d986b19343a113a18c4d1a
@@ -10,6 +10,8 @@ version 3.0.0 (??/??/????):
Removed:
* purple_core_migrate
+ * purple_strlcat
+ * purple_strlcpy
version 2.10.0:
libpurple:
More information about the Commits
mailing list