From 95920c4fcd363969a497f6fe1fe35e0b95ca082b Mon Sep 17 00:00:00 2001 Message-Id: <95920c4fcd363969a497f6fe1fe35e0b95ca082b.1714987026.git.mdw@distorted.org.uk> From: Mark Wooding Date: Thu, 13 Apr 2006 23:29:54 +0100 Subject: [PATCH] str: Support new prefix-matching feature in str_match. Organization: Straylight/Edgeware From: Mark Wooding --- defs.pxi | 3 ++- str.pyx | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/defs.pxi b/defs.pxi index 2de0ab9..4b1ecde 100644 --- a/defs.pxi +++ b/defs.pxi @@ -157,9 +157,10 @@ cdef extern from 'mLib/sym.h': cdef extern from 'mLib/str.h': enum: STRF_QUOTE + STRF_PREFIX char *str_qword(char **pp, unsigned f) size_t str_qsplit(char *p, char **v, size_t c, char **rest, unsigned f) - int str_match(char *p, char *s) + int str_matchx(char *p, char *s, unsigned f) void str_sanitize(char *d, char *p, size_t sz) #----- Form-urlencoding functions ------------------------------------------- diff --git a/str.pyx b/str.pyx index 7ec1ed4..b7d80e6 100644 --- a/str.pyx +++ b/str.pyx @@ -76,8 +76,11 @@ def split(char *p, int n = -1, quotep = False): xfree(op) return l, r -def match(char *p, char *s): - return _tobool(str_match(p, s)) +def match(char *p, char *s, prefixp = False): + cdef unsigned f + if prefixp: + f = f | STRF_PREFIX + return _tobool(str_matchx(p, s, f)) def sanitize(char *p, int n = -1): cdef char *buf -- [mdw]