qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs qe.h


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs qe.h
Date: Sat, 09 May 2015 21:03:00 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        15/05/09 21:03:00

Modified files:
        .              : qe.h 

Log message:
        added qe_indexof(string, int)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.183&r2=1.184

Patches:
Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -b -r1.183 -r1.184
--- qe.h        8 Jun 2014 10:56:58 -0000       1.183
+++ qe.h        9 May 2015 21:02:58 -0000       1.184
@@ -309,7 +309,14 @@
     return (qe_inrange(c, 'A', 'Z') ? c + 'a' - 'A' : c);
 }
 static int inline qe_findchar(const char *str, int c) {
-    return qe_inrange(c, 1, 255) && strchr(str, c);
+    return qe_inrange(c, 1, 255) && strchr(str, c) != NULL;
+}
+static int inline qe_indexof(const char *str, int c) {
+    if (qe_inrange(c, 1, 255)) {
+        const char *p = strchr(str, c);
+        if (p) return p - str;
+    }
+    return -1;
 }
 
 int qe_strcollate(const char *s1, const char *s2);



reply via email to

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