Commit 88009983 88009983722512ea36ce3112ffb0cf657ca18d67 by Sergey Poznyakoff

Minor change.

* configure.ac: Remove checks for strtok_r, strchrnul, strndup,
asprintf, vasprintf: none of these is used any more.
* maidag/lmtp.c (lmtp_reply): Use mu_vasnprintf.
* mh/mh.h (strchrnul): Remove proto.
* mh/mh_list.c (want_header): Rewrite.
(print): Use strcspn.
1 parent 38d688c1
...@@ -492,22 +492,13 @@ else ...@@ -492,22 +492,13 @@ else
492 fi 492 fi
493 AC_FUNC_MMAP 493 AC_FUNC_MMAP
494 494
495 AC_CHECK_DECLS([strtok_r, strchrnul, strndup, asprintf, vasprintf, strsignal], 495 AC_CHECK_DECLS([strsignal])
496 , , [
497 #include <stdio.h>
498 #include <string.h>
499 #ifdef HAVE_STRINGS_H
500 # include <strings.h>
501 #endif])
502 496
503 AC_CHECK_DECLS(environ, , , 497 AC_CHECK_DECLS(environ, , ,
504 [ #include <unistd.h> 498 [ #include <unistd.h>
505 #include <stdlib.h> ]) 499 #include <stdlib.h> ])
506 500
507 AH_BOTTOM([ 501 AH_BOTTOM([
508 #if !HAVE_DECL_STRTOK_R
509 extern char *strtok_r (char *s, const char *delim, char **save_ptr);
510 #endif
511 #if !HAVE_DECL_STRSIGNAL 502 #if !HAVE_DECL_STRSIGNAL
512 extern char *strsignal (int); 503 extern char *strsignal (int);
513 #endif 504 #endif
......
...@@ -267,7 +267,7 @@ mu_streamref_create_abridged (mu_stream_t *pref, mu_stream_t str, ...@@ -267,7 +267,7 @@ mu_streamref_create_abridged (mu_stream_t *pref, mu_stream_t str,
267 int flags; 267 int flags;
268 struct _mu_streamref *sp; 268 struct _mu_streamref *sp;
269 269
270 rc = mu_stream_seek (str, 0, MU_SEEK_SET, &off);//FIXME: SEEK_CUR? 270 rc = mu_stream_seek (str, 0, MU_SEEK_SET, &off);/*FIXME: SEEK_CUR?*/
271 if (rc) 271 if (rc)
272 return rc; 272 return rc;
273 mu_stream_get_flags (str, &flags); 273 mu_stream_get_flags (str, &flags);
......
...@@ -59,10 +59,11 @@ void ...@@ -59,10 +59,11 @@ void
59 lmtp_reply (mu_stream_t iostr, char *code, char *enh, char *fmt, ...) 59 lmtp_reply (mu_stream_t iostr, char *code, char *enh, char *fmt, ...)
60 { 60 {
61 va_list ap; 61 va_list ap;
62 char *str; 62 char *str = NULL;
63 size_t size = 0;
63 64
64 va_start (ap, fmt); 65 va_start (ap, fmt);
65 vasprintf (&str, fmt, ap); 66 mu_vasnprintf (&str, &size, fmt, ap);
66 va_end (ap); 67 va_end (ap);
67 68
68 if (!str) 69 if (!str)
......
...@@ -60,10 +60,6 @@ ...@@ -60,10 +60,6 @@
60 60
61 #include <mu_umaxtostr.h> 61 #include <mu_umaxtostr.h>
62 62
63 #if !HAVE_DECL_STRCHRNUL
64 extern char *strchrnul (const char *s, int c_in);
65 #endif
66
67 #define MH_FMT_RALIGN 0x1000 63 #define MH_FMT_RALIGN 0x1000
68 #define MH_FMT_ZEROPAD 0x2000 64 #define MH_FMT_ZEROPAD 0x2000
69 #define MH_FMT_COMPWS 0x4000 65 #define MH_FMT_COMPWS 0x4000
......
...@@ -937,7 +937,7 @@ mh_charset (const char *dfl) ...@@ -937,7 +937,7 @@ mh_charset (const char *dfl)
937 /* Try to deduce the charset from LC_ALL variable */ 937 /* Try to deduce the charset from LC_ALL variable */
938 struct mu_lc_all lc_all; 938 struct mu_lc_all lc_all;
939 if (mu_parse_lc_all (getenv ("LC_ALL"), &lc_all, MU_LC_CSET) == 0) 939 if (mu_parse_lc_all (getenv ("LC_ALL"), &lc_all, MU_LC_CSET) == 0)
940 saved_charset = lc_all.charset; /* FIXME: Memory leak */ 940 saved_charset = lc_all.charset; /* FIXME: Mild memory leak */
941 } 941 }
942 charset = saved_charset; 942 charset = saved_charset;
943 } 943 }
......
...@@ -480,16 +480,24 @@ header_is_printed (struct eval_env *env, const char *name) ...@@ -480,16 +480,24 @@ header_is_printed (struct eval_env *env, const char *name)
480 int 480 int
481 want_header (struct eval_env *env, const char *name) 481 want_header (struct eval_env *env, const char *name)
482 { 482 {
483 char *p, *str = env->svar[S_IGNORES]; 483 const char *p, *str;
484 484
485 for (p = strchrnul (str, ','); *str; p = strchrnul (str, ',')) 485 for (str = env->svar[S_IGNORES], p = name; *str; str++)
486 { 486 {
487 if (mu_c_strncasecmp (name, str, p - str) == 0) 487 if (p)
488 return 0; 488 {
489 str = p; 489 if (*p == 0 && *str == ',')
490 if (*str) 490 break;
491 str++; 491 if (mu_tolower (*p) == mu_tolower (*str))
492 p++;
493 else
494 p = NULL;
495 }
496 else if (*str == ',')
497 p = name;
492 } 498 }
499 if (p && *p == 0)
500 return 0;
493 return 1; 501 return 1;
494 } 502 }
495 503
...@@ -577,16 +585,15 @@ print (struct eval_env *env, char *str, int nloff) ...@@ -577,16 +585,15 @@ print (struct eval_env *env, char *str, int nloff)
577 newline (env); 585 newline (env);
578 str++; 586 str++;
579 } 587 }
580 else 588 else if (*str)
581 { 589 {
582 char *p = strchrnul (str, '\n'); 590 size_t size = strcspn (str, "\n");
583 ovf_print (env, str, p - str, nloff); 591 ovf_print (env, str, size, nloff);
584 str = p; 592 str += size;
585 if (*p) 593 if (*str == '\n')
586 { 594 {
587 newline (env); 595 newline (env);
588 for (str++; *str && mu_isspace (*str); str++) 596 str = mu_str_skip_class (str + 1, MU_CTYPE_SPACE);
589 ;
590 } 597 }
591 } 598 }
592 } 599 }
......