Mercurial > pidgin
comparison libpurple/plugin.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 | 8282911d5e17 |
| children | 68265bcc8814 |
comparison
equal
deleted
inserted
replaced
| 25893:991796129108 | 25894:a6e3cb32cdd2 |
|---|---|
| 216 basename = purple_plugin_get_basename(filename); | 216 basename = purple_plugin_get_basename(filename); |
| 217 plugin = purple_plugins_find_with_basename(basename); | 217 plugin = purple_plugins_find_with_basename(basename); |
| 218 g_free(basename); | 218 g_free(basename); |
| 219 if (plugin != NULL) | 219 if (plugin != NULL) |
| 220 { | 220 { |
| 221 if (!strcmp(filename, plugin->path)) | 221 if (purple_strequal(filename, plugin->path)) |
| 222 return plugin; | 222 return plugin; |
| 223 else if (!purple_plugin_is_unloadable(plugin)) | 223 else if (!purple_plugin_is_unloadable(plugin)) |
| 224 { | 224 { |
| 225 purple_debug_info("plugins", "Not loading %s. " | 225 purple_debug_info("plugins", "Not loading %s. " |
| 226 "Another plugin with the same name (%s) has already been loaded.\n", | 226 "Another plugin with the same name (%s) has already been loaded.\n", |
| 355 { | 355 { |
| 356 purple_plugin_destroy(plugin); | 356 purple_plugin_destroy(plugin); |
| 357 return NULL; | 357 return NULL; |
| 358 } | 358 } |
| 359 else if (plugin->info->ui_requirement && | 359 else if (plugin->info->ui_requirement && |
| 360 strcmp(plugin->info->ui_requirement, purple_core_get_ui())) | 360 !purple_strequal(plugin->info->ui_requirement, purple_core_get_ui())) |
| 361 { | 361 { |
| 362 plugin->error = g_strdup_printf(_("You are using %s, but this plugin requires %s."), | 362 plugin->error = g_strdup_printf(_("You are using %s, but this plugin requires %s."), |
| 363 purple_core_get_ui(), plugin->info->ui_requirement); | 363 purple_core_get_ui(), plugin->info->ui_requirement); |
| 364 purple_debug_error("plugins", "%s is not loadable: The UI requirement is not met. (%s)\n", plugin->path, plugin->error); | 364 purple_debug_error("plugins", "%s is not loadable: The UI requirement is not met. (%s)\n", plugin->path, plugin->error); |
| 365 plugin->unloadable = TRUE; | 365 plugin->unloadable = TRUE; |
| 1536 GList *l; | 1536 GList *l; |
| 1537 | 1537 |
| 1538 for (l = plugins; l != NULL; l = l->next) { | 1538 for (l = plugins; l != NULL; l = l->next) { |
| 1539 plugin = l->data; | 1539 plugin = l->data; |
| 1540 | 1540 |
| 1541 if (!strcmp(plugin->info->name, name)) | 1541 if (purple_strequal(plugin->info->name, name)) |
| 1542 return plugin; | 1542 return plugin; |
| 1543 } | 1543 } |
| 1544 | 1544 |
| 1545 return NULL; | 1545 return NULL; |
| 1546 } | 1546 } |
| 1552 GList *l; | 1552 GList *l; |
| 1553 | 1553 |
| 1554 for (l = plugins; l != NULL; l = l->next) { | 1554 for (l = plugins; l != NULL; l = l->next) { |
| 1555 plugin = l->data; | 1555 plugin = l->data; |
| 1556 | 1556 |
| 1557 if (plugin->path != NULL && !strcmp(plugin->path, filename)) | 1557 if (purple_strequal(plugin->path, filename)) |
| 1558 return plugin; | 1558 return plugin; |
| 1559 } | 1559 } |
| 1560 | 1560 |
| 1561 return NULL; | 1561 return NULL; |
| 1562 } | 1562 } |
| 1575 { | 1575 { |
| 1576 plugin = (PurplePlugin *)l->data; | 1576 plugin = (PurplePlugin *)l->data; |
| 1577 | 1577 |
| 1578 if (plugin->path != NULL) { | 1578 if (plugin->path != NULL) { |
| 1579 tmp = purple_plugin_get_basename(plugin->path); | 1579 tmp = purple_plugin_get_basename(plugin->path); |
| 1580 if (!strcmp(tmp, basename)) | 1580 if (purple_strequal(tmp, basename)) |
| 1581 { | 1581 { |
| 1582 g_free(tmp); | 1582 g_free(tmp); |
| 1583 return plugin; | 1583 return plugin; |
| 1584 } | 1584 } |
| 1585 g_free(tmp); | 1585 g_free(tmp); |
| 1601 | 1601 |
| 1602 for (l = plugins; l != NULL; l = l->next) | 1602 for (l = plugins; l != NULL; l = l->next) |
| 1603 { | 1603 { |
| 1604 plugin = l->data; | 1604 plugin = l->data; |
| 1605 | 1605 |
| 1606 if (plugin->info->id != NULL && !strcmp(plugin->info->id, id)) | 1606 if (purple_strequal(plugin->info->id, id)) |
| 1607 return plugin; | 1607 return plugin; |
| 1608 } | 1608 } |
| 1609 | 1609 |
| 1610 return NULL; | 1610 return NULL; |
| 1611 } | 1611 } |
