From: visor Date: Sun, 18 Dec 2016 10:02:46 +0000 (+0900) Subject: minor update. X-Git-Url: http://git.osdn.net/view?p=hmh%2Fhhml.git;a=commitdiff_plain;h=4fd17e312a84a65a7604b81e4200ff2bcffc2488 minor update. --- diff --git a/lib/ml.h b/lib/ml.h index 2bad9e4..2281a4c 100644 --- 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 */ diff --git a/lib/ustring.h b/lib/ustring.h index 1d2d2d6..f73c520 100644 --- a/lib/ustring.h +++ b/lib/ustring.h @@ -6,10 +6,12 @@ #include 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) diff --git a/lib/util_file.cc b/lib/util_file.cc index 6c95440..a7810c7 100644 --- a/lib/util_file.cc +++ b/lib/util_file.cc @@ -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:; }