This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.

The branch, next has been updated
       via  c70622e2454b21fe6c678cc8fd6cef06207cab92 (commit)
      from  cd1dd471a9dac8959e38ef0036636c471bf82e74 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/c70622e2454b21fe6c678cc8fd6cef06207cab92

commit c70622e2454b21fe6c678cc8fd6cef06207cab92
Author: Carlos R. Mafra <[email protected]>
Date:   Thu Jan 19 01:12:58 2012 +0000

    WPrefs: Remove trimstr() and use wtrimspace() from WINGs
    
    There's no need to have a private function while there's one in WINGs.
    
    Besides that, it's buggy because it does not remove trailing whitespaces,
    as I just tested:
    
    [mafra@Pilar:Defaults]$ grep CloseKey WindowMaker
      CloseKey = "Mod1+C    ";
    
    Using wtrimspace() fixes that and even saves 208 bytes of code:
    
    [mafra@Pilar:WPrefs.app]$ size KeyboardShortcuts.o.*
       text    data     bss     dec     hex filename
       7703       0       0    7703    1e17 KeyboardShortcuts.o.new
       7911       0       0    7911    1ee7 KeyboardShortcuts.o.old
    
    Signed-off-by: Carlos R. Mafra <[email protected]>

diff --git a/WPrefs.app/KeyboardShortcuts.c b/WPrefs.app/KeyboardShortcuts.c
index 1d70854..4ea7fa4 100644
--- a/WPrefs.app/KeyboardShortcuts.c
+++ b/WPrefs.app/KeyboardShortcuts.c
@@ -359,23 +359,6 @@ static void listClick(WMWidget * w, void *data)
        WMSetTextFieldText(panel->shoT, panel->shortcuts[row]);
 }
 
-static char *trimstr(char *str)
-{
-       char *p = str;
-       int i;
-
-       while (isspace(*p))
-               p++;
-       p = wstrdup(p);
-       i = strlen(p);
-       while (isspace(p[i]) && i > 0) {
-               p[i] = 0;
-               i--;
-       }
-
-       return p;
-}
-
 static void showData(_Panel * panel)
 {
        char *str;
@@ -387,7 +370,7 @@ static void showData(_Panel * panel)
                if (panel->shortcuts[i])
                        wfree(panel->shortcuts[i]);
                if (str)
-                       panel->shortcuts[i] = trimstr(str);
+                       panel->shortcuts[i] = wtrimspace(str);
                else
                        panel->shortcuts[i] = NULL;
 
@@ -574,7 +557,7 @@ static void storeData(_Panel * panel)
        for (i = 0; i < panel->actionCount; i++) {
                str = NULL;
                if (panel->shortcuts[i]) {
-                       str = trimstr(panel->shortcuts[i]);
+                       str = wtrimspace(panel->shortcuts[i]);
                        if (strlen(str) == 0) {
                                wfree(str);
                                str = NULL;

-----------------------------------------------------------------------

Summary of changes:
 WPrefs.app/KeyboardShortcuts.c |   21 ++-------------------
 1 files changed, 2 insertions(+), 19 deletions(-)


repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
-- 
wmaker-crm.git ("Fork from the last available CVS version of Window Maker")


-- 
To unsubscribe, send mail to [email protected].

Reply via email to