pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/pkgtools/libnbcompat



Module Name:    pkgsrc
Committed By:   nia
Date:           Tue Mar 19 00:59:01 UTC 2024

Modified Files:
        pkgsrc/pkgtools/libnbcompat: Makefile
        pkgsrc/pkgtools/libnbcompat/files: README configure configure.ac
        pkgsrc/pkgtools/libnbcompat/files/nbcompat: cdefs.h config.h.in
            string.h
Added Files:
        pkgsrc/pkgtools/libnbcompat/files: memrchr.c

Log Message:
libnbcompat: Add memrchr.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 pkgsrc/pkgtools/libnbcompat/Makefile
cvs rdiff -u -r1.29 -r1.30 pkgsrc/pkgtools/libnbcompat/files/README
cvs rdiff -u -r1.89 -r1.90 pkgsrc/pkgtools/libnbcompat/files/configure
cvs rdiff -u -r1.90 -r1.91 pkgsrc/pkgtools/libnbcompat/files/configure.ac
cvs rdiff -u -r0 -r1.1 pkgsrc/pkgtools/libnbcompat/files/memrchr.c
cvs rdiff -u -r1.3 -r1.4 pkgsrc/pkgtools/libnbcompat/files/nbcompat/cdefs.h
cvs rdiff -u -r1.38 -r1.39 \
    pkgsrc/pkgtools/libnbcompat/files/nbcompat/config.h.in
cvs rdiff -u -r1.6 -r1.7 pkgsrc/pkgtools/libnbcompat/files/nbcompat/string.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/libnbcompat/Makefile
diff -u pkgsrc/pkgtools/libnbcompat/Makefile:1.92 pkgsrc/pkgtools/libnbcompat/Makefile:1.93
--- pkgsrc/pkgtools/libnbcompat/Makefile:1.92   Thu Nov  9 18:55:18 2023
+++ pkgsrc/pkgtools/libnbcompat/Makefile        Tue Mar 19 00:59:00 2024
@@ -1,11 +1,11 @@
-# $NetBSD: Makefile,v 1.92 2023/11/09 18:55:18 nia Exp $
+# $NetBSD: Makefile,v 1.93 2024/03/19 00:59:00 nia Exp $
 #
 # NOTE: If you update this package, it is *mandatory* that you update
 #      pkgsrc/pkgtools/libnbcompat/files/README to reflect the actual
 #      list of tested and supported platforms.
 #
 
-PKGNAME=               libnbcompat-20231109
+PKGNAME=               libnbcompat-20240319
 CATEGORIES=            pkgtools devel
 
 MAINTAINER=            pkgsrc-users%NetBSD.org@localhost

Index: pkgsrc/pkgtools/libnbcompat/files/README
diff -u pkgsrc/pkgtools/libnbcompat/files/README:1.29 pkgsrc/pkgtools/libnbcompat/files/README:1.30
--- pkgsrc/pkgtools/libnbcompat/files/README:1.29       Thu Nov  9 18:55:18 2023
+++ pkgsrc/pkgtools/libnbcompat/files/README    Tue Mar 19 00:59:00 2024
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.29 2023/11/09 18:55:18 nia Exp $
+$NetBSD: README,v 1.30 2024/03/19 00:59:00 nia Exp $
 
  0 Introduction
  ==============
@@ -44,6 +44,12 @@ breakage seep in.  Proper methodology fo
 *NOTE* the most recent libnbcompat.
 *NOTE*
 
+libnbcompat-20240319 has been tested to build and install correctly
+on the following operating systems:
+
+       NetBSD/amd64 10.0               <nia%NetBSD.org@localhost>
+       Darwin/powerpc 8.11.0           <nia%NetBSD.org@localhost>
+
 libnbcompat-20231109 has been tested to build and install correctly
 on the following operating systems:
 

Index: pkgsrc/pkgtools/libnbcompat/files/configure
diff -u pkgsrc/pkgtools/libnbcompat/files/configure:1.89 pkgsrc/pkgtools/libnbcompat/files/configure:1.90
--- pkgsrc/pkgtools/libnbcompat/files/configure:1.89    Thu Nov  9 18:55:18 2023
+++ pkgsrc/pkgtools/libnbcompat/files/configure Tue Mar 19 00:59:00 2024
@@ -7571,6 +7571,30 @@ esac
 
 fi
 
+need_memrchr=no
+
+  for ac_func in memrchr
+do :
+  ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr"
+if test "x$ac_cv_func_memrchr" = xyes
+then :
+  printf "%s\n" "#define HAVE_MEMRCHR 1" >>confdefs.h
+ :
+else $as_nop
+  need_memrchr=yes
+fi
+
+done
+
+if test $need_memrchr = yes; then
+        case " $LIBOBJS " in
+  *" memrchr.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS memrchr.$ac_objext"
+ ;;
+esac
+
+fi
+
 ac_fn_check_decl "$LINENO" "endgrent" "ac_cv_have_decl_endgrent" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
 if test "x$ac_cv_have_decl_endgrent" = xyes
 then :

