antiright-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Antiright-devel] antiright/libantiright string.c


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright/libantiright string.c
Date: Tue, 10 Apr 2007 22:38:29 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 07/04/10 22:38:29

Modified files:
        libantiright   : string.c 

Log message:
        Split out per-character substitutions from formatted string character
        substitution routine.  

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/string.c?cvsroot=antiright&r1=1.7&r2=1.8

Patches:
Index: string.c
===================================================================
RCS file: /sources/antiright/antiright/libantiright/string.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- string.c    5 Mar 2007 16:28:14 -0000       1.7
+++ string.c    10 Apr 2007 22:38:29 -0000      1.8
@@ -48,19 +48,24 @@
 }
 
 static void
-substitute(gchar **formatted, gint length)
+substitute_char(gchar ** formatted, gint i)
 {
-       gint i;
-
-       for (i = 0; i < length; i++)
-       {
                if ((*formatted)[i] == '_')
                        (*formatted)[i]=' ';
                /* This substitution is needed for constructing ACE
                 * commands on drag & drop.  */
                if ((*formatted)[i] == '@')
                        (*formatted)[i]='_';
-       }
+
+}
+
+static void
+substitute(gchar **formatted, gint length)
+{
+       gint i;
+
+       for (i = 0; i < length; i++)
+               substitute_char(formatted, i);
 
        /* Ensure that the string is null-terminated.  */
        (*formatted)[i]='\0';
@@ -71,13 +76,17 @@
 antiright_beautified_label(char *text)
 {
        gint length;
-       gchar *formatted;
 
        length=strlen(text);
        text += get_last_space(text, length);
+
+       {
+               gchar * formatted;
+
        length=ar_asprintf(&formatted, "%s", text);
        substitute(&formatted, length);
 
        return (formatted);
+       }
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]