projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ssequal() does not check for a substring, but for a prefix, so added a
[mmh]
/
sbr
/
mf.c
diff --git
a/sbr/mf.c
b/sbr/mf.c
index
27c06bb
..
44dab8a
100644
(file)
--- a/
sbr/mf.c
+++ b/
sbr/mf.c
@@
-12,12
+12,12
@@
#include <h/mf.h>
#include <ctype.h>
#include <stdio.h>
#include <h/mf.h>
#include <ctype.h>
#include <stdio.h>
+#include <h/utils.h>
/*
* static prototypes
*/
static char *getcpy (char *);
/*
* static prototypes
*/
static char *getcpy (char *);
-static char *add (char *, char *);
static void compress (char *, char *);
static int isat (char *);
static int parse_address (void);
static void compress (char *, char *);
static int isat (char *);
static int parse_address (void);
@@
-42,26
+42,12
@@
getcpy (char *s)
for(;;)
pause();
}
for(;;)
pause();
}
- if ((p = malloc ((size_t) (strlen (s) + 2))))
- strcpy (p, s);
+ p = mh_xmalloc ((size_t) (strlen (s) + 2));
+ strcpy (p, s);
return p;
}
return p;
}
-static char *
-add (char *s1, char *s2)
-{
- register char *p;
-
- if (!s2)
- return getcpy (s1);
-
- if ((p = malloc ((size_t) (strlen (s1) + strlen (s2) + 2))))
- sprintf (p, "%s%s", s2, s1);
- free (s2);
- return p;
-}
-
int
isfrom(char *string)
{
int
isfrom(char *string)
{
@@
-934,8
+920,7
@@
mfgets (FILE *in, char **bp)
static char *pp = NULL;
if (pp == NULL)
static char *pp = NULL;
if (pp == NULL)
- if (!(pp = malloc ((size_t) (len = BUFSIZ))))
- return NOTOK;
+ pp = mh_xmalloc ((size_t) (len = BUFSIZ));
for (ep = (cp = pp) + len - 2;;) {
switch (i = getc (in)) {
for (ep = (cp = pp) + len - 2;;) {
switch (i = getc (in)) {
@@
-975,13
+960,8
@@
mfgets (FILE *in, char **bp)
break;
}
if (cp >= ep) {
break;
}
if (cp >= ep) {
- if (!(dp = realloc (pp, (size_t) (len += BUFSIZ)))) {
- free (pp);
- pp = NULL;
- return NOTOK;
- }
- else
- cp += dp - pp, ep = (pp = cp) + len - 2;
+ dp = mh_xrealloc (pp, (size_t) (len += BUFSIZ));
+ cp += dp - pp, ep = (pp = cp) + len - 2;
}
}
}
}
}
}