Module: wine Branch: master Commit: db7c934f8e141315824004cbd90ecda07f12ba6d URL: https://source.winehq.org/git/wine.git/?a=commit;h=db7c934f8e141315824004cbd...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Dec 1 10:19:50 2020 +0100
libport: Remove the strnlen() function replacement.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
configure | 1 - configure.ac | 1 - dlls/wined3d/shader_sm4.c | 7 +------ include/config.h.in | 3 --- include/wine/port.h | 5 ----- libs/port/Makefile.in | 1 - libs/port/strnlen.c | 31 ------------------------------- 7 files changed, 1 insertion(+), 48 deletions(-)
diff --git a/configure b/configure index 6c2bcc37f95..7ac509dec10 100755 --- a/configure +++ b/configure @@ -17783,7 +17783,6 @@ for ac_func in \ setprogname \ settimeofday \ sigprocmask \ - strnlen \ strtold \ symlink \ sysinfo \ diff --git a/configure.ac b/configure.ac index 2233c7266fc..69254a9631d 100644 --- a/configure.ac +++ b/configure.ac @@ -2192,7 +2192,6 @@ AC_CHECK_FUNCS(\ setprogname \ settimeofday \ sigprocmask \ - strnlen \ strtold \ symlink \ sysinfo \ diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index 90135553d8f..4635910269f 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -1939,18 +1939,13 @@ static HRESULT parse_dxbc(const char *data, SIZE_T data_size,
static const char *shader_get_string(const char *data, size_t data_size, DWORD offset) { - size_t len, max_len; - if (offset >= data_size) { WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size); return NULL; }
- max_len = data_size - offset; - len = strnlen(data + offset, max_len); - - if (len == max_len) + if (!memchr( data + offset, 0, data_size - offset )) return NULL;
return data + offset; diff --git a/include/config.h.in b/include/config.h.in index 94232030cf0..a6d45bf031f 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -807,9 +807,6 @@ /* Define to 1 if you have the <string.h> header file. */ #undef HAVE_STRING_H
-/* Define to 1 if you have the `strnlen' function. */ -#undef HAVE_STRNLEN - /* Define to 1 if you have the <stropts.h> header file. */ #undef HAVE_STROPTS_H
diff --git a/include/wine/port.h b/include/wine/port.h index 2b127e59e20..a4bcbc757b7 100644 --- a/include/wine/port.h +++ b/include/wine/port.h @@ -273,10 +273,6 @@ ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset ); int readlink( const char *path, char *buf, size_t size ); #endif /* HAVE_READLINK */
-#ifndef HAVE_STRNLEN -size_t strnlen( const char *str, size_t maxlen ); -#endif /* !defined(HAVE_STRNLEN) */ - #ifndef HAVE_SYMLINK int symlink(const char *from, const char *to); #endif @@ -296,7 +292,6 @@ extern int mkstemps(char *template, int suffix_len); #define lstat __WINE_NOT_PORTABLE(lstat) #define pread __WINE_NOT_PORTABLE(pread) #define pwrite __WINE_NOT_PORTABLE(pwrite) -#define strnlen __WINE_NOT_PORTABLE(strnlen) #define usleep __WINE_NOT_PORTABLE(usleep)
#endif /* NO_LIBWINE_PORT */ diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in index 8a963d22b8d..26b8fae4f3d 100644 --- a/libs/port/Makefile.in +++ b/libs/port/Makefile.in @@ -12,6 +12,5 @@ C_SRCS = \ pwrite.c \ readlink.c \ spawn.c \ - strnlen.c \ symlink.c \ usleep.c diff --git a/libs/port/strnlen.c b/libs/port/strnlen.c deleted file mode 100644 index ab6668d3466..00000000000 --- a/libs/port/strnlen.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * strnlen function - * - * Copyright 2017 Alexandre Julliard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "config.h" -#include "wine/port.h" - -#ifndef HAVE_STRNLEN -size_t strnlen( const char *str, size_t maxlen ) -{ - const char *ptr = memchr( str, 0, maxlen ); - if (!ptr) return maxlen; - return ptr - str; -} -#endif /* HAVE_STRNLEN */