|
@ -31,7 +31,7 @@ |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
#if defined(LIBC_SCCS) && !defined(lint) |
|
|
#if defined(LIBC_SCCS) && !defined(lint) |
|
|
static char *rcsid = "$OpenBSD: bm.c,v 1.4 2003/06/02 20:18:38 millert Exp $"; |
|
|
|
|
|
|
|
|
static char *rcsid = "$OpenBSD: bm.c,v 1.5 2005/03/30 20:13:52 otto Exp $"; |
|
|
#endif /* LIBC_SCCS and not lint */ |
|
|
#endif /* LIBC_SCCS and not lint */ |
|
|
|
|
|
|
|
|
#include <sys/types.h> |
|
|
#include <sys/types.h> |
|
@ -85,14 +85,11 @@ static u_char const freq_def[256] = { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
bm_pat * |
|
|
bm_pat * |
|
|
bm_comp(pb, len, freq) |
|
|
|
|
|
u_char const *pb; |
|
|
|
|
|
size_t len; |
|
|
|
|
|
u_char const *freq; |
|
|
|
|
|
|
|
|
bm_comp(u_char const *pb, size_t len, u_char const *freq) |
|
|
{ |
|
|
{ |
|
|
register u_char const *pe, *p; |
|
|
|
|
|
register size_t *d, r; |
|
|
|
|
|
register int j; |
|
|
|
|
|
|
|
|
u_char const *pe, *p; |
|
|
|
|
|
size_t *d, r; |
|
|
|
|
|
int j; |
|
|
int sv_errno; |
|
|
int sv_errno; |
|
|
bm_pat *pat; |
|
|
bm_pat *pat; |
|
|
|
|
|
|
|
@ -142,8 +139,7 @@ mem: sv_errno = errno; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void |
|
|
void |
|
|
bm_free(pat) |
|
|
|
|
|
bm_pat *pat; |
|
|
|
|
|
|
|
|
bm_free(bm_pat *pat) |
|
|
{ |
|
|
{ |
|
|
if (pat->pat != NULL) |
|
|
if (pat->pat != NULL) |
|
|
free(pat->pat); |
|
|
free(pat->pat); |
|
@ -153,14 +149,11 @@ bm_free(pat) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
u_char * |
|
|
u_char * |
|
|
bm_exec(pat, base, n) |
|
|
|
|
|
bm_pat *pat; |
|
|
|
|
|
u_char *base; |
|
|
|
|
|
size_t n; |
|
|
|
|
|
|
|
|
bm_exec(bm_pat *pat, u_char *base, size_t n) |
|
|
{ |
|
|
{ |
|
|
register u_char *e, *ep, *p, *q, *s; |
|
|
|
|
|
register size_t *d0, k, md2, n1, ro; |
|
|
|
|
|
register int rc; |
|
|
|
|
|
|
|
|
u_char *e, *ep, *p, *q, *s; |
|
|
|
|
|
size_t *d0, k, md2, n1, ro; |
|
|
|
|
|
int rc; |
|
|
|
|
|
|
|
|
if (n == 0) |
|
|
if (n == 0) |
|
|
return (NULL); |
|
|
return (NULL); |
|
|