Merge branch 'master' into win32-x64-working
Conflicts: src/files.c src/potion.c sys/winnt/Makefile.msc Changes to be committed: modified: .gitignore modified: DEVEL/hooksdir/nhsub modified: dat/.gitignore modified: dat/opthelp modified: doc/Guidebook.mn modified: doc/Guidebook.tex modified: doc/fixes35.0 modified: include/context.h modified: include/decl.h modified: include/extern.h modified: include/flag.h modified: include/hack.h modified: include/patchlevel.h modified: src/apply.c modified: src/attrib.c modified: src/decl.c modified: src/do.c modified: src/do_name.c modified: src/dothrow.c modified: src/eat.c modified: src/files.c modified: src/hack.c modified: src/invent.c modified: src/lock.c modified: src/mklev.c modified: src/mondata.c modified: src/monmove.c modified: src/music.c modified: src/options.c modified: src/potion.c modified: src/pray.c modified: src/sit.c modified: src/sp_lev.c modified: src/uhitm.c modified: sys/share/posixregex.c modified: sys/winnt/Makefile.msc modified: util/.gitignore modified: win/win32/vs2010/NetHackW.vcxproj
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/* NetHack 3.5 posixregex.c $NHDT-Date: 1428590280 2015/04/09 14:38:00 $ $NHDT-Branch: scshunt-regex $:$NHDT-Revision: 1.0 $ */
|
||||
/* NetHack 3.5 posixregex.c $NHDT-Date: 1428970913 2015/04/14 00:21:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.0 $ */
|
||||
/* Copyright (c) Sean Hunt 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
#include <hack.h>
|
||||
#include "hack.h"
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
@@ -50,7 +50,7 @@ struct nhregex {
|
||||
};
|
||||
|
||||
struct nhregex *regex_init() {
|
||||
return malloc (sizeof (struct nhregex));
|
||||
return (struct nhregex *)alloc(sizeof (struct nhregex));
|
||||
}
|
||||
|
||||
boolean regex_compile(const char *s, struct nhregex *re) {
|
||||
@@ -65,7 +65,7 @@ const char *regex_error_desc(struct nhregex *re) {
|
||||
static char buf[BUFSZ];
|
||||
|
||||
if (!re || !re->err)
|
||||
return NULL;
|
||||
return (const char *)0;
|
||||
|
||||
/* FIXME: Using a static buffer here is not ideal, but avoids memory
|
||||
* leaks. Consider the allocation more carefully. */
|
||||
@@ -75,11 +75,12 @@ const char *regex_error_desc(struct nhregex *re) {
|
||||
}
|
||||
|
||||
boolean regex_match(const char *s, struct nhregex *re) {
|
||||
int result;
|
||||
|
||||
if (!re)
|
||||
return FALSE;
|
||||
|
||||
int result;
|
||||
if ((result = regexec(&re->re, s, 0, NULL, 0))) {
|
||||
if ((result = regexec(&re->re, s, 0, (genericptr_t)0, 0))) {
|
||||
if (result != REG_NOMATCH)
|
||||
re->err = result;
|
||||
return FALSE;
|
||||
|
||||
Reference in New Issue
Block a user