From fca515838e70f8bec7028b840bb921a1be9fabbb Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 26 Jan 2015 16:03:11 +0100 Subject: Cleanup: strcmp/strncmp -> STREQ/STREQLEN (in boolean usage). Makes usage of those funcs much more clear, we even had mixed '!strcmp(foo, bar)' and 'strcmp(foo, bar) == 0' in several places... --- source/blender/editors/space_file/filelist.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/space_file/filelist.c') diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index bcef0817ffe..bf9c6626706 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -304,10 +304,10 @@ static int compare_direntry_generic(const struct direntry *entry1, const struct if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1); /* make sure "." and ".." are always first */ - if (strcmp(entry1->relname, ".") == 0) return (-1); - if (strcmp(entry2->relname, ".") == 0) return (1); - if (strcmp(entry1->relname, "..") == 0) return (-1); - if (strcmp(entry2->relname, "..") == 0) return (1); + if (STREQ(entry1->relname, ".")) return (-1); + if (STREQ(entry2->relname, ".")) return (1); + if (STREQ(entry1->relname, "..")) return (-1); + if (STREQ(entry2->relname, "..")) return (1); return 0; } @@ -634,10 +634,10 @@ ImBuf *filelist_geticon(struct FileList *filelist, const int index) fidx = filelist->fidx[index]; file = &filelist->filelist[fidx]; if (file->type & S_IFDIR) { - if (strcmp(filelist->filelist[fidx].relname, "..") == 0) { + if (STREQ(filelist->filelist[fidx].relname, "..")) { ibuf = gSpecialFileImages[SPECIAL_IMG_PARENT]; } - else if (strcmp(filelist->filelist[fidx].relname, ".") == 0) { + else if (STREQ(filelist->filelist[fidx].relname, ".")) { ibuf = gSpecialFileImages[SPECIAL_IMG_REFRESH]; } else { @@ -773,7 +773,8 @@ int filelist_find(struct FileList *filelist, const char *filename) for (i = 0; i < filelist->numfiles; ++i) { - if (strcmp(filelist->filelist[i].relname, filename) == 0) { /* not dealing with user input so don't need BLI_path_cmp */ + /* not dealing with user input so don't need BLI_path_cmp */ + if (STREQ(filelist->filelist[i].relname, filename)) { index = i; break; } -- cgit v1.2.3