]> granicus.if.org Git - libevent/commitdiff
rename strlcpy so that it does not conflict with other tests; from
authorNiels Provos <provos@gmail.com>
Wed, 3 Jan 2007 07:11:17 +0000 (07:11 +0000)
committerNiels Provos <provos@gmail.com>
Wed, 3 Jan 2007 07:11:17 +0000 (07:11 +0000)
Nick Mathewson.

svn:r306

Makefile.am
configure.in
http.c
strlcpy-internal.h [new file with mode: 0644]
strlcpy.c
test/regress_http.c

index 92bb97d853ea2ebd1e53adfd910076fd2f0fdde3..ab590b1846d5709f1a34628cc1c7cd499f9cacee 100644 (file)
@@ -40,8 +40,8 @@ SYS_INCLUDES =
 endif
 
 libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c event_tagging.c \
-       http.c evhttp.h http-internal.h evdns.c evdns.h evrpc.c \
-       evrpc.h evrpc-internal.h $(SYS_SRC)
+       http.c evhttp.h http-internal.h evdns.c evdns.h evrpc.c strlcpy.c \
+       evrpc.h evrpc-internal.h strlcpy-internal.h $(SYS_SRC)
 libevent_la_LIBADD = @LTLIBOBJS@ $(SYS_LIBS)
 libevent_la_LDFLAGS = -release @VERSION@ -version-info 1:3:0
 
index ddcde2fb2410a0baf4adfa501f6b274d04a9a5de..947f5e74fdae0e92a32d7770fff8689fc44a7206 100644 (file)
@@ -132,8 +132,7 @@ AC_C_INLINE
 AC_HEADER_TIME
 
 dnl Checks for library functions.
-AC_CHECK_FUNCS(gettimeofday vasprintf fcntl clock_gettime strtok_r strsep getaddrinfo getnameinfo)
-AC_REPLACE_FUNCS(strlcpy)
+AC_CHECK_FUNCS(gettimeofday vasprintf fcntl clock_gettime strtok_r strsep getaddrinfo getnameinfo strlcpy)
 
 if test "x$ac_cv_func_clock_gettime" = "xyes"; then
    AC_DEFINE(DNS_USE_CPU_CLOCK_FOR_ID, 1, [Define if clock_gettime is available in libc])
diff --git a/http.c b/http.c
index 212f189c40170ece06fba10e6575319fafa69bfe..bdc7b491d9113dce7ca5168c2c1927ebb380e789 100644 (file)
--- a/http.c
+++ b/http.c
@@ -73,6 +73,7 @@
 #undef timeout_pending
 #undef timeout_initialized
 
+#include "strlcpy-internal.h"
 #include "event.h"
 #include "evhttp.h"
 #include "log.h"
diff --git a/strlcpy-internal.h b/strlcpy-internal.h
new file mode 100644 (file)
index 0000000..22b5f61
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef _STRLCPY_INTERNAL_H_
+#define _STRLCPY_INTERNAL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#ifndef HAVE_STRLCPY
+#include <string.h>
+size_t _event_strlcpy(char *dst, const char *src, size_t siz);
+#define strlcpy _event_strlcpy
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
index 163f4258381cc42cab88959b1c71ecb9c54a4ba9..5d194527c8caa929af40703a004699fbf5b622f1 100644 (file)
--- a/strlcpy.c
+++ b/strlcpy.c
@@ -37,7 +37,8 @@ static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-#include <string.h>
+#ifndef HAVE_STRLCPY
+#include "strlcpy-internal.h"
 
 /*
  * Copy src to string dst of size siz.  At most siz-1 characters
@@ -45,7 +46,7 @@ static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp
  * Returns strlen(src); if retval >= siz, truncation occurred.
  */
 size_t
-strlcpy(dst, src, siz)
+_event_strlcpy(dst, src, siz)
        char *dst;
        const char *src;
        size_t siz;
@@ -72,3 +73,4 @@ strlcpy(dst, src, siz)
 
        return(s - src - 1);    /* count does not include NUL */
 }
+#endif
index c651bda53c33e07195e3bd20275479f0853e1fd5..42f6b7e52d2f297710311d3bef81fc5d98822868 100644 (file)
@@ -128,7 +128,7 @@ http_readcb(struct bufferevent *bev, void *arg)
 
        event_debug(("%s: %s\n", __func__, EVBUFFER_DATA(bev->input)));
        
-       if (evbuffer_find(bev->input, what, strlen(what)) != NULL) {
+       if (evbuffer_find(bev->input, (const unsigned char*) what, strlen(what)) != NULL) {
                struct evhttp_request *req = evhttp_request_new(NULL, NULL);
                req->kind = EVHTTP_RESPONSE;
                int done = evhttp_parse_lines(req, bev->input);
@@ -445,7 +445,7 @@ void
 http_failure_readcb(struct bufferevent *bev, void *arg)
 {
        const char *what = "400 Bad Request";
-       if (evbuffer_find(bev->input, what, strlen(what)) != NULL) {
+       if (evbuffer_find(bev->input, (const unsigned char*) what, strlen(what)) != NULL) {
                test_ok = 2;
                bufferevent_disable(bev, EV_READ);
                event_loopexit(NULL);