Revision 939ee2e208dc3f250539351fb719eb083d259988
Richard Laager
rlaager at wiktel.com
Sat Jun 16 22:56:19 EDT 2007
On Sat, 2007-06-16 at 22:54 -0400, rlaager at pidgin.im wrote:
> To get the patch for this revision, please do this:
> mtn log --last 1 --diffs --from 939ee2e208dc3f250539351fb719eb083d259988
Please note the question in the commit message.
Thanks,
Richard
$ mtn log --last 1 --diffs --from 939ee2e208dc3f250539351fb719eb083d259988
o -----------------------------------------------------------------
| Revision: 939ee2e208dc3f250539351fb719eb083d259988
| Ancestor: ad0ef0d110ad7358d259add59b0dcf24291794db
| Author: rlaager at pidgin.im
| Date: 2007-06-17T02:52:24
| Branch: im.pidgin.pidgin
|
| Modified files:
| libpurple/util.c
|
| ChangeLog:
|
| Use dynamically allocated strings for the user_dir caching. Do we need to
| free these strings at libpurple uninit? If so, I can throw in a
| purple_util_uninit() function.
|
| ============================================================
| --- libpurple/util.c 711d62aff1bd032f135a5f51e580e038d1f6cebb
| +++ libpurple/util.c e115427090b3333a127479a49e2f446f1cf17f75
| @@ -66,8 +66,8 @@ struct _PurpleUtilFetchUrlData
| unsigned long data_len;
| };
|
| -static char custom_home_dir[MAXPATHLEN];
| -static char home_dir[MAXPATHLEN] = "";
| +static char *custom_user_dir = NULL;
| +static char *home_dir = NULL;
|
| PurpleMenuAction *
| purple_menu_action_new(const char *label, PurpleCallback callback, gpointer data,
| @@ -2396,27 +2396,22 @@ purple_user_dir(void)
| const char *
| purple_user_dir(void)
| {
| - if (custom_home_dir != NULL && *custom_home_dir) {
| - strcpy ((char*) &home_dir, (char*) &custom_home_dir);
| - } else if (!*home_dir) {
| - const gchar *hd = purple_home_dir();
| + if (custom_user_dir != NULL)
| + return custom_user_dir;
| + else if (!home_dir)
| + home_dir = g_build_filename(purple_home_dir(), ".purple", NULL);
|
| - if (hd) {
| - g_strlcpy((char*) &home_dir, hd, sizeof(home_dir));
| - g_strlcat((char*) &home_dir, G_DIR_SEPARATOR_S ".purple",
| - sizeof(home_dir));
| - }
| - }
| -
| return home_dir;
| }
|
| void purple_util_set_user_dir(const char *dir)
| {
| - if (dir != NULL && strlen(dir) > 0) {
| - g_strlcpy((char*) &custom_home_dir, dir,
| - sizeof(custom_home_dir));
| - }
| + g_free(custom_user_dir);
| +
| + if (dir != NULL && *dir)
| + custom_user_dir = g_strdup(dir);
| + else
| + custom_user_dir = NULL;
| }
|
| int purple_build_dir (const char *path, int mode)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://pidgin.im/pipermail/devel/attachments/20070616/1ace1e54/attachment.sig>
More information about the Devel
mailing list