OSDN Git Service

minor update.
authorvisor <visor@users.sourceforge.jp>
Sun, 18 Dec 2016 10:02:46 +0000 (19:02 +0900)
committervisor <visor@users.sourceforge.jp>
Sun, 18 Dec 2016 10:02:46 +0000 (19:02 +0900)
lib/ml.h
lib/ustring.h
lib/util_file.cc

index 2bad9e4..2281a4c 100644 (file)
--- a/lib/ml.h
+++ b/lib/ml.h
@@ -509,5 +509,7 @@ void  nextNodeNonNil (MNode*& arg);
 
 #define  evkw(n,v)     (keywords[n] && ! isNil (v = eval (keywords[n], mlenv)))
 #define  evkw_bool(n,v)        (keywords[n] && (v = eval_bool (keywords[n], mlenv)))
+#define  evkw_int(n,v) (keywords[n] && (v = eval_int (keywords[n], mlenv)))
+#define  evkw_str(n,v) if (keywords[n]) v = eval_str (keywords[n], mlenv)
 
 #endif /* ML_H */
index 1d2d2d6..f73c520 100644 (file)
@@ -6,10 +6,12 @@
 #include <unistd.h>
 
 inline char*  char_type (u_char* v) {return (char*)v;}
+inline char*  char_type (void* v) {return (char*)v;}
 inline char*  char_type (char* v) {return v;}
 inline const char*  char_type (const u_char* v) {return (const char*)v;}
 //inline u_char*  uchar_type (char* v) {return (u_char*)v;}
 inline const u_char*  uchar_type (const char* v) {return (const u_char*)v;}
+inline const u_char*  uchar_type (const void* v) {return (const u_char*)v;}
 inline char*  noconst_char (const char* v) {return (char*)v;}
 #define UCharConst(s)          (uchar_type(s)), (sizeof (s) - 1)
 #define CharConst(s)           (s), (sizeof (s) - 1)
index 6c95440..a7810c7 100644 (file)
@@ -100,6 +100,7 @@ void  shapePath (ustring& path) {
     static uregex  re1 ("//+");
     static uregex  re2 ("[^/]+/\\.\\.(/|$)");
     static uregex  re3 ("(/|^)\\.(/|$)");
+    static uregex  re4 ("^/\\.\\./");
     umatch  m;
     uiterator  b, e;
 
@@ -135,6 +136,10 @@ void  shapePath (ustring& path) {
            assert (0);
        }
     }
+    while (usearch (path, m, re4)) {
+       e = path.end ();
+       path = ustring (m[0].second - 1, e);
+    }
  Bp1:;
 }