diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 15:27:12 (GMT) |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 15:27:12 (GMT) |
commit | 5be04ec2ceb1df77afbca4fcbf9e92a712612d6f (patch) | |
tree | 2b2e1c71dffae827c8e45cd4cccc375093d03486 /gl/strcasestr.c | |
parent | 6d1d1dac32841d5ca6ee51bb09b30a6c604b17e2 (diff) | |
download | monitoring-plugins-5be04ec2ceb1df77afbca4fcbf9e92a712612d6f.tar.gz |
Sync with the latest Gnulib code (d4ec02b3cc)refs/pull/2037/head
Diffstat (limited to 'gl/strcasestr.c')
-rw-r--r-- | gl/strcasestr.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/gl/strcasestr.c b/gl/strcasestr.c index 8eea435..b8c0479 100644 --- a/gl/strcasestr.c +++ b/gl/strcasestr.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Case-insensitive searching in a string. | 1 | /* Case-insensitive searching in a string. |
2 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2024 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2005. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2005. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
@@ -23,14 +23,12 @@ | |||
23 | #include <ctype.h> | 23 | #include <ctype.h> |
24 | #include <strings.h> | 24 | #include <strings.h> |
25 | 25 | ||
26 | #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) | ||
27 | |||
28 | /* Two-Way algorithm. */ | 26 | /* Two-Way algorithm. */ |
29 | #define RETURN_TYPE char * | 27 | #define RETURN_TYPE char * |
30 | #define AVAILABLE(h, h_l, j, n_l) \ | 28 | #define AVAILABLE(h, h_l, j, n_l) \ |
31 | (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \ | 29 | (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \ |
32 | && ((h_l) = (j) + (n_l))) | 30 | && ((h_l) = (j) + (n_l))) |
33 | #define CANON_ELEMENT(c) TOLOWER (c) | 31 | #define CANON_ELEMENT(c) tolower (c) |
34 | #define CMP_FUNC(p1, p2, l) \ | 32 | #define CMP_FUNC(p1, p2, l) \ |
35 | strncasecmp ((const char *) (p1), (const char *) (p2), l) | 33 | strncasecmp ((const char *) (p1), (const char *) (p2), l) |
36 | #include "str-two-way.h" | 34 | #include "str-two-way.h" |
@@ -52,8 +50,8 @@ strcasestr (const char *haystack_start, const char *needle_start) | |||
52 | NEEDLE if HAYSTACK is too short). */ | 50 | NEEDLE if HAYSTACK is too short). */ |
53 | while (*haystack && *needle) | 51 | while (*haystack && *needle) |
54 | { | 52 | { |
55 | ok &= (TOLOWER ((unsigned char) *haystack) | 53 | ok &= (tolower ((unsigned char) *haystack) |
56 | == TOLOWER ((unsigned char) *needle)); | 54 | == tolower ((unsigned char) *needle)); |
57 | haystack++; | 55 | haystack++; |
58 | needle++; | 56 | needle++; |
59 | } | 57 | } |