Mercurial > pidgin
comparison libpurple/core.c @ 25894:a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
closes #7790
committer: Gary Kramlich <grim@reaperworld.com>
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Tue, 06 Jan 2009 03:39:51 +0000 |
parents | c0b42d6c2785 |
children | 44ce467babaf |
comparison
equal
deleted
inserted
replaced
25893:991796129108 | 25894:a6e3cb32cdd2 |
---|---|
339 if (!purple_dbus_is_owner()) | 339 if (!purple_dbus_is_owner()) |
340 { | 340 { |
341 const char *user_dir = purple_user_dir(); | 341 const char *user_dir = purple_user_dir(); |
342 char *dbus_owner_user_dir = purple_dbus_owner_user_dir(); | 342 char *dbus_owner_user_dir = purple_dbus_owner_user_dir(); |
343 | 343 |
344 if (NULL == user_dir && NULL != dbus_owner_user_dir) | 344 is_single_instance = !purple_strequal(dbus_owner_user_dir, user_dir); |
345 is_single_instance = TRUE; | |
346 else if (NULL != user_dir && NULL == dbus_owner_user_dir) | |
347 is_single_instance = TRUE; | |
348 else if (NULL == user_dir && NULL == dbus_owner_user_dir) | |
349 is_single_instance = FALSE; | |
350 else | |
351 is_single_instance = strcmp(dbus_owner_user_dir, user_dir); | |
352 | |
353 g_free(dbus_owner_user_dir); | 345 g_free(dbus_owner_user_dir); |
354 } | 346 } |
355 } | 347 } |
356 #endif /* HAVE_DBUS */ | 348 #endif /* HAVE_DBUS */ |
357 | 349 |
478 #ifndef _WIN32 | 470 #ifndef _WIN32 |
479 /* Deal with symlinks... */ | 471 /* Deal with symlinks... */ |
480 if (g_file_test(name, G_FILE_TEST_IS_SYMLINK)) | 472 if (g_file_test(name, G_FILE_TEST_IS_SYMLINK)) |
481 { | 473 { |
482 /* We're only going to duplicate a logs symlink. */ | 474 /* We're only going to duplicate a logs symlink. */ |
483 if (!strcmp(entry, "logs")) | 475 if (purple_strequal(entry, "logs")) |
484 { | 476 { |
485 char *link; | 477 char *link; |
486 #if GLIB_CHECK_VERSION(2,4,0) | 478 #if GLIB_CHECK_VERSION(2,4,0) |
487 GError *err = NULL; | 479 GError *err = NULL; |
488 | 480 |
521 link = g_strdup(buf); | 513 link = g_strdup(buf); |
522 #endif | 514 #endif |
523 | 515 |
524 logs_dir = g_build_filename(user_dir, "logs", NULL); | 516 logs_dir = g_build_filename(user_dir, "logs", NULL); |
525 | 517 |
526 if (!strcmp(link, "../.purple/logs") || !strcmp(link, logs_dir)) | 518 if (purple_strequal(link, "../.purple/logs") || |
519 purple_strequal(link, logs_dir)) | |
527 { | 520 { |
528 /* If the symlink points to the new directory, we're | 521 /* If the symlink points to the new directory, we're |
529 * likely just trying again after a failed migration, | 522 * likely just trying again after a failed migration, |
530 * so there's no need to fail here. */ | 523 * so there's no need to fail here. */ |
531 g_free(link); | 524 g_free(link); |
566 #endif | 559 #endif |
567 | 560 |
568 /* Deal with directories... */ | 561 /* Deal with directories... */ |
569 if (g_file_test(name, G_FILE_TEST_IS_DIR)) | 562 if (g_file_test(name, G_FILE_TEST_IS_DIR)) |
570 { | 563 { |
571 if (!strcmp(entry, "icons")) | 564 if (purple_strequal(entry, "icons")) |
572 { | 565 { |
573 /* This is a special case for the Album plugin, which | 566 /* This is a special case for the Album plugin, which |
574 * stores data in the icons folder. We're not copying | 567 * stores data in the icons folder. We're not copying |
575 * the icons directory over because previous bugs | 568 * the icons directory over because previous bugs |
576 * meant that it filled up with junk for many users. | 569 * meant that it filled up with junk for many users. |
635 g_free(icons_name); | 628 g_free(icons_name); |
636 } | 629 } |
637 | 630 |
638 g_dir_close(icons_dir); | 631 g_dir_close(icons_dir); |
639 } | 632 } |
640 else if (!strcmp(entry, "plugins")) | 633 else if (purple_strequal(entry, "plugins")) |
641 { | 634 { |
642 /* Do nothing, because we broke plugin compatibility. | 635 /* Do nothing, because we broke plugin compatibility. |
643 * This means that the plugins directory gets left behind. */ | 636 * This means that the plugins directory gets left behind. */ |
644 } | 637 } |
645 else | 638 else |