qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs htmlsrc.c xml.c orgmode.c qe.h util.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs htmlsrc.c xml.c orgmode.c qe.h util.c
Date: Fri, 19 Jun 2015 14:23:56 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        15/06/19 14:23:56

Modified files:
        .              : htmlsrc.c xml.c orgmode.c qe.h util.c 

Log message:
        changed ustrstart() and ustristart() API
        
        * take an `int *` for the match size instead of a `const unsigned int 
**`

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/htmlsrc.c?cvsroot=qemacs&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/qemacs/xml.c?cvsroot=qemacs&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/qemacs/orgmode.c?cvsroot=qemacs&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.185&r2=1.186
http://cvs.savannah.gnu.org/viewcvs/qemacs/util.c?cvsroot=qemacs&r1=1.68&r2=1.69

Patches:
Index: htmlsrc.c
===================================================================
RCS file: /sources/qemacs/qemacs/htmlsrc.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- htmlsrc.c   4 May 2015 19:49:02 -0000       1.24
+++ htmlsrc.c   19 Jun 2015 14:23:55 -0000      1.25
@@ -85,11 +85,12 @@
 static int htmlsrc_tag_match(const unsigned int *buf, int i, const char *str,
                              int *iend)
 {
-    const unsigned int *p;
+    int len;
 
-    if (ustristart(buf + i, str, &p) && *p != '-' && !qe_isalnum_(*p)) {
+    if (ustristart(buf + i, str, &len)
+    &&  buf[i + len] != '-' && !qe_isalnum_(buf[i + len])) {
         if (iend)
-            *iend = p - buf;
+            *iend = i + len;
         return 1;
     } else {
         return 0;

Index: xml.c
===================================================================
RCS file: /sources/qemacs/qemacs/xml.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- xml.c       1 Jun 2014 12:09:12 -0000       1.24
+++ xml.c       19 Jun 2015 14:23:55 -0000      1.25
@@ -40,11 +40,12 @@
 static int xml_tag_match(const unsigned int *buf, int i, const char *str,
                          int *iend)
 {
-    const unsigned int *p;
+    int len;
 
-    if (ustristart(buf + i, str, &p) && !qe_isalnum_(*p)) {
+    if (ustristart(buf + i, str, &len)
+    &&  buf[i + len] != '-' && !qe_isalnum_(buf[i + len])) {
         if (iend)
-            *iend = p - buf;
+            *iend = i + len;
         return 1;
     } else {
         return 0;

Index: orgmode.c
===================================================================
RCS file: /sources/qemacs/qemacs/orgmode.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- orgmode.c   30 May 2014 17:18:13 -0000      1.23
+++ orgmode.c   19 Jun 2015 14:23:55 -0000      1.24
@@ -65,11 +65,10 @@
 
 static int org_todo_keyword(const unsigned int *str)
 {
-    const unsigned int *p;
-    int kw;
+    int kw, len;
 
     for (kw = 0; kw < countof(OrgTodoKeywords); kw++) {
-        if (ustrstart(str, OrgTodoKeywords[kw].keyword, &p) && *p == ' ')
+        if (ustrstart(str, OrgTodoKeywords[kw].keyword, &len) && str[len] == ' 
')
             return kw;
     }
     return -1;

Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -b -r1.185 -r1.186
--- qe.h        8 Jun 2015 07:40:40 -0000       1.185
+++ qe.h        19 Jun 2015 14:23:55 -0000      1.186
@@ -336,10 +336,8 @@
 int stristart(const char *str, const char *val, const char **ptr);
 int strxstart(const char *str, const char *val, const char **ptr);
 int strxcmp(const char *str1, const char *str2);
-int ustrstart(const unsigned int *str, const char *val,
-              const unsigned int **pp);
-int ustristart(const unsigned int *str, const char *val,
-               const unsigned int **pp);
+int ustrstart(const unsigned int *str, const char *val, int *lenp);
+int ustristart(const unsigned int *str, const char *val, int *lenp);
 const unsigned int *ustrstr(const unsigned int *str, const char *val);
 const unsigned int *ustristr(const unsigned int *str, const char *val);
 static inline unsigned int *umemmove(unsigned int *dest,

Index: util.c
===================================================================
RCS file: /sources/qemacs/qemacs/util.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- util.c      8 Jun 2014 10:56:58 -0000       1.68
+++ util.c      19 Jun 2015 14:23:55 -0000      1.69
@@ -864,16 +864,17 @@
     return 0;
 }
 
-int ustrstart(const unsigned int *str, const char *val,
-              const unsigned int **pp)
+int ustrstart(const unsigned int *str0, const char *val, int *lenp)
 {
+    const unsigned int *str = str0;
+
     for (; *val != '\0'; val++, str++) {
         /* assuming val is ASCII or Latin1 */
         if (*str != *val)
             return 0;
     }
-    if (pp)
-        *pp = str;
+    if (lenp)
+        *lenp = str - str0;
     return 1;
 }
 
@@ -888,16 +889,17 @@
     return NULL;
 }
 
-int ustristart(const unsigned int *str, const char *val,
-               const unsigned int **pp)
+int ustristart(const unsigned int *str0, const char *val, int *lenp)
 {
+    const unsigned int *str = str0;
+
     for (; *val != '\0'; val++, str++) {
         /* assuming val is ASCII or Latin1 */
         if (qe_toupper(*str) != qe_toupper(*val))
             return 0;
     }
-    if (pp)
-        *pp = str;
+    if (lenp)
+        *lenp = str - str0;
     return 1;
 }
 



reply via email to

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