remove _GNU_SOURCE define from everywhere.

strndup is not standard so provide an implementation.

svn path=/trunk/netsurf/; revision=10474
This commit is contained in:
Vincent Sanders 2010-04-24 15:22:17 +00:00
parent fe151c135d
commit 03bb3e8636
22 changed files with 13 additions and 39 deletions

View File

@ -19,8 +19,6 @@
/* rsrc: URL handling. */
#define _GNU_SOURCE
#define __STDBOOL_H__ 1
#include <assert.h>
#include <errno.h>

View File

@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _GNU_SOURCE /* for strndup */
#define __STDBOOL_H__ 1
#include <assert.h>
#include <ctype.h>

View File

@ -17,8 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _GNU_SOURCE
#define __STDBOOL_H__ 1
#include <ctype.h>
#include <stdio.h>

View File

@ -18,8 +18,6 @@
/* data: URL handling. See http://tools.ietf.org/html/rfc2397 */
#define _GNU_SOURCE
#include <assert.h>
#include <errno.h>
#include <stdbool.h>

View File

@ -20,7 +20,6 @@
* Low-level resource cache (implementation)
*/
#define _GNU_SOURCE /* For strndup. Ugh. */
#include <stdlib.h>
#include <string.h>
#include <time.h>

View File

@ -86,7 +86,6 @@
* potential crashes.
*/
#define _GNU_SOURCE /* For strndup */
#include <assert.h>
#include <ctype.h>
#include <stdbool.h>

View File

@ -157,11 +157,14 @@ struct browser_window *browser_window_create(const char *url,
bw->no_resize = true;
bw->last_action = wallclock();
bw->window = gui_create_browser_window(bw, clone, new_tab);
/* gui window */
if ((bw->window = gui_create_browser_window(bw, clone, new_tab)) == NULL) {
if (bw->window == NULL) {
browser_window_destroy(bw);
return NULL;
}
if (url)
browser_window_go(bw, url, referer, history_add);

View File

@ -1,4 +1,4 @@
/*
#/*
* Copyright 2004 John M Bell <jmb202@ecs.soton.ac.uk>
* Copyright 2004-2007 James Bursa <bursa@users.sourceforge.net>
*
@ -23,7 +23,6 @@
#include "utils/config.h"
#define _GNU_SOURCE /* for strndup */
#include <assert.h>
#include <ctype.h>
#include <errno.h>

View File

@ -28,9 +28,13 @@
typedef struct fbtk_widget_s fbtk_widget_t;
enum fbtk_callback_info_type {
FBTK_CBIT_NONE,
FBTK_CBIT_SCROLLX,
FBTK_CBIT_SCROLLX = 0,
FBTK_CBIT_SCROLLY,
FBTK_CBIT_CLICK,
FBTK_CBIT_INPUT,
FBTK_CBIT_MOVE,
FBTK_CBIT_REDRAW,
FBTK_CBIT_END,
};
typedef struct fbtk_callback_info {

View File

@ -23,7 +23,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _GNU_SOURCE /* for strndup */
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>

View File

@ -24,7 +24,6 @@
* Conversion of XML tree to box tree (implementation).
*/
#define _GNU_SOURCE /* for strndup */
#include <assert.h>
#include <ctype.h>
#include <stdio.h>

View File

@ -23,7 +23,6 @@
* Form handling functions (implementation).
*/
#define _GNU_SOURCE /* for strndup */
#include <assert.h>
#include <ctype.h>
#include <limits.h>

View File

@ -20,8 +20,6 @@
* Content for text/html (implementation).
*/
#define _GNU_SOURCE /* for strndup() */
#include <assert.h>
#include <ctype.h>
#include <stdint.h>

View File

@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _GNU_SOURCE /* for strndup */
#include <assert.h>
#include <stdbool.h>
#include <string.h>

View File

@ -31,7 +31,6 @@
* layout_minmax_X() and layout_X().
*/
#define _GNU_SOURCE /* for strndup */
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

View File

@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _GNU_SOURCE /* for strnlen */
#include <stdlib.h>
#include <string.h>

View File

@ -20,7 +20,6 @@
* UCS conversion tables and RISC OS-specific UTF-8 text handling
*/
#define _GNU_SOURCE /* for strndup */
#include <assert.h>
#include <limits.h>
#include <string.h>

View File

@ -26,7 +26,6 @@
#include "utils/config.h"
#define _GNU_SOURCE /* for strndup */
#include <ctype.h>
#include <stdio.h>
#include <string.h>

View File

@ -23,19 +23,10 @@
/* Try to detect which features the target OS supports */
#define HAVE_STRNDUP
#if defined(__FreeBSD__) || (defined(__SRV4) && defined(__sun)) || \
defined(__APPLE__) || defined(__HAIKU__) || defined(__BEOS__) \
|| defined(__OpenBSD__) || defined(_WIN32)
/* FreeBSD and Solaris do not have this function, so
* we implement it ourselves in util.c
*/
#undef HAVE_STRNDUP
char *strndup(const char *s, size_t n);
#endif
#define HAVE_STRCASESTR
#if (!(defined(_GNU_SOURCE) || defined(__NetBSD__) || defined(__OpenBSD__)) \
#if (!(defined(__NetBSD__) || defined(__OpenBSD__)) \
|| defined(riscos) || defined(__APPLE__) || defined(_WIN32))
#undef HAVE_STRCASESTR
char *strcasestr(const char *haystack, const char *needle);
@ -64,7 +55,7 @@ char *strcasestr(const char *haystack, const char *needle);
#define HAVE_STRCHRNUL
/* For some reason, UnixLib defines this unconditionally.
* Assume we're using UnixLib if building for RISC OS. */
#if !(defined(_GNU_SOURCE) || defined(riscos))
#if !(defined(riscos))
#undef HAVE_STRCHRNUL
char *strchrnul(const char *s, int c);
#endif

View File

@ -22,7 +22,6 @@
* URL parsing and joining (implementation).
*/
#define _GNU_SOURCE /* for strdup() */
#include <sys/types.h>
#include <assert.h>
#include <ctype.h>

View File

@ -20,7 +20,6 @@
* UTF-8 manipulation functions (implementation).
*/
#define _GNU_SOURCE /* for strndup */
#include <assert.h>
#include <errno.h>
#include <stdlib.h>

View File

@ -295,7 +295,6 @@ char *strcasestr(const char *haystack, const char *needle)
#endif
#ifndef HAVE_STRNDUP
/**
* Duplicate up to n characters of a string.
@ -318,7 +317,6 @@ char *strndup(const char *s, size_t n)
return s2;
}
#endif
#ifndef HAVE_STRCHRNUL