This is an automated email from the ASF dual-hosted git repository.
gustavonihei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 4a23737 libc: Remove include/nuttx/lib/regex.h and
libs/libc/misc/lib_match.c
4a23737 is described below
commit 4a23737016269fb40f0d35919bad35256e019e91
Author: Xiang Xiao <[email protected]>
AuthorDate: Sun Aug 1 16:54:08 2021 +0800
libc: Remove include/nuttx/lib/regex.h and libs/libc/misc/lib_match.c
Signed-off-by: Xiang Xiao <[email protected]>
---
include/nuttx/lib/regex.h | 68 ---------------
libs/libc/libc.csv | 1 -
libs/libc/misc/Make.defs | 2 +-
libs/libc/misc/lib_match.c | 210 ---------------------------------------------
4 files changed, 1 insertion(+), 280 deletions(-)
diff --git a/include/nuttx/lib/regex.h b/include/nuttx/lib/regex.h
deleted file mode 100644
index 6cf9f30..0000000
--- a/include/nuttx/lib/regex.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
- * include/nuttx/lib/regex.h
- * Non-standard, pattern-matching APIs available in lib/.
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-#ifndef __INCLUDE_NUTTX_LIB_REGEX_H
-#define __INCLUDE_NUTTX_LIB_REGEX_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/fs/fs.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-#ifdef __cplusplus
-#define EXTERN extern "C"
-extern "C"
-{
-#else
-#define EXTERN extern
-#endif
-
-/****************************************************************************
- * Name: match
- *
- * Description:
- * Simple shell-style filename pattern matcher written by Jef Poskanzer
- * (See copyright notice in lib/lib_match.c). This pattern matcher only
- * handles '?', '*' and '**', and multiple patterns separated by '|'.
- *
- * Returned Value:
- * Returns 1 (match) or 0 (no-match).
- *
- ****************************************************************************/
-
-int match(FAR const char *pattern, FAR const char *string);
-
-#undef EXTERN
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __INCLUDE_NUTTX_LIB_REGEX_H */
diff --git a/libs/libc/libc.csv b/libs/libc/libc.csv
index b505164..94622a5 100644
--- a/libs/libc/libc.csv
+++ b/libs/libc/libc.csv
@@ -90,7 +90,6 @@
"lio_listio","aio.h","defined(CONFIG_FS_AIO)","int","int","FAR struct aiocb *
const []|FAR struct aiocb * const *","int","FAR struct sigevent *"
"llabs","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","long long int","long long
int"
"malloc","stdlib.h","","FAR void *","size_t"
-"match","nuttx/lib/regex.h","","int","FAR const char *","FAR const char *"
"mblen","stdlib.h","defined(CONFIG_LIBC_WCHAR)","int","FAR const char
*","size_t"
"mbrlen","wchar.h","defined(CONFIG_LIBC_WCHAR)","size_t","FAR const char
*","size_t","FAR mbstate_t *"
"mbrtowc","wchar.h","defined(CONFIG_LIBC_WCHAR)","size_t","FAR wchar_t *","FAR
const char *","size_t","FAR mbstate_t *"
diff --git a/libs/libc/misc/Make.defs b/libs/libc/misc/Make.defs
index af94784..c9ce6ef 100644
--- a/libs/libc/misc/Make.defs
+++ b/libs/libc/misc/Make.defs
@@ -44,7 +44,7 @@ endif
# Add the miscellaneous C files to the build
-CSRCS += lib_dumpbuffer.c lib_dumpvbuffer.c lib_fnmatch.c lib_match.c
lib_debug.c
+CSRCS += lib_dumpbuffer.c lib_dumpvbuffer.c lib_fnmatch.c lib_debug.c
CSRCS += lib_crc64.c lib_crc32.c lib_crc16.c lib_crc8.c lib_crc8ccitt.c
CSRCS += lib_crc8table.c
diff --git a/libs/libc/misc/lib_match.c b/libs/libc/misc/lib_match.c
deleted file mode 100644
index 102bb28..0000000
--- a/libs/libc/misc/lib_match.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/****************************************************************************
- * libs/libc/misc/lib_match.c
- *
- * Simple shell-style filename pattern matcher written by Jef Poskanzer
- * This pattern matcher only handles '?', '*' and '**', and multiple
- * patterns separated by '|'.
- *
- * Copyright � 1995, 2000 by Jef Poskanzer <[email protected]>.
- * All rights reserved.
- *
- * With extensions by Ken Pettit.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <string.h>
-#include <nuttx/lib/regex.h>
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: match_one
- *
- * Description:
- * Does all of the work for one '|' delimited pattern
- *
- * Returned Value:
- * Returns 1 (match) or 0 (no-match).
- *
- ****************************************************************************/
-
-static int match_one(FAR const char *pattern, int patlen,
- FAR const char *string)
-{
- const char *p;
- char first;
- int pl;
- int i;
-
- for (p = pattern; p - pattern < patlen; p++, string++)
- {
- if (*p == '?' && *string != '\0')
- {
- continue;
- }
-
- /* Match single character from a set: "[a-zA-Z]" for instance */
-
- if (*p == '[' && *string != '\0')
- {
- i = 0;
- while (*p != ']' && *p != '\0')
- {
- p++;
-
- if (*string == *p)
- {
- /* Match found. Advance to the ']' */
-
- i = 1;
- while (*p != ']' && *p != '\0')
- {
- p++;
- }
-
- break;
- }
-
- /* Prepare to test for range */
-
- if (*p != '\0')
- {
- first = *p++;
- if (*p == '-')
- {
- p++;
- if (*string >= first && *string <= *p)
- {
- /* Match found. Advance to the ']' */
-
- i = 1;
- while (*p != ']' && *p != '\0')
- {
- p++;
- }
-
- break;
- }
- }
- }
- }
-
- /* We reuse 'i' above to indicate match found */
-
- if (i)
- {
- continue;
- }
-
- return 0;
- }
-
- if (*p == '*')
- {
- p++;
- if (*p == '*')
- {
- /* Double-wildcard matches anything. */
-
- p++;
- i = strlen(string);
- }
- else
- {
- /* Single-wildcard matches anything but slash. */
-
- i = strcspn(string, "/");
- }
-
- pl = patlen - (p - pattern);
- for (; i >= 0; i--)
- {
- if (match_one(p, pl, &(string[i])))
- {
- return 1;
- }
- }
-
- return 0;
- }
-
- if (*p != *string)
- {
- return 0;
- }
- }
-
- if (*string == '\0')
- {
- return 1;
- }
-
- return 0;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: match
- *
- * Description:
- * Simple shell-style filename pattern matcher originally written by
- * Jef Poskanzer and extended by Ken Pettit. This pattern matcher handles
- * '?', '*', '**', sets like [a-zA-z], and multiple patterns separated
- * by '|'.
- *
- * Returned Value:
- * Returns 1 (match) or 0 (no-match).
- *
- ****************************************************************************/
-
-int match(FAR const char *pattern, FAR const char *string)
-{
- const char *or;
-
- for (; ; )
- {
- or = strchr(pattern, '|');
- if (or == (char *)0)
- {
- return match_one(pattern, strlen(pattern), string);
- }
-
- if (match_one(pattern, or - pattern, string))
- {
- return 1;
- }
-
- pattern = or + 1;
- }
-}