Just using standard malloc() since the xmalloc() didn't really add
anything useful to the command.
This commit is contained in:
parent
df030a075f
commit
f807f4b96c
37
src/filter.c
37
src/filter.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: filter.c,v 1.1.1.1 2000-02-16 17:32:18 sdyoung Exp $
|
/* $Id: filter.c,v 1.2 2000-09-11 23:43:59 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1999 George Talusan (gstalusan@uwaterloo.ca)
|
* Copyright (c) 1999 George Talusan (gstalusan@uwaterloo.ca)
|
||||||
*
|
*
|
||||||
@ -16,28 +16,15 @@
|
|||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include <defines.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "utils.h"
|
|
||||||
#include "tinyproxy.h"
|
#include "tinyproxy.h"
|
||||||
#include "filter.h"
|
|
||||||
|
|
||||||
#include "regexp.h"
|
#include <ctype.h>
|
||||||
#include <sysexits.h>
|
#include <sysexits.h>
|
||||||
|
|
||||||
|
#include "filter.h"
|
||||||
|
#include "regexp.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
static int err;
|
static int err;
|
||||||
|
|
||||||
struct filter_list {
|
struct filter_list {
|
||||||
@ -67,11 +54,11 @@ void filter_init(void)
|
|||||||
s = buf;
|
s = buf;
|
||||||
if (!p) /* head of list */
|
if (!p) /* head of list */
|
||||||
fl = p = (struct filter_list *)
|
fl = p = (struct filter_list *)
|
||||||
xmalloc(sizeof
|
malloc(sizeof
|
||||||
(struct filter_list));
|
(struct filter_list));
|
||||||
else { /* next entry */
|
else { /* next entry */
|
||||||
p->next = (struct filter_list *)
|
p->next = (struct filter_list *)
|
||||||
xmalloc(sizeof
|
malloc(sizeof
|
||||||
(struct filter_list));
|
(struct filter_list));
|
||||||
p = p->next;
|
p = p->next;
|
||||||
}
|
}
|
||||||
@ -83,8 +70,8 @@ void filter_init(void)
|
|||||||
if (isspace((int) *s))
|
if (isspace((int) *s))
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
|
|
||||||
p->pat = xstrdup(buf);
|
p->pat = strdup(buf);
|
||||||
p->cpat = xmalloc(sizeof(regex_t));
|
p->cpat = malloc(sizeof(regex_t));
|
||||||
if (
|
if (
|
||||||
(err =
|
(err =
|
||||||
regcomp(p->cpat, p->pat,
|
regcomp(p->cpat, p->pat,
|
||||||
@ -126,13 +113,11 @@ int filter_host(char *host)
|
|||||||
char *s, *port;
|
char *s, *port;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
assert(host);
|
|
||||||
|
|
||||||
if (!fl || !already_init)
|
if (!fl || !already_init)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
/* strip off the port number */
|
/* strip off the port number */
|
||||||
s = xstrdup(host);
|
s = strdup(host);
|
||||||
port = strchr(s, ':');
|
port = strchr(s, ':');
|
||||||
if (port)
|
if (port)
|
||||||
*port = '\0';
|
*port = '\0';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: filter.h,v 1.1.1.1 2000-02-16 17:32:24 sdyoung Exp $
|
/* $Id: filter.h,v 1.2 2000-09-11 23:43:59 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* See 'filter.c' for a detailed description.
|
* See 'filter.c' for a detailed description.
|
||||||
*
|
*
|
||||||
@ -15,8 +15,8 @@
|
|||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __FILTER_H_
|
#ifndef _TINYPROXY_FILTER_H_
|
||||||
#define __FILTER_H_ 1
|
#define _TINYPROXY_FILTER_H_
|
||||||
|
|
||||||
extern void filter_init(void);
|
extern void filter_init(void);
|
||||||
extern void filter_destroy(void);
|
extern void filter_destroy(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user