Index: pkgsrc/pkgtools/libnbcompat/files/configure.ac
diff -u pkgsrc/pkgtools/libnbcompat/files/configure.ac:1.90 pkgsrc/pkgtools/libnbcompat/files/configure.ac:1.91
--- pkgsrc/pkgtools/libnbcompat/files/configure.ac:1.90 Thu Nov  9 18:55:18 2023
+++ pkgsrc/pkgtools/libnbcompat/files/configure.ac      Tue Mar 19 00:59:00 2024
@@ -1,4 +1,4 @@
-dnl $NetBSD: configure.ac,v 1.90 2023/11/09 18:55:18 nia Exp $
+dnl $NetBSD: configure.ac,v 1.91 2024/03/19 00:59:00 nia Exp $
 
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.52)
@@ -380,6 +380,13 @@ if test $need_strndup = yes; then
         AC_LIBOBJ(strndup)
 fi
 
+need_memrchr=no
+AC_CHECK_FUNCS([memrchr], [:], [need_memrchr=yes])
+
+if test $need_memrchr = yes; then
+        AC_LIBOBJ(memrchr)
+fi
+
 AC_CHECK_DECLS([endgrent, endpwent, setpassent])
 
 need_pwcache=no

Index: pkgsrc/pkgtools/libnbcompat/files/nbcompat/cdefs.h
diff -u pkgsrc/pkgtools/libnbcompat/files/nbcompat/cdefs.h:1.3 pkgsrc/pkgtools/libnbcompat/files/nbcompat/cdefs.h:1.4
--- pkgsrc/pkgtools/libnbcompat/files/nbcompat/cdefs.h:1.3      Tue Apr 29 05:46:08 2008
+++ pkgsrc/pkgtools/libnbcompat/files/nbcompat/cdefs.h  Tue Mar 19 00:59:01 2024
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdefs.h,v 1.3 2008/04/29 05:46:08 martin Exp $ */
+/*     $NetBSD: cdefs.h,v 1.4 2024/03/19 00:59:01 nia Exp $    */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -97,4 +97,17 @@
 # endif
 #endif
 
+/*
+ * The following macro is used to remove const cast-away warnings
+ * from gcc -Wcast-qual; it should be used with caution because it
+ * can hide valid errors; in particular most valid uses are in
+ * situations where the API requires it, not to cast away string
+ * constants. We don't use *intptr_t on purpose here and we are
+ * explicit about unsigned long so that we don't have additional
+ * dependencies.
+ */
+#ifndef __UNCONST
+#  define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
+#endif
+
 #endif /* !_NBCOMPAT_SYS_CDEFS_H_ */

Index: pkgsrc/pkgtools/libnbcompat/files/nbcompat/config.h.in
diff -u pkgsrc/pkgtools/libnbcompat/files/nbcompat/config.h.in:1.38 pkgsrc/pkgtools/libnbcompat/files/nbcompat/config.h.in:1.39
--- pkgsrc/pkgtools/libnbcompat/files/nbcompat/config.h.in:1.38 Thu Nov  9 18:55:19 2023
+++ pkgsrc/pkgtools/libnbcompat/files/nbcompat/config.h.in      Tue Mar 19 00:59:01 2024
@@ -197,6 +197,9 @@
 /* Define to 1 if you have the <md5.h> header file. */
 #undef HAVE_MD5_H
 
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
 /* Define to 1 if you have the <minix/config.h> header file. */
 #undef HAVE_MINIX_CONFIG_H
 

Index: pkgsrc/pkgtools/libnbcompat/files/nbcompat/string.h
diff -u pkgsrc/pkgtools/libnbcompat/files/nbcompat/string.h:1.6 pkgsrc/pkgtools/libnbcompat/files/nbcompat/string.h:1.7
--- pkgsrc/pkgtools/libnbcompat/files/nbcompat/string.h:1.6     Thu Nov  9 18:55:19 2023
+++ pkgsrc/pkgtools/libnbcompat/files/nbcompat/string.h Tue Mar 19 00:59:01 2024
@@ -1,4 +1,4 @@
-/*     $NetBSD: string.h,v 1.6 2023/11/09 18:55:19 nia Exp $   */
+/*     $NetBSD: string.h,v 1.7 2024/03/19 00:59:01 nia Exp $   */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -68,4 +68,8 @@ char  *strndup(const char *, size_t);
 char   *strsep(char **stringp, const char *delim);
 #endif
 
+#if !HAVE_MEMRCHR
+void   *memrchr(const void *, int, size_t);
+#endif
+
 #endif /* !_NBCOMPAT_STRING_H_ */

Added files:

Index: pkgsrc/pkgtools/libnbcompat/files/memrchr.c
diff -u /dev/null pkgsrc/pkgtools/libnbcompat/files/memrchr.c:1.1
--- /dev/null   Tue Mar 19 00:59:01 2024
+++ pkgsrc/pkgtools/libnbcompat/files/memrchr.c Tue Mar 19 00:59:00 2024
@@ -0,0 +1,62 @@
+/*     $NetBSD: memrchr.c,v 1.1 2024/03/19 00:59:00 nia Exp $  */
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
+#include <nbcompat.h>
+#include <nbcompat/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: memrchr.c,v 1.1 2024/03/19 00:59:00 nia Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include <nbcompat/assert.h>
+#include <nbcompat/string.h>
+
+#if !HAVE_MEMRCHR
+void *
+memrchr(const void *s, int c, size_t n)
+{
+       _DIAGASSERT(s != NULL);
+
+       if (n != 0) {
+               const unsigned char *p = (const unsigned char *)s + n;
+               const unsigned char cmp = c;
+
+               do {
+                       if (*--p == cmp)
+                               return __UNCONST(p);
+               } while (--n != 0);
+       }
+       return NULL;
+}
+#endif



Home | Main Index | Thread Index | Old Index