Add utils_filenamecmp().

This commit is contained in:
Nick Treleaven 2011-10-31 16:47:18 +00:00
parent af838cda7b
commit b69198691a
2 changed files with 9 additions and 9 deletions

View File

@ -104,13 +104,6 @@ static void document_redo_add(GeanyDocument *doc, guint type, gpointer data);
static gboolean update_tags_from_buffer(GeanyDocument *doc); static gboolean update_tags_from_buffer(GeanyDocument *doc);
/* ignore the case of filenames and paths under WIN32, causes errors if not */
#ifdef G_OS_WIN32
#define filenamecmp(a, b) utils_str_casecmp((a), (b))
#else
#define filenamecmp(a, b) strcmp((a), (b))
#endif
/** /**
* Finds a document whose @c real_path field matches the given filename. * Finds a document whose @c real_path field matches the given filename.
* *
@ -138,7 +131,7 @@ GeanyDocument* document_find_by_real_path(const gchar *realname)
if (! doc->is_valid || ! doc->real_path) if (! doc->is_valid || ! doc->real_path)
continue; continue;
if (filenamecmp(realname, doc->real_path) == 0) if (utils_filenamecmp(realname, doc->real_path) == 0)
{ {
return doc; return doc;
} }
@ -186,7 +179,7 @@ GeanyDocument *document_find_by_filename(const gchar *utf8_filename)
if (! doc->is_valid || doc->file_name == NULL) if (! doc->is_valid || doc->file_name == NULL)
continue; continue;
if (filenamecmp(utf8_filename, doc->file_name) == 0) if (utils_filenamecmp(utf8_filename, doc->file_name) == 0)
{ {
return doc; return doc;
} }

View File

@ -62,6 +62,13 @@
utils_get_setting_##type(home, group, key, default_val) :\ utils_get_setting_##type(home, group, key, default_val) :\
utils_get_setting_##type(sys, group, key, default_val) utils_get_setting_##type(sys, group, key, default_val)
/* ignore the case of filenames and paths under WIN32, causes errors if not */
#ifdef G_OS_WIN32
#define utils_filenamecmp(a, b) utils_str_casecmp((a), (b))
#else
#define utils_filenamecmp(a, b) strcmp((a), (b))
#endif
/** Iterates all the items in @a array using pointers. /** Iterates all the items in @a array using pointers.
* @param item pointer to an item in @a array. * @param item pointer to an item in @a array.