pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/cwrappers Trust libnbcompat to know if we nee...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d516cbae5948
branches:  trunk
changeset: 650174:d516cbae5948
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Sun Apr 19 13:30:35 2015 +0000

description:
Trust libnbcompat to know if we need a getline(3) replacement or not.
Avoids us having to encode a list of all such platforms here.

diffstat:

 pkgtools/cwrappers/Makefile                  |   5 +--
 pkgtools/cwrappers/files/bin/Makefile        |   6 +--
 pkgtools/cwrappers/files/bin/common.c        |   3 +-
 pkgtools/cwrappers/files/bin/common.h        |   5 +--
 pkgtools/cwrappers/files/bin/fixup-libtool.c |   5 +-
 pkgtools/cwrappers/files/bin/getline.c       |  52 ----------------------------
 6 files changed, 8 insertions(+), 68 deletions(-)

diffs (152 lines):

diff -r 2788c0c50112 -r d516cbae5948 pkgtools/cwrappers/Makefile
--- a/pkgtools/cwrappers/Makefile       Sun Apr 19 13:13:20 2015 +0000
+++ b/pkgtools/cwrappers/Makefile       Sun Apr 19 13:30:35 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.9 2015/03/18 15:05:35 jperkin Exp $
+# $NetBSD: Makefile,v 1.10 2015/04/19 13:30:35 tnn Exp $
 
 PKGNAME=               cwrappers-20150318
 CATEGORIES=            pkgtools sysutils
@@ -21,9 +21,6 @@
 .if ${OPSYS} != "NetBSD" || !empty(MACHINE_PLATFORM:MNetBSD-[0-5].*)
 MAKE_ENV+=     NEED_MI_VECTOR_HASH=1
 .endif
-.if !empty(MACHINE_PLATFORM:MDarwin-9.*) || !empty(MACHINE_PLATFORM:MDarwin-10.*)
-MAKE_ENV+=     NEED_GETLINE=1
-.endif
 
 CFLAGS.FreeBSD+=       -D_WITH_GETLINE
 CFLAGS.Linux+= -D_GNU_SOURCE=1
diff -r 2788c0c50112 -r d516cbae5948 pkgtools/cwrappers/files/bin/Makefile
--- a/pkgtools/cwrappers/files/bin/Makefile     Sun Apr 19 13:13:20 2015 +0000
+++ b/pkgtools/cwrappers/files/bin/Makefile     Sun Apr 19 13:30:35 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2014/09/18 19:31:47 joerg Exp $
+# $NetBSD: Makefile,v 1.3 2015/04/19 13:30:35 tnn Exp $
 #
 PROGS= as-wrapper cc-wrapper c++-wrapper cpp-wrapper f77-wrapper \
        imake-wrapper ld-wrapper libtool-wrapper shlibtool-wrapper
@@ -11,10 +11,6 @@
 LIB_SRCS+=     mi_vector_hash.c
 CPPFLAGS+=     -DNEED_MI_VECTOR_HASH
 .endif
-.ifdef NEED_GETLINE
-LIB_SRCS+=     getline.c
-CPPFLAGS+=     -DNEED_GETLINE
-.endif
 
 LDADD+=                -lnbcompat
 
diff -r 2788c0c50112 -r d516cbae5948 pkgtools/cwrappers/files/bin/common.c
--- a/pkgtools/cwrappers/files/bin/common.c     Sun Apr 19 13:13:20 2015 +0000
+++ b/pkgtools/cwrappers/files/bin/common.c     Sun Apr 19 13:30:35 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: common.c,v 1.3 2014/11/29 22:19:55 joerg Exp $ */
+/* $NetBSD: common.c,v 1.4 2015/04/19 13:30:35 tnn Exp $ */
 
 /*-
  * Copyright (c) 2009 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -32,6 +32,7 @@
 #include <nbcompat.h>
 #include <sys/wait.h>
 #include <nbcompat/err.h>
+#include <nbcompat/stdio.h>
 #include <nbcompat/stdlib.h>
 #include <string.h>
 #include <unistd.h>
diff -r 2788c0c50112 -r d516cbae5948 pkgtools/cwrappers/files/bin/common.h
--- a/pkgtools/cwrappers/files/bin/common.h     Sun Apr 19 13:13:20 2015 +0000
+++ b/pkgtools/cwrappers/files/bin/common.h     Sun Apr 19 13:30:35 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: common.h,v 1.3 2015/02/13 22:18:38 jperkin Exp $ */
+/* $NetBSD: common.h,v 1.4 2015/04/19 13:30:35 tnn Exp $ */
 
 /*-
  * Copyright (c) 2009 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -104,8 +104,5 @@
 #ifdef NEED_MI_VECTOR_HASH
 void   mi_vector_hash(const void *, size_t, uint32_t, uint32_t[3]);
 #endif
-#ifdef NEED_GETLINE
-ssize_t        getline(char **, size_t *, FILE *);
-#endif
 
 #endif
diff -r 2788c0c50112 -r d516cbae5948 pkgtools/cwrappers/files/bin/fixup-libtool.c
--- a/pkgtools/cwrappers/files/bin/fixup-libtool.c      Sun Apr 19 13:13:20 2015 +0000
+++ b/pkgtools/cwrappers/files/bin/fixup-libtool.c      Sun Apr 19 13:30:35 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fixup-libtool.c,v 1.5 2015/03/18 15:05:36 jperkin Exp $ */
+/* $NetBSD: fixup-libtool.c,v 1.6 2015/04/19 13:30:35 tnn Exp $ */
 
 /*-
  * Copyright (c) 2009 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -29,10 +29,11 @@
  * SUCH DAMAGE.
  */
 
+#include <nbcompat.h>
+#include <nbcompat/stdio.h>
 #include <sys/stat.h>
 #include <err.h>
 #include <stdint.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
diff -r 2788c0c50112 -r d516cbae5948 pkgtools/cwrappers/files/bin/getline.c
--- a/pkgtools/cwrappers/files/bin/getline.c    Sun Apr 19 13:13:20 2015 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "common.h"
-
-ssize_t
-getline(char **lineptr, size_t *len, FILE *fp)
-{
-       char *iter, *eos;
-       int ch;
-
-       if (*len == 1) {
-               free(*lineptr);
-               *len = 0;
-       }
-       if (*len == 0) {
-               *lineptr = malloc(128);
-               if (*lineptr == NULL)
-                       return -1;
-               *len = 128;             
-       }
-
-       iter = *lineptr;
-       for (;;) {
-               eos = *lineptr + *len - 1;
-
-               while (iter < eos) {
-                       ch = getc_unlocked(fp);
-                       if (ch == -1)
-                               break;
-                       *iter++ = ch;
-                       if (ch == '\n') {
-                               *iter = '\0';
-                               return iter - *lineptr;
-                       }
-               }
-               if (iter == *lineptr)
-                       return -1;
-               if (iter < eos) {
-                       *iter = '\0';
-                       return iter - *lineptr;
-               }
-
-               iter = realloc(*lineptr, *len * 2);
-               if (iter == NULL)
-                       return -1;
-               *lineptr = iter;
-               iter += *len - 1;
-               *len *= 2;
-       }
-}



Home | Main Index | Thread Index | Old Index