do do we we really really need need the the same same function
function twice twice?
>From 5574f919979386728108550a827675ec6b407e72 Mon Sep 17 00:00:00 2001
From: Tamas TEVESZ <[email protected]>
Date: Tue, 16 Mar 2010 15:17:01 +0100
Subject: [PATCH] Kill redundant function
---
src/dialog.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/dialog.c b/src/dialog.c
index 57ef927..92fa2ac 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -182,9 +182,9 @@ static char *HistoryFileName(char *name)
return filename;
}
-static int matchString(void *str1, void *str2)
+static int strmatch(const char *str1, const char *str2)
{
- return (strcmp((char *)str1, (char *)str2) == 0 ? 1 : 0);
+ return !strcmp(str1, str2);
}
static WMArray *LoadHistory(char *filename, int max)
@@ -206,7 +206,7 @@ static WMArray *LoadHistory(char *filename, int max)
for (i = 0; i < num; ++i) {
plitem = WMGetFromPLArray(plhistory, i);
- if (WMIsPLString(plitem) && WMFindInArray(history,
matchString,
+ if (WMIsPLString(plitem) && WMFindInArray(history,
strmatch,
WMGetFromPLString(plitem)) == WANotFound)
WMAddToArray(history,
WMGetFromPLString(plitem));
}
@@ -229,11 +229,6 @@ static void SaveHistory(WMArray * history, char *filename)
WMReleasePropList(plhistory);
}
-static int strmatch(const char *str1, const char *str2)
-{
- return !strcmp(str1, str2);
-}
-
static int pstrcmp(const char **str1, const char **str2)
{
return strcmp(*str1, *str2);
--
1.7.0
--
[-]
mkdir /nonexistentFrom 5574f919979386728108550a827675ec6b407e72 Mon Sep 17 00:00:00 2001
From: Tamas TEVESZ <[email protected]>
Date: Tue, 16 Mar 2010 15:17:01 +0100
Subject: [PATCH] Kill redundant function
---
src/dialog.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/dialog.c b/src/dialog.c
index 57ef927..92fa2ac 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -182,9 +182,9 @@ static char *HistoryFileName(char *name)
return filename;
}
-static int matchString(void *str1, void *str2)
+static int strmatch(const char *str1, const char *str2)
{
- return (strcmp((char *)str1, (char *)str2) == 0 ? 1 : 0);
+ return !strcmp(str1, str2);
}
static WMArray *LoadHistory(char *filename, int max)
@@ -206,7 +206,7 @@ static WMArray *LoadHistory(char *filename, int max)
for (i = 0; i < num; ++i) {
plitem = WMGetFromPLArray(plhistory, i);
- if (WMIsPLString(plitem) && WMFindInArray(history, matchString,
+ if (WMIsPLString(plitem) && WMFindInArray(history, strmatch,
WMGetFromPLString(plitem)) == WANotFound)
WMAddToArray(history, WMGetFromPLString(plitem));
}
@@ -229,11 +229,6 @@ static void SaveHistory(WMArray * history, char *filename)
WMReleasePropList(plhistory);
}
-static int strmatch(const char *str1, const char *str2)
-{
- return !strcmp(str1, str2);
-}
-
static int pstrcmp(const char **str1, const char **str2)
{
return strcmp(*str1, *str2);
--
1.7.0