projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace lookup tables for obscure hashes with more readable code
[mmh]
/
uip
/
mhmisc.c
diff --git
a/uip/mhmisc.c
b/uip/mhmisc.c
index
313719f
..
8e20fa9
100644
(file)
--- a/
uip/mhmisc.c
+++ b/
uip/mhmisc.c
@@
-11,6
+11,8
@@
#include <h/mime.h>
#include <h/mhparse.h>
#include <h/utils.h>
#include <h/mime.h>
#include <h/mhparse.h>
#include <h/utils.h>
+#include <stdarg.h>
+#include <sys/stat.h>
extern int debugsw;
extern int debugsw;
@@
-51,7
+53,7
@@
part_ok(CT ct, int sP)
for (ap = parts; *ap; ap++) {
len = strlen(*ap);
for (ap = parts; *ap; ap++) {
len = strlen(*ap);
- if (!strncmp(*ap, ct->c_partno, len) &&
+ if (strncmp(*ap, ct->c_partno, len)==0 &&
(!ct->c_partno[len] ||
ct->c_partno[len] == '.' ))
return 1;
(!ct->c_partno[len] ||
ct->c_partno[len] == '.' ))
return 1;
@@
-119,7
+121,7
@@
losing_directory:
ep = concat("Create directory \"", file, "\"? ", NULL);
answer = getanswer(ep);
ep = concat("Create directory \"", file, "\"? ", NULL);
answer = getanswer(ep);
- free(ep);
+ mh_free0(&ep);
if (!answer)
goto losing_directory;
if (!answer)
goto losing_directory;
@@
-144,7
+146,6
@@
losing_directory:
void
content_error(char *what, CT ct, char *fmt, ...)
{
void
content_error(char *what, CT ct, char *fmt, ...)
{
- va_list arglist;
int i, len, buflen;
char *bp, buffer[BUFSIZ];
CI ci;
int i, len, buflen;
char *bp, buffer[BUFSIZ];
CI ci;
@@
-159,9
+160,13
@@
content_error(char *what, CT ct, char *fmt, ...)
buflen -= len;
}
buflen -= len;
}
- va_start(arglist, fmt);
+ {
+ va_list arglist;
- vsnprintf(bp, buflen, fmt, arglist);
+ va_start(arglist, fmt);
+ vsnprintf(bp, buflen, fmt, arglist);
+ va_end(arglist);
+ }
len = strlen(bp);
bp += len;
buflen -= len;
len = strlen(bp);
bp += len;
buflen -= len;
@@
-235,7
+240,6
@@
flush_errors(void)
if (errs) {
fflush(stdout);
fprintf(stderr, "%s", errs);
if (errs) {
fflush(stdout);
fprintf(stderr, "%s", errs);
- free(errs);
- errs = NULL;
+ mh_free0(&errs);
}
}
}
}