Release 0.7.1
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABCgAGBQJU6M9kAAoJEAgwLbaiZwQotbwP/iIaonabM2HbgjV1h8ajtCQO vV1wgSpYHoRqb/0fIecUzXkEnKWcIbnVs/N8L1ui1Z0D0CliD7V8jzr4KVo2ip5K LqMn3oTEB7jV9Z31BAwmzGU8rBwRa7MdHlNLGcUiLb0oSTCrLieyJYAE/mK48YQq bWmbVpjnNy49JV9mLML1uxFFwASlX5OtfDDUaE9KsYy3P1SjlscW9KV4ST+1H3Hs FQsbt9eQFsLjt3hV03K9K6+yU9j7umCKXp0RqONonY7t6kwNi0HRR/bgdCJUAbHO AQRLZsnYTVngLHv+IVo0fF02CgBT+eDI8dppY6CSkOn4DZU8bV2fk46bCpnaNlgj Cx1UjQITNbHc2jyxDgnv38jKHzJB69kvtbrmS63HxLyiqE0z2X6cDttqPkwZLfJA CVJbCQ8fZUN/3etFYaqX27v95PpIbEsRffqjJ6hfp34gDPp3RprdBvC28tLP7HB/ +V/+qRBQQwsxXRVb+bGXBQUjBpOIwPJQwTT1QhupwMA847geT+YyQcnIHNhwFXkG H7E5TwLvGfQUi8s+iqbsT36Q8SUxxjnw24wJYZsFXg2DdhUnuOA7ZKMxR/E7V4zy 9TkfRUPGnx+4HwVOCaI9PEUYJ425N3GIPp2+07k3lVD/uT0OhhGyDKpudrPluWCo bGvkXzJHjhxMJucmcAvu =tu6S -----END PGP SIGNATURE----- Merge tag 'libpsl-0.7.1' into debian Release 0.7.1
This commit is contained in:
commit
fe479c6c6e
2
AUTHORS
2
AUTHORS
|
@ -11,3 +11,5 @@ Tim Ruehsen (Implementation of libpsl)
|
||||||
Daniel Kahn Gillmor (Discussion, Ideas, Organization, Code)
|
Daniel Kahn Gillmor (Discussion, Ideas, Organization, Code)
|
||||||
Daniel Stenberg (Discussion, Ideas)
|
Daniel Stenberg (Discussion, Ideas)
|
||||||
Darshit Shah (Patching Wget to work with libpsl)
|
Darshit Shah (Patching Wget to work with libpsl)
|
||||||
|
Dagobert Michelsen (Fixed Solaris building)
|
||||||
|
Christopher Meng (Fedora building)
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
# got some hints from https://gitorious.org/openismus-playground/examplelib/source
|
# got some hints from https://gitorious.org/openismus-playground/examplelib/source
|
||||||
|
|
||||||
SUBDIRS = po include src tools data docs/libpsl tests
|
SUBDIRS = po include src tools data $(LIBPSL_DOCS) tests
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
|
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
|
||||||
|
|
||||||
# Enable GTK-Doc during make distcheck
|
# Enable GTK-Doc during make distcheck
|
||||||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-man
|
#DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-man
|
||||||
|
|
||||||
## Install the generated pkg-config file (.pc) into the expected location for
|
## Install the generated pkg-config file (.pc) into the expected location for
|
||||||
## architecture-dependent package configuration information. Occasionally,
|
## architecture-dependent package configuration information. Occasionally,
|
||||||
|
|
11
NEWS
11
NEWS
|
@ -1,5 +1,16 @@
|
||||||
Copyright (C) 2014 Tim Rühsen
|
Copyright (C) 2014 Tim Rühsen
|
||||||
|
|
||||||
|
21.02.2015 Release V0.7.1
|
||||||
|
* include configured PSL file into tarball
|
||||||
|
|
||||||
|
30.01.2015 Release V0.7.0
|
||||||
|
* include effective_tld_names.dat of date 29.12.2014
|
||||||
|
* do not install docs when gtk-doc is not installed
|
||||||
|
* fix several compatibility issues with Solaris
|
||||||
|
* fix 'make distcheck' after 'make clean'
|
||||||
|
* mark API as stable
|
||||||
|
* use pkg-config to detect libicu
|
||||||
|
|
||||||
14.11.2014 Release V0.6.2
|
14.11.2014 Release V0.6.2
|
||||||
* revoked commit from 0.6.1 to satisfy Travis-CI
|
* revoked commit from 0.6.1 to satisfy Travis-CI
|
||||||
|
|
||||||
|
|
12
autogen.sh
12
autogen.sh
|
@ -1,6 +1,7 @@
|
||||||
# !/bin/sh -e
|
# !/bin/sh -e
|
||||||
|
|
||||||
if test -z `which autoreconf`; then
|
AUTORECONF=`which autoreconf 2>/dev/null`
|
||||||
|
if test $? -ne 0; then
|
||||||
echo "No 'autoreconf' found. You must install the autoconf package."
|
echo "No 'autoreconf' found. You must install the autoconf package."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -9,15 +10,18 @@ fi
|
||||||
mkdir m4 2>/dev/null
|
mkdir m4 2>/dev/null
|
||||||
|
|
||||||
GTKDOCIZE=`which gtkdocize 2>/dev/null`
|
GTKDOCIZE=`which gtkdocize 2>/dev/null`
|
||||||
if test -z $GTKDOCIZE; then
|
if test $? -ne 0; then
|
||||||
echo "No gtk-doc support found. You can't build the docs."
|
echo "No gtk-doc support found. You can't build the docs."
|
||||||
|
# rm because gtk-doc.make might be a link to a protected file
|
||||||
|
rm -f gtk-doc.make 2>/dev/null
|
||||||
echo "EXTRA_DIST =" >gtk-doc.make
|
echo "EXTRA_DIST =" >gtk-doc.make
|
||||||
echo "CLEANFILES =" >>gtk-doc.make
|
echo "CLEANFILES =" >>gtk-doc.make
|
||||||
|
GTKDOCIZE=""
|
||||||
else
|
else
|
||||||
gtkdocize || exit $?
|
$GTKDOCIZE || exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
autoreconf --install --force --symlink || exit $?
|
$AUTORECONF --install --force --symlink || exit $?
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "----------------------------------------------------------------"
|
echo "----------------------------------------------------------------"
|
||||||
|
|
66
configure.ac
66
configure.ac
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
AC_INIT([libpsl], [0.6.2], [tim.ruehsen@gmx.de], [libpsl], [http://github.com/rockdaboot/libpsl])
|
AC_INIT([libpsl], [0.7.1], [tim.ruehsen@gmx.de], [libpsl], [http://github.com/rockdaboot/libpsl])
|
||||||
AC_PREREQ([2.59])
|
AC_PREREQ([2.59])
|
||||||
AM_INIT_AUTOMAKE([1.10 -Wall no-define foreign])
|
AM_INIT_AUTOMAKE([1.10 -Wall no-define foreign])
|
||||||
|
|
||||||
|
@ -14,6 +14,9 @@ LT_INIT
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||||
|
|
||||||
|
dnl Check that compiler understands inline
|
||||||
|
AC_C_INLINE
|
||||||
|
|
||||||
#
|
#
|
||||||
# Gettext
|
# Gettext
|
||||||
#
|
#
|
||||||
|
@ -28,6 +31,16 @@ GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
|
||||||
],[
|
],[
|
||||||
AM_CONDITIONAL([ENABLE_GTK_DOC], false)
|
AM_CONDITIONAL([ENABLE_GTK_DOC], false)
|
||||||
])
|
])
|
||||||
|
# needed for some older versions of gtk-doc
|
||||||
|
m4_ifdef([GTK_DOC_USE_LIBTOOL], [], [
|
||||||
|
AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], false)
|
||||||
|
])
|
||||||
|
|
||||||
|
if test x"$have_gtk_doc" = xyes -a x"$enable_gtk_doc" = xyes; then
|
||||||
|
docdir_makefile=docs/libpsl/Makefile
|
||||||
|
docdir_version_xml=docs/libpsl/version.xml
|
||||||
|
AC_SUBST([LIBPSL_DOCS], [docs/libpsl])
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# enable creation of man pages
|
# enable creation of man pages
|
||||||
|
@ -51,6 +64,7 @@ AS_IF([ test "$enable_man" != no ], [
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
PKG_PROG_PKG_CONFIG
|
||||||
|
|
||||||
# Define these substitions here to keep all version information in one place.
|
# Define these substitions here to keep all version information in one place.
|
||||||
# For information on how to properly maintain the library version information,
|
# For information on how to properly maintain the library version information,
|
||||||
|
@ -63,7 +77,7 @@ AS_IF([ test "$enable_man" != no ], [
|
||||||
# 4. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0.
|
# 4. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0.
|
||||||
# 5. If any interfaces have been added since the last public release, then increment age.
|
# 5. If any interfaces have been added since the last public release, then increment age.
|
||||||
# 6. If any existing interfaces have been removed or changed since the last public release, then set age to 0.
|
# 6. If any existing interfaces have been removed or changed since the last public release, then set age to 0.
|
||||||
AC_SUBST([LIBPSL_SO_VERSION], [2:3:2])
|
AC_SUBST([LIBPSL_SO_VERSION], [2:4:2])
|
||||||
AC_SUBST([LIBPSL_VERSION], $VERSION)
|
AC_SUBST([LIBPSL_VERSION], $VERSION)
|
||||||
|
|
||||||
# Check for enable/disable builtin PSL data
|
# Check for enable/disable builtin PSL data
|
||||||
|
@ -130,16 +144,22 @@ if test "$enable_runtime" = "libicu" -o "$enable_builtin" = "libicu"; then
|
||||||
# Check for libicu
|
# Check for libicu
|
||||||
# using pkg-config won't work on older systems like Ubuntu 12.04 LTS Server Edition 64bit
|
# using pkg-config won't work on older systems like Ubuntu 12.04 LTS Server Edition 64bit
|
||||||
# using AC_SEARCH_LIBS also don't work since functions have the library version appended
|
# using AC_SEARCH_LIBS also don't work since functions have the library version appended
|
||||||
OLDLIBS=$LIBS
|
PKG_CHECK_MODULES([LIBICU], [icu-uc], [
|
||||||
LIBS="-licuuc $LIBS"
|
HAVE_LIBICU=yes
|
||||||
AC_MSG_CHECKING([for ICU unicode library])
|
LIBS="$LIBICU_LIBS $LIBS"
|
||||||
AC_LINK_IFELSE(
|
CFLAGS="$LIBICU_CFLAGS $CFLAGS"
|
||||||
[AC_LANG_PROGRAM(
|
], [
|
||||||
[[#include <unicode/ustring.h>]],
|
OLDLIBS=$LIBS
|
||||||
[[u_strToUTF8(NULL, 0, NULL, NULL, 0, NULL);]])],
|
LIBS="-licuuc $LIBS"
|
||||||
[HAVE_LIBICU=yes; AC_MSG_RESULT([yes])],
|
AC_MSG_CHECKING([for ICU unicode library])
|
||||||
[AC_MSG_RESULT([no]); AC_MSG_ERROR(You requested libicu but it is not installed.)])
|
AC_LINK_IFELSE(
|
||||||
LIBS=$OLDLIBS
|
[AC_LANG_PROGRAM(
|
||||||
|
[[#include <unicode/ustring.h>]],
|
||||||
|
[[u_strToUTF8(NULL, 0, NULL, NULL, 0, NULL);]])],
|
||||||
|
[HAVE_LIBICU=yes; AC_MSG_RESULT([yes])],
|
||||||
|
[AC_MSG_RESULT([no]); AC_MSG_ERROR(You requested libicu but it is not installed.)])
|
||||||
|
LIBS=$OLDLIBS
|
||||||
|
])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$enable_runtime" = "libidn2" -o "$enable_builtin" = "libidn2"; then
|
if test "$enable_runtime" = "libidn2" -o "$enable_builtin" = "libidn2"; then
|
||||||
|
@ -163,6 +183,10 @@ if test "x$HAVE_LIBIDN2" = "xyes" -o "x$HAVE_LIBIDN" = "xyes"; then
|
||||||
LIBS=$OLDLIBS
|
LIBS=$OLDLIBS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# AM_ICONV sets @LIBICONV@ and @LTLIBICONV@ for use in Makefile.am
|
||||||
|
# do not use AM_ICONV conditionally
|
||||||
|
AM_ICONV
|
||||||
|
|
||||||
AM_CONDITIONAL([WITH_LIBICU], test "x$enable_runtime" = "xlibicu")
|
AM_CONDITIONAL([WITH_LIBICU], test "x$enable_runtime" = "xlibicu")
|
||||||
AM_CONDITIONAL([WITH_LIBIDN2], test "x$enable_runtime" = "xlibidn2")
|
AM_CONDITIONAL([WITH_LIBIDN2], test "x$enable_runtime" = "xlibidn2")
|
||||||
AM_CONDITIONAL([WITH_LIBIDN], test "x$enable_runtime" = "xlibidn")
|
AM_CONDITIONAL([WITH_LIBIDN], test "x$enable_runtime" = "xlibidn")
|
||||||
|
@ -171,6 +195,19 @@ AM_CONDITIONAL([BUILTIN_GENERATOR_LIBIDN2], test "x$enable_builtin" = "xlibidn2"
|
||||||
AM_CONDITIONAL([BUILTIN_GENERATOR_LIBIDN], test "x$enable_builtin" = "xlibidn")
|
AM_CONDITIONAL([BUILTIN_GENERATOR_LIBIDN], test "x$enable_builtin" = "xlibidn")
|
||||||
AM_CONDITIONAL([WITH_BUILTIN], test $enable_builtin = yes)
|
AM_CONDITIONAL([WITH_BUILTIN], test $enable_builtin = yes)
|
||||||
|
|
||||||
|
# Solaris has socket in libsocket and inet_ntop in libnsl, but also needs libsocket, so the order is important here
|
||||||
|
AC_CHECK_LIB([socket], [socket], [NEEDS_SOCKET=yes], [])
|
||||||
|
if test -n "$NEEDS_SOCKET" ; then
|
||||||
|
AC_CHECK_LIB([nsl], [inet_ntop], [NEEDS_NSL=yes], [])
|
||||||
|
fi
|
||||||
|
if test -n "$NEEDS_SOCKET" && test -n "$NEEDS_NSL" ; then
|
||||||
|
LIBS="$LIBS -lsocket -lnsl"
|
||||||
|
elif test -n "$NEEDS_SOCKET" ; then
|
||||||
|
LIBS="$LIBS -lsocket"
|
||||||
|
elif test -n "$NEEDS_NSL" ; then
|
||||||
|
LIBS="$LIBS -lnsl"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for valgrind
|
# Check for valgrind
|
||||||
ac_enable_valgrind=no
|
ac_enable_valgrind=no
|
||||||
AC_ARG_ENABLE(valgrind-tests,
|
AC_ARG_ENABLE(valgrind-tests,
|
||||||
|
@ -207,6 +244,7 @@ AC_SUBST(PSL_TESTFILE)
|
||||||
|
|
||||||
# check for alloca / alloca.h
|
# check for alloca / alloca.h
|
||||||
AC_FUNC_ALLOCA
|
AC_FUNC_ALLOCA
|
||||||
|
AC_CHECK_FUNCS([strndup])
|
||||||
|
|
||||||
# Override the template file name of the generated .pc file, so that there
|
# Override the template file name of the generated .pc file, so that there
|
||||||
# is no need to rename the template file when the API version changes.
|
# is no need to rename the template file when the API version changes.
|
||||||
|
@ -215,8 +253,8 @@ AC_CONFIG_FILES([Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
tools/Makefile
|
tools/Makefile
|
||||||
po/Makefile.in
|
po/Makefile.in
|
||||||
docs/libpsl/Makefile
|
${docdir_makefile}
|
||||||
docs/libpsl/version.xml
|
${docdir_version_xml}
|
||||||
data/Makefile
|
data/Makefile
|
||||||
tests/Makefile
|
tests/Makefile
|
||||||
libpsl.pc:libpsl.pc.in])
|
libpsl.pc:libpsl.pc.in])
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
filesdir = $(datadir)/@PACKAGE@
|
filesdir = $(datadir)/@PACKAGE@
|
||||||
files_DATA = effective_tld_names.dat test_psl.txt
|
files_DATA = $(PSL_FILE) test_psl.txt
|
||||||
EXTRA_DIST = $(files_DATA)
|
EXTRA_DIST = $(files_DATA)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -113,9 +113,11 @@ if ENABLE_MAN
|
||||||
theMANS += libpsl.3
|
theMANS += libpsl.3
|
||||||
man_MANS += docs $(theMANS)
|
man_MANS += docs $(theMANS)
|
||||||
|
|
||||||
%.3:
|
# make distcheck -jn randomly breaks
|
||||||
#.xml.3:
|
.NOTPARALLEL:
|
||||||
@file=xml/`echo $@|cut -d'.' -f1`.xml; \
|
|
||||||
|
%.3: sgml-build.stamp
|
||||||
|
@file=xml/`basename $@|cut -d'.' -f1`.xml; \
|
||||||
@XSLTPROC@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $$file
|
@XSLTPROC@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $$file
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -27,10 +27,10 @@ if BUILTIN_GENERATOR_LIBICU
|
||||||
psl2c_LDADD = -licuuc
|
psl2c_LDADD = -licuuc
|
||||||
endif
|
endif
|
||||||
if BUILTIN_GENERATOR_LIBIDN2
|
if BUILTIN_GENERATOR_LIBIDN2
|
||||||
psl2c_LDADD = -lidn2 -lunistring
|
psl2c_LDADD = @LTLIBICONV@ -lidn2 -lunistring
|
||||||
endif
|
endif
|
||||||
if BUILTIN_GENERATOR_LIBIDN
|
if BUILTIN_GENERATOR_LIBIDN
|
||||||
psl2c_LDADD = -lidn -lunistring
|
psl2c_LDADD = @LTLIBICONV@ -lidn -lunistring
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Build rule for suffix.c
|
# Build rule for suffix.c
|
||||||
|
|
33
src/psl.c
33
src/psl.c
|
@ -93,11 +93,27 @@
|
||||||
/* number of elements within an array */
|
/* number of elements within an array */
|
||||||
#define countof(a) (sizeof(a)/sizeof(*(a)))
|
#define countof(a) (sizeof(a)/sizeof(*(a)))
|
||||||
|
|
||||||
|
#ifndef HAVE_STRNDUP
|
||||||
|
// I found no strndup on my old SUSE 7.3 test system (gcc 2.95)
|
||||||
|
|
||||||
|
static char *strndup(const char *s, size_t n)
|
||||||
|
{
|
||||||
|
char *dst = malloc(n + 1);
|
||||||
|
|
||||||
|
if (dst) {
|
||||||
|
memcpy(dst, s, n);
|
||||||
|
dst[n] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:libpsl
|
* SECTION:libpsl
|
||||||
* @short_description: Public Suffix List library functions
|
* @short_description: Public Suffix List library functions
|
||||||
* @title: libpsl
|
* @title: libpsl
|
||||||
* @stability: unstable
|
* @stability: Stable
|
||||||
* @include: libpsl.h
|
* @include: libpsl.h
|
||||||
*
|
*
|
||||||
* [Public Suffix List](http://publicsuffix.org/) library functions.
|
* [Public Suffix List](http://publicsuffix.org/) library functions.
|
||||||
|
@ -245,10 +261,10 @@ static int _suffix_compare(const _psl_entry_t *s1, const _psl_entry_t *s2)
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if ((n = s2->nlabels - s1->nlabels))
|
if ((n = s2->nlabels - s1->nlabels))
|
||||||
return n; // most labels first
|
return n; /* most labels first */
|
||||||
|
|
||||||
if ((n = s1->length - s2->length))
|
if ((n = s1->length - s2->length))
|
||||||
return n; // shorter rules first
|
return n; /* shorter rules first */
|
||||||
|
|
||||||
return strcmp(s1->label, s2->label ? s2->label : s2->label_buf);
|
return strcmp(s1->label, s2->label ? s2->label : s2->label_buf);
|
||||||
}
|
}
|
||||||
|
@ -481,9 +497,14 @@ const char *psl_registrable_domain(const psl_ctx_t *psl, const char *domain)
|
||||||
return regdom;
|
return regdom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int _isspace_ascii(const char c)
|
||||||
|
{
|
||||||
|
return c == ' ' || c == '\t' || c == '\r' || c == '\n';
|
||||||
|
}
|
||||||
|
|
||||||
static int _str_is_ascii(const char *s)
|
static int _str_is_ascii(const char *s)
|
||||||
{
|
{
|
||||||
while (*s > 0 && *s < 128) s++;
|
while (*s && *((unsigned char *)s) < 128) s++;
|
||||||
|
|
||||||
return !*s;
|
return !*s;
|
||||||
}
|
}
|
||||||
|
@ -664,14 +685,14 @@ psl_ctx_t *psl_load_fp(FILE *fp)
|
||||||
psl->suffix_exceptions = _vector_alloc(64, _suffix_compare_array);
|
psl->suffix_exceptions = _vector_alloc(64, _suffix_compare_array);
|
||||||
|
|
||||||
while ((linep = fgets(buf, sizeof(buf), fp))) {
|
while ((linep = fgets(buf, sizeof(buf), fp))) {
|
||||||
while (isspace(*linep)) linep++; /* ignore leading whitespace */
|
while (_isspace_ascii(*linep)) linep++; /* ignore leading whitespace */
|
||||||
if (!*linep) continue; /* skip empty lines */
|
if (!*linep) continue; /* skip empty lines */
|
||||||
|
|
||||||
if (*linep == '/' && linep[1] == '/')
|
if (*linep == '/' && linep[1] == '/')
|
||||||
continue; /* skip comments */
|
continue; /* skip comments */
|
||||||
|
|
||||||
/* parse suffix rule */
|
/* parse suffix rule */
|
||||||
for (p = linep; *linep && !isspace(*linep);) linep++;
|
for (p = linep; *linep && !_isspace_ascii(*linep);) linep++;
|
||||||
*linep = 0;
|
*linep = 0;
|
||||||
|
|
||||||
if (*p == '!') {
|
if (*p == '!') {
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#ifdef HAVE_ALLOCA_H
|
#ifdef HAVE_ALLOCA_H
|
||||||
# include <alloca.h>
|
# include <alloca.h>
|
||||||
|
@ -92,7 +91,7 @@ static void _print_psl_entries(FILE *fpout, const _psl_vector_t *v, const char *
|
||||||
#if !defined(WITH_LIBICU) && !defined(WITH_IDN2)
|
#if !defined(WITH_LIBICU) && !defined(WITH_IDN2)
|
||||||
static int _str_needs_encoding(const char *s)
|
static int _str_needs_encoding(const char *s)
|
||||||
{
|
{
|
||||||
while (*s > 0) s++;
|
while (*s && *((unsigned char *)s) < 128) s++;
|
||||||
|
|
||||||
return !!*s;
|
return !!*s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,11 @@ static int
|
||||||
ok,
|
ok,
|
||||||
failed;
|
failed;
|
||||||
|
|
||||||
|
static inline int _isspace_ascii(const char c)
|
||||||
|
{
|
||||||
|
return c == ' ' || c == '\t' || c == '\r' || c == '\n';
|
||||||
|
}
|
||||||
|
|
||||||
static void test_psl(void)
|
static void test_psl(void)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
@ -59,14 +64,14 @@ static void test_psl(void)
|
||||||
|
|
||||||
if ((fp = fopen(PSL_FILE, "r"))) {
|
if ((fp = fopen(PSL_FILE, "r"))) {
|
||||||
while ((linep = fgets(buf, sizeof(buf), fp))) {
|
while ((linep = fgets(buf, sizeof(buf), fp))) {
|
||||||
while (isspace(*linep)) linep++; /* ignore leading whitespace */
|
while (_isspace_ascii(*linep)) linep++; /* ignore leading whitespace */
|
||||||
if (!*linep) continue; /* skip empty lines */
|
if (!*linep) continue; /* skip empty lines */
|
||||||
|
|
||||||
if (*linep == '/' && linep[1] == '/')
|
if (*linep == '/' && linep[1] == '/')
|
||||||
continue; /* skip comments */
|
continue; /* skip comments */
|
||||||
|
|
||||||
/* parse suffix rule */
|
/* parse suffix rule */
|
||||||
for (p = linep; *linep && !isspace(*linep);) linep++;
|
for (p = linep; *linep && !_isspace_ascii(*linep);) linep++;
|
||||||
*linep = 0;
|
*linep = 0;
|
||||||
|
|
||||||
if (*p == '!') { /* an exception to a wildcard, e.g. !www.ck (wildcard is *.ck) */
|
if (*p == '!') { /* an exception to a wildcard, e.g. !www.ck (wildcard is *.ck) */
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
|
||||||
#ifdef HAVE_ALLOCA_H
|
#ifdef HAVE_ALLOCA_H
|
||||||
# include <alloca.h>
|
# include <alloca.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue