summaryrefslogtreecommitdiff
path: root/mh/mh_format.c
diff options
context:
space:
mode:
Diffstat (limited to 'mh/mh_format.c')
-rw-r--r--mh/mh_format.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/mh/mh_format.c b/mh/mh_format.c
index 7bab2ce8e..4e238dc5e 100644
--- a/mh/mh_format.c
+++ b/mh/mh_format.c
@@ -1,5 +1,5 @@
/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2019 Free Software Foundation, Inc.
+ Copyright (C) 1999-2024 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -149,12 +149,14 @@ mbsnlen (char const *str, size_t len)
static void
str_compress_ws (char *str)
{
- unsigned char *p, *q;
+ unsigned char *p;
+ char const *q;
size_t size = strlen (str);
mbi_iterator_t iter;
int space = 0;
+ size_t len;
- for (p = q = (unsigned char*) str,
+ for (p = (unsigned char*) str,
mbi_init (iter, str, size);
mbi_avail (iter);
mbi_advance (iter))
@@ -169,12 +171,10 @@ str_compress_ws (char *str)
else if (space)
space = 0;
- if (mb_isprint (mbi_cur (iter)))
- {
- size_t len = mb_len (mbi_cur (iter));
- memcpy (p, mb_ptr (mbi_cur (iter)), len);
- p += len;
- }
+ len = mb_len (mbi_cur (iter));
+ if ((q = mb_ptr (mbi_cur (iter))) != (char*) p && mb_isprint (mbi_cur (iter)))
+ memcpy (p, q, len);
+ p += len;
}
*p = 0;
}

Return to:

Send suggestions and report system problems to the System administrator.