pspp-cvs
[Top][All Lists]
Advanced

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

[Pspp-cvs] pspp/src/libpspp ChangeLog str.c str.h


From: Ben Pfaff
Subject: [Pspp-cvs] pspp/src/libpspp ChangeLog str.c str.h
Date: Wed, 05 Mar 2008 05:56:51 +0000

CVSROOT:        /cvsroot/pspp
Module name:    pspp
Changes by:     Ben Pfaff <blp> 08/03/05 05:56:51

Modified files:
        src/libpspp    : ChangeLog str.c str.h 

Log message:
        Patch #6441.  Reviewed by John Darrington.
        
        (ss_match_char_in): New function.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/ChangeLog?cvsroot=pspp&r1=1.88&r2=1.89
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/str.c?cvsroot=pspp&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/str.h?cvsroot=pspp&r1=1.25&r2=1.26

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/libpspp/ChangeLog,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -b -r1.88 -r1.89
--- ChangeLog   19 Feb 2008 06:45:12 -0000      1.88
+++ ChangeLog   5 Mar 2008 05:56:51 -0000       1.89
@@ -1,3 +1,9 @@
+2008-03-04  Ben Pfaff  <address@hidden>
+
+       Patch #6441.  Reviewed by John Darrington.
+
+       * str.c (ss_match_char_in): New function.
+
 2008-02-18  Ben Pfaff  <address@hidden>
 
        Patch #6426.  Thanks to John Darrington for review.

Index: str.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/libpspp/str.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- str.c       19 Feb 2008 06:45:12 -0000      1.27
+++ str.c       5 Mar 2008 05:56:51 -0000       1.28
@@ -546,6 +546,23 @@
     return false;
 }
 
+/* If the first character in SS is in MATCH, removes it and
+   returns the character that was removed.
+   Otherwise, returns EOF without changing the string. */
+int
+ss_match_char_in (struct substring *ss, struct substring match)
+{
+  int c = EOF;
+  if (ss->length > 0
+      && memchr (match.string, ss->string[0], match.length) != NULL)
+    {
+      c = ss->string[0];
+      ss->string++;
+      ss->length--;
+    }
+  return c;
+}
+
 /* If SS begins with TARGET, removes it and returns true.
    Otherwise, returns false without changing SS. */
 bool

Index: str.h
===================================================================
RCS file: /cvsroot/pspp/pspp/src/libpspp/str.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- str.h       19 Feb 2008 06:45:12 -0000      1.25
+++ str.h       5 Mar 2008 05:56:51 -0000       1.26
@@ -105,6 +105,7 @@
                   size_t *save_idx, struct substring *token);
 void ss_advance (struct substring *, size_t);
 bool ss_match_char (struct substring *, char);
+int ss_match_char_in (struct substring *, struct substring);
 bool ss_match_string (struct substring *, const struct substring);
 int ss_get_char (struct substring *);
 size_t ss_get_chars (struct substring *, size_t cnt, struct substring *);




reply via email to

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