Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/c82049eb84250330b28b29fc327d12a4b5f8a77f
...commit
http://git.netsurf-browser.org/netsurf.git/commit/c82049eb84250330b28b29fc327d12a4b5f8a77f
...tree
http://git.netsurf-browser.org/netsurf.git/tree/c82049eb84250330b28b29fc327d12a4b5f8a77f
The branch, master has been updated
via c82049eb84250330b28b29fc327d12a4b5f8a77f (commit)
via 4745fcf1c78da101314252bd6ad65db5880434eb (commit)
from 4372104e0e0637265609befd5e92bf7e2aeaa8b4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=c82049eb84250330b28b29fc327d12a4b5f8a77f
commit c82049eb84250330b28b29fc327d12a4b5f8a77f
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
improve brackets in fallback timeval macros
diff --git a/utils/sys_time.h b/utils/sys_time.h
index fe8e5f6..c9ce820 100644
--- a/utils/sys_time.h
+++ b/utils/sys_time.h
@@ -31,7 +31,7 @@
#include <sys/time.h>
#ifndef timerclear
-#define timerclear(a) (a)->tv_sec = (a)->tv_usec = 0
+#define timerclear(a) ((a)->tv_sec = (a)->tv_usec = 0)
#endif
#ifndef timerisset
@@ -64,8 +64,8 @@
#ifndef timercmp
#define timercmp(a, aa, cmp) \
- ((a)->tv_sec cmp (aa)->tv_sec || \
- (a)->tv_sec == (aa)->tv_sec && (a)->tv_usec cmp (aa)->tv_usec)
+ (((a)->tv_sec cmp (aa)->tv_sec) || \
+ ((a)->tv_sec == (aa)->tv_sec && (a)->tv_usec cmp (aa)->tv_usec))
#endif
#endif
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=4745fcf1c78da101314252bd6ad65db5880434eb
commit 4745fcf1c78da101314252bd6ad65db5880434eb
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
add regex compatability to utils and enable it for serenity OS
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index c6f311a..6081e62 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -28,10 +28,10 @@
#include <string.h>
#include <strings.h>
#include <sys/types.h>
-#include <regex.h>
#include <dom/dom.h>
#include "utils/config.h"
+#include "utils/regex.h"
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/nsurl.h"
diff --git a/desktop/treeview.c b/desktop/treeview.c
index 258b54a..e8b4a14 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -26,11 +26,11 @@
#include <string.h>
+#include "utils/config.h"
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/nsurl.h"
#include "utils/nsoption.h"
-#include "utils/config.h"
#include "netsurf/bitmap.h"
#include "netsurf/content.h"
#include "netsurf/plotters.h"
diff --git a/utils/config.h b/utils/config.h
index 2f393dd..5678bea 100644
--- a/utils/config.h
+++ b/utils/config.h
@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _NETSURF_UTILS_CONFIG_H_
-#define _NETSURF_UTILS_CONFIG_H_
+#ifndef NETSURF_UTILS_CONFIG_H_
+#define NETSURF_UTILS_CONFIG_H_
#include <stddef.h>
@@ -35,10 +35,10 @@
char *strndup(const char *s, size_t n);
#endif
-#if (defined(_GNU_SOURCE) || \
- defined(__APPLE__) || \
- defined(__HAIKU__) || \
- defined(__OpenBSD__) &&\
+#if ((defined(_GNU_SOURCE) || \
+ defined(__APPLE__) || \
+ defined(__HAIKU__) || \
+ defined(__OpenBSD__)) && \
!defined(__serenity__))
#define HAVE_STRCASESTR
#else
@@ -68,14 +68,18 @@ char *strchrnul(const char *s, int c);
#endif
#define HAVE_SYS_SELECT
-#define HAVE_INETATON
#define HAVE_POSIX_INET_HEADERS
#if (defined(_WIN32))
-#undef HAVE_INETATON
#undef HAVE_SYS_SELECT
#undef HAVE_POSIX_INET_HEADERS
#endif
+#define HAVE_INETATON
+#if (defined(_WIN32) || \
+ defined(__serenity__))
+#undef HAVE_INETATON
+#endif
+
#define HAVE_INETPTON
#if (defined(_WIN32))
#undef HAVE_INETPTON
@@ -113,10 +117,16 @@ char *realpath(const char *path, char *resolved_path);
#endif
#define HAVE_SCANDIR
-#if (defined(_WIN32))
+#if (defined(_WIN32) || \
+ defined(__serenity__))
#undef HAVE_SCANDIR
#endif
+#define HAVE_REGEX
+#if (defined(__serenity__))
+#undef HAVE_REGEX
+#endif
+
/* This section toggles build options on and off.
* Simply undefine a symbol to turn the relevant feature off.
*
@@ -142,7 +152,7 @@ char *realpath(const char *path, char *resolved_path);
#define WITH_MMAP
#endif
-/* amiga */
+/* IPv6 */
#if (defined(__amigaos4__) || \
defined(__AMIGA__) || \
defined(nsatari) || \
diff --git a/utils/regex.h b/utils/regex.h
new file mode 100644
index 0000000..a415239
--- /dev/null
+++ b/utils/regex.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2019 Vincent Sanders <[email protected]>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NETSURF_UTILS_REGEX_H_
+#define NETSURF_UTILS_REGEX_H_
+
+#include "utils/config.h"
+
+#ifdef HAVE_REGEX
+#include <sys/types.h>
+#include <regex.h>
+#else
+
+#define REG_NOMATCH 1
+
+#define REG_EXTENDED 1
+#define REG_ICASE (1 << 1)
+#define REG_NEWLINE (1 << 2)
+#define REG_NOSUB (1 << 3)
+
+typedef ssize_t regoff_t;
+
+typedef struct {
+ size_t re_nsub; /* Number of parenthesized subexpressions.*/
+} regex_t;
+
+
+typedef struct {
+ regoff_t rm_so; /* Byte offset from start of string to start
+ * of substring.
+ */
+ regoff_t rm_eo; /* Byte offset from start of string of the
+ * first character after the end of substring.
+ */
+} regmatch_t;
+
+
+int regcomp(regex_t *restrict preg, const char *restrictregex, int cflags);
+
+size_t regerror(int errorcode, const regex_t *restrict preg, char *restrict
errbuf, size_t errbuf_size);
+
+int regexec(const regex_t *restrict preg, const char *restrict string, size_t
nmatch, regmatch_t pmatch[restrict], int eflags);
+
+void regfree(regex_t *preg);
+
+#endif
+
+#endif
diff --git a/utils/utils.c b/utils/utils.c
index 15c91c6..aec0116 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -24,7 +24,9 @@
#include <stdio.h>
#include <string.h>
#include <strings.h>
+#include <sys/types.h>
#include <sys/stat.h>
+#include <unistd.h>
#include "utils/messages.h"
#include "utils/dirent.h"
@@ -172,6 +174,7 @@ nserror vsnstrjoin(char **str, size_t *size, char sep,
size_t nelm, va_list ap)
return NSERROR_OK;
}
+
/* exported interface documented in utils/utils.h */
nserror snstrjoin(char **str, size_t *size, char sep, size_t nelm, ...)
{
@@ -263,12 +266,12 @@ char *strcasestr(const char *haystack, const char *needle)
#endif
+
#ifndef HAVE_STRNDUP
/**
* Duplicate up to n characters of a string.
*/
-
char *strndup(const char *s, size_t n)
{
size_t len;
@@ -393,6 +396,7 @@ char *strchrnul (const char *s, int c_in)
#endif
#ifndef HAVE_UTSNAME
+
#include "utils/utsname.h"
int uname(struct utsname *buf) {
@@ -404,9 +408,11 @@ int uname(struct utsname *buf) {
return 0;
}
+
#endif
#ifndef HAVE_REALPATH
+
char *realpath(const char *path, char *resolved_path)
{
char *ret;
@@ -419,8 +425,9 @@ char *realpath(const char *path, char *resolved_path)
return ret;
}
-#ifndef HAVE_INETATON
+#endif
+#ifndef HAVE_INETATON
int inet_aton(const char *cp, struct in_addr *inp)
{
@@ -470,4 +477,40 @@ int inet_pton(int af, const char *src, void *dst)
#endif
+#ifndef HAVE_REGEX
+
+#include "utils/regex.h"
+
+int
+regcomp(regex_t *restrict preg, const char *restrictregex, int cflags)
+{
+ return 0;
+}
+
+size_t
+regerror(int errorcode,
+ const regex_t *restrict preg,
+ char *restrict errbuf,
+ size_t errbuf_size)
+{
+ if ((errbuf != NULL) && (errbuf_size != 0)) {
+ *errbuf = 0;
+ }
+ return 0;
+}
+
+int
+regexec(const regex_t *restrict preg,
+ const char *restrict string,
+ size_t nmatch,
+ regmatch_t pmatch[restrict],
+ int eflags)
+{
+ return REG_NOMATCH;
+}
+
+void regfree(regex_t *preg)
+{
+}
+
#endif
-----------------------------------------------------------------------
Summary of changes:
desktop/save_complete.c | 2 +-
desktop/treeview.c | 2 +-
utils/config.h | 30 ++++++++++++++--------
utils/regex.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++
utils/sys_time.h | 6 ++---
utils/utils.c | 47 +++++++++++++++++++++++++++++++++--
6 files changed, 133 insertions(+), 17 deletions(-)
create mode 100644 utils/regex.h
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index c6f311a..6081e62 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -28,10 +28,10 @@
#include <string.h>
#include <strings.h>
#include <sys/types.h>
-#include <regex.h>
#include <dom/dom.h>
#include "utils/config.h"
+#include "utils/regex.h"
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/nsurl.h"
diff --git a/desktop/treeview.c b/desktop/treeview.c
index 258b54a..e8b4a14 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -26,11 +26,11 @@
#include <string.h>
+#include "utils/config.h"
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/nsurl.h"
#include "utils/nsoption.h"
-#include "utils/config.h"
#include "netsurf/bitmap.h"
#include "netsurf/content.h"
#include "netsurf/plotters.h"
diff --git a/utils/config.h b/utils/config.h
index 2f393dd..5678bea 100644
--- a/utils/config.h
+++ b/utils/config.h
@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _NETSURF_UTILS_CONFIG_H_
-#define _NETSURF_UTILS_CONFIG_H_
+#ifndef NETSURF_UTILS_CONFIG_H_
+#define NETSURF_UTILS_CONFIG_H_
#include <stddef.h>
@@ -35,10 +35,10 @@
char *strndup(const char *s, size_t n);
#endif
-#if (defined(_GNU_SOURCE) || \
- defined(__APPLE__) || \
- defined(__HAIKU__) || \
- defined(__OpenBSD__) &&\
+#if ((defined(_GNU_SOURCE) || \
+ defined(__APPLE__) || \
+ defined(__HAIKU__) || \
+ defined(__OpenBSD__)) && \
!defined(__serenity__))
#define HAVE_STRCASESTR
#else
@@ -68,14 +68,18 @@ char *strchrnul(const char *s, int c);
#endif
#define HAVE_SYS_SELECT
-#define HAVE_INETATON
#define HAVE_POSIX_INET_HEADERS
#if (defined(_WIN32))
-#undef HAVE_INETATON
#undef HAVE_SYS_SELECT
#undef HAVE_POSIX_INET_HEADERS
#endif
+#define HAVE_INETATON
+#if (defined(_WIN32) || \
+ defined(__serenity__))
+#undef HAVE_INETATON
+#endif
+
#define HAVE_INETPTON
#if (defined(_WIN32))
#undef HAVE_INETPTON
@@ -113,10 +117,16 @@ char *realpath(const char *path, char *resolved_path);
#endif
#define HAVE_SCANDIR
-#if (defined(_WIN32))
+#if (defined(_WIN32) || \
+ defined(__serenity__))
#undef HAVE_SCANDIR
#endif
+#define HAVE_REGEX
+#if (defined(__serenity__))
+#undef HAVE_REGEX
+#endif
+
/* This section toggles build options on and off.
* Simply undefine a symbol to turn the relevant feature off.
*
@@ -142,7 +152,7 @@ char *realpath(const char *path, char *resolved_path);
#define WITH_MMAP
#endif
-/* amiga */
+/* IPv6 */
#if (defined(__amigaos4__) || \
defined(__AMIGA__) || \
defined(nsatari) || \
diff --git a/utils/regex.h b/utils/regex.h
new file mode 100644
index 0000000..a415239
--- /dev/null
+++ b/utils/regex.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2019 Vincent Sanders <[email protected]>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NETSURF_UTILS_REGEX_H_
+#define NETSURF_UTILS_REGEX_H_
+
+#include "utils/config.h"
+
+#ifdef HAVE_REGEX
+#include <sys/types.h>
+#include <regex.h>
+#else
+
+#define REG_NOMATCH 1
+
+#define REG_EXTENDED 1
+#define REG_ICASE (1 << 1)
+#define REG_NEWLINE (1 << 2)
+#define REG_NOSUB (1 << 3)
+
+typedef ssize_t regoff_t;
+
+typedef struct {
+ size_t re_nsub; /* Number of parenthesized subexpressions.*/
+} regex_t;
+
+
+typedef struct {
+ regoff_t rm_so; /* Byte offset from start of string to start
+ * of substring.
+ */
+ regoff_t rm_eo; /* Byte offset from start of string of the
+ * first character after the end of substring.
+ */
+} regmatch_t;
+
+
+int regcomp(regex_t *restrict preg, const char *restrictregex, int cflags);
+
+size_t regerror(int errorcode, const regex_t *restrict preg, char *restrict
errbuf, size_t errbuf_size);
+
+int regexec(const regex_t *restrict preg, const char *restrict string, size_t
nmatch, regmatch_t pmatch[restrict], int eflags);
+
+void regfree(regex_t *preg);
+
+#endif
+
+#endif
diff --git a/utils/sys_time.h b/utils/sys_time.h
index fe8e5f6..c9ce820 100644
--- a/utils/sys_time.h
+++ b/utils/sys_time.h
@@ -31,7 +31,7 @@
#include <sys/time.h>
#ifndef timerclear
-#define timerclear(a) (a)->tv_sec = (a)->tv_usec = 0
+#define timerclear(a) ((a)->tv_sec = (a)->tv_usec = 0)
#endif
#ifndef timerisset
@@ -64,8 +64,8 @@
#ifndef timercmp
#define timercmp(a, aa, cmp) \
- ((a)->tv_sec cmp (aa)->tv_sec || \
- (a)->tv_sec == (aa)->tv_sec && (a)->tv_usec cmp (aa)->tv_usec)
+ (((a)->tv_sec cmp (aa)->tv_sec) || \
+ ((a)->tv_sec == (aa)->tv_sec && (a)->tv_usec cmp (aa)->tv_usec))
#endif
#endif
diff --git a/utils/utils.c b/utils/utils.c
index 15c91c6..aec0116 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -24,7 +24,9 @@
#include <stdio.h>
#include <string.h>
#include <strings.h>
+#include <sys/types.h>
#include <sys/stat.h>
+#include <unistd.h>
#include "utils/messages.h"
#include "utils/dirent.h"
@@ -172,6 +174,7 @@ nserror vsnstrjoin(char **str, size_t *size, char sep,
size_t nelm, va_list ap)
return NSERROR_OK;
}
+
/* exported interface documented in utils/utils.h */
nserror snstrjoin(char **str, size_t *size, char sep, size_t nelm, ...)
{
@@ -263,12 +266,12 @@ char *strcasestr(const char *haystack, const char *needle)
#endif
+
#ifndef HAVE_STRNDUP
/**
* Duplicate up to n characters of a string.
*/
-
char *strndup(const char *s, size_t n)
{
size_t len;
@@ -393,6 +396,7 @@ char *strchrnul (const char *s, int c_in)
#endif
#ifndef HAVE_UTSNAME
+
#include "utils/utsname.h"
int uname(struct utsname *buf) {
@@ -404,9 +408,11 @@ int uname(struct utsname *buf) {
return 0;
}
+
#endif
#ifndef HAVE_REALPATH
+
char *realpath(const char *path, char *resolved_path)
{
char *ret;
@@ -419,8 +425,9 @@ char *realpath(const char *path, char *resolved_path)
return ret;
}
-#ifndef HAVE_INETATON
+#endif
+#ifndef HAVE_INETATON
int inet_aton(const char *cp, struct in_addr *inp)
{
@@ -470,4 +477,40 @@ int inet_pton(int af, const char *src, void *dst)
#endif
+#ifndef HAVE_REGEX
+
+#include "utils/regex.h"
+
+int
+regcomp(regex_t *restrict preg, const char *restrictregex, int cflags)
+{
+ return 0;
+}
+
+size_t
+regerror(int errorcode,
+ const regex_t *restrict preg,
+ char *restrict errbuf,
+ size_t errbuf_size)
+{
+ if ((errbuf != NULL) && (errbuf_size != 0)) {
+ *errbuf = 0;
+ }
+ return 0;
+}
+
+int
+regexec(const regex_t *restrict preg,
+ const char *restrict string,
+ size_t nmatch,
+ regmatch_t pmatch[restrict],
+ int eflags)
+{
+ return REG_NOMATCH;
+}
+
+void regfree(regex_t *preg)
+{
+}
+
#endif
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org