Added match_matchPatternOnce().

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2844 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
Meep-Eep
2007-08-20 15:43:54 +00:00
parent f143da84ad
commit 05bf5119fa
4 changed files with 34 additions and 9 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.7:
- Added match_matchPatternOnce() - SvdB
- Fixed a problem with blue ships after Avatar's tractor beam,
along with some other fill-stamp situations; bug #929 - Alex
- Added TFB_Canvas_Lock(), TFB_Canvas_Unlock() and TFB_Canvas_GetStride()
+30 -8
View File
@@ -65,6 +65,16 @@ static inline void match_freeRegexContext(match_RegexContext *context);
// *** General part ***
static inline match_MatchContext *
match_allocMatchContext(void) {
return uio_malloc(sizeof (match_MatchContext));
}
static inline void
match_freeMatchContext(match_MatchContext *context) {
uio_free(context);
}
// NB: Even if this function fails, *contextPtr contains a context
// which needs to be freed.
match_Result
@@ -133,6 +143,7 @@ match_matchPattern(match_MatchContext *context, const char *string) {
}
}
// context may be NULL
const char *
match_errorString(match_MatchContext *context, match_Result result) {
switch (result) {
@@ -145,12 +156,16 @@ match_errorString(match_MatchContext *context, match_Result result) {
case match_ENOTINIT:
return "Uninitialised use";
case match_ECUSTOM:
// Depends on match type.
// Depends on match type. Printed below.
break;
default:
return "Unknown error";
}
if (context == NULL)
return "Unknown match-type specific error.";
// We can't be any more specific if no 'context' is supplied.
switch (context->type) {
#if 0
case match_MATCH_LITTERAL:
@@ -206,14 +221,21 @@ match_freeContext(match_MatchContext *context) {
match_freeMatchContext(context);
}
static inline match_MatchContext *
match_allocMatchContext(void) {
return uio_malloc(sizeof (match_MatchContext));
}
match_Result
match_matchPatternOnce(const char *pattern, match_MatchType type,
const char *string) {
match_MatchContext *context;
match_Result result;
static inline void
match_freeMatchContext(match_MatchContext *context) {
uio_free(context);
result = match_prepareContext(pattern, &context, type);
if (result != match_OK)
goto out;
result = match_matchPattern(context, string);
out:
match_freeContext(context);
return result;
}
+2
View File
@@ -70,6 +70,8 @@ match_Result match_matchPattern(match_MatchContext *context,
const char *match_errorString(match_MatchContext *context,
match_Result result);
void match_freeContext(match_MatchContext *context);
match_Result match_matchPatternOnce(const char *pattern, match_MatchType type,
const char *string);
/* *** Internal definitions follow *** */
+1 -1
View File
@@ -102,7 +102,7 @@ struct uio_MountInfo {
char *dirName;
/* The path inside the mounted fs leading to pDirHandle */
uio_PDirHandle *pDirHandle;
/* The pDirHandle belonging to this mount type */
/* The pDirHandle belonging to this mount */
uio_MountTree *mountTree;
/* The MountTree node for the mountpoint */
uio_AutoMount **autoMount;