diff options
Diffstat (limited to 'lwlib/lwlib.c')
-rw-r--r-- | lwlib/lwlib.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c index 30fa046cb73..863f65c915f 100644 --- a/lwlib/lwlib.c +++ b/lwlib/lwlib.c @@ -1,7 +1,7 @@ /* A general interface to the widgets of different toolkits. Copyright (C) 1992, 1993 Lucid, Inc. -Copyright (C) 1994-1996, 1999-2017 Free Software Foundation, Inc. +Copyright (C) 1994-1996, 1999-2022 Free Software Foundation, Inc. This file is part of the Lucid Widget Library. @@ -1233,8 +1233,7 @@ lw_separator_p (const char *label, enum menu_separator *type, int motif_p) { int separator_p = 0; - if (strlen (label) >= 3 - && memcmp (label, "--:", 3) == 0) + if (strncmp (label, "--:", 3) == 0) { static struct separator_table { @@ -1276,7 +1275,7 @@ lw_separator_p (const char *label, enum menu_separator *type, int motif_p) break; } } - else if (strlen (label) > 3 + else if (strnlen (label, 4) == 4 && memcmp (label, "--", 2) == 0 && label[2] != '-') { @@ -1325,10 +1324,14 @@ lw_separator_p (const char *label, enum menu_separator *type, int motif_p) { /* Old-style separator, maybe. It's a separator if it contains only dashes. */ - while (*label == '-') - ++label; - separator_p = *label == 0; - *type = SEPARATOR_SHADOW_ETCHED_IN; + if (*label == '-') + { + while (*label == '-') + ++label; + separator_p = *label == 0; + + *type = SEPARATOR_SHADOW_ETCHED_IN; + } } return separator_p; |