aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2010-02-22 18:56:29 +0000
committerYang Tse <yangsita@gmail.com>2010-02-22 18:56:29 +0000
commit439f62bfa8fff1b6370c286f4e06775aa81661bc (patch)
tree2b63d28f849d4b9dce83325af286b6b4010c40e0
parent693abbae3a20eaadc36759b89722fd2d38b95004 (diff)
convert Curl_ultous() and Curl_ultouc() functions to curlx_ultous() and
curlx_ultouc(), exposing them through curlx.h to allow proper code reuse later in our test harness.
-rw-r--r--lib/base64.c6
-rw-r--r--lib/curlx.h7
-rw-r--r--lib/warnless.c4
-rw-r--r--lib/warnless.h4
-rw-r--r--tests/server/Makefile.inc113
-rw-r--r--tests/server/rtspd.c3
-rw-r--r--tests/server/sockfilt.c5
-rw-r--r--tests/server/sws.c3
-rw-r--r--tests/server/tftpd.c3
9 files changed, 56 insertions, 92 deletions
diff --git a/lib/base64.c b/lib/base64.c
index fd0340dd3..2361d9e75 100644
--- a/lib/base64.c
+++ b/lib/base64.c
@@ -71,11 +71,11 @@ static void decodeQuantum(unsigned char *dest, const char *src)
x = (x << 6);
}
- dest[2] = Curl_ultouc(x);
+ dest[2] = curlx_ultouc(x);
x >>= 8;
- dest[1] = Curl_ultouc(x);
+ dest[1] = curlx_ultouc(x);
x >>= 8;
- dest[0] = Curl_ultouc(x);
+ dest[0] = curlx_ultouc(x);
}
/*
diff --git a/lib/curlx.h b/lib/curlx.h
index 1e03a05fc..1f84e6d0a 100644
--- a/lib/curlx.h
+++ b/lib/curlx.h
@@ -56,6 +56,13 @@
#include "nonblock.h"
/* "nonblock.h" provides curlx_nonblock() */
+#include "warnless.h"
+/* "warnless.h" provides functions:
+
+ curlx_ultous()
+ curlx_ultouc()
+*/
+
/* Now setup curlx_ * names for the functions that are to become curlx_ and
be removed from a future libcurl official API:
curlx_getenv
diff --git a/lib/warnless.c b/lib/warnless.c
index 94e77de46..ffbcaa3f1 100644
--- a/lib/warnless.c
+++ b/lib/warnless.c
@@ -25,7 +25,7 @@
#include "warnless.h"
-unsigned short Curl_ultous(unsigned long ulnum)
+unsigned short curlx_ultous(unsigned long ulnum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
@@ -39,7 +39,7 @@ unsigned short Curl_ultous(unsigned long ulnum)
#endif
}
-unsigned char Curl_ultouc(unsigned long ulnum)
+unsigned char curlx_ultouc(unsigned long ulnum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
diff --git a/lib/warnless.h b/lib/warnless.h
index d8734910a..0976088cd 100644
--- a/lib/warnless.h
+++ b/lib/warnless.h
@@ -23,8 +23,8 @@
* $Id$
***************************************************************************/
-unsigned short Curl_ultous(unsigned long ulnum);
+unsigned short curlx_ultous(unsigned long ulnum);
-unsigned char Curl_ultouc(unsigned long ulnum);
+unsigned char curlx_ultouc(unsigned long ulnum);
#endif /* HEADER_CURL_WARNLESS_H */
diff --git a/tests/server/Makefile.inc b/tests/server/Makefile.inc
index 88c5ccfaa..94e9e7514 100644
--- a/tests/server/Makefile.inc
+++ b/tests/server/Makefile.inc
@@ -1,100 +1,61 @@
noinst_PROGRAMS = getpart resolve rtspd sockfilt sws tftpd
-getpart_SOURCES = testpart.c \
- getpart.c \
- getpart.h \
- $(top_srcdir)/lib/base64.c \
- $(top_srcdir)/lib/base64.h \
- $(top_srcdir)/lib/curlx.h \
- $(top_srcdir)/lib/memdebug.c \
- $(top_srcdir)/lib/memdebug.h \
+CURLX_SRCS = \
$(top_srcdir)/lib/mprintf.c \
- $(top_srcdir)/lib/warnless.c \
+ $(top_srcdir)/lib/nonblock.c \
+ $(top_srcdir)/lib/strequal.c \
+ $(top_srcdir)/lib/strtoofft.c \
+ $(top_srcdir)/lib/timeval.c \
+ $(top_srcdir)/lib/warnless.c
+
+CURLX_HDRS = \
+ $(top_srcdir)/lib/curlx.h \
+ $(top_srcdir)/lib/nonblock.h \
+ $(top_srcdir)/lib/strequal.h \
+ $(top_srcdir)/lib/strtoofft.h \
+ $(top_srcdir)/lib/timeval.h \
$(top_srcdir)/lib/warnless.h
-getpart_LDADD = @TEST_SERVER_LIBS@
-getpart_CFLAGS = $(AM_CFLAGS)
-resolve_SOURCES = resolve.c \
+USEFUL = \
getpart.c \
getpart.h \
$(top_srcdir)/lib/base64.c \
$(top_srcdir)/lib/base64.h \
- $(top_srcdir)/lib/curlx.h \
$(top_srcdir)/lib/memdebug.c \
- $(top_srcdir)/lib/memdebug.h \
- $(top_srcdir)/lib/mprintf.c \
- $(top_srcdir)/lib/warnless.c \
- $(top_srcdir)/lib/warnless.h
+ $(top_srcdir)/lib/memdebug.h
+
+UTIL = \
+ util.c \
+ util.h
+
+getpart_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) \
+ testpart.c
+getpart_LDADD = @TEST_SERVER_LIBS@
+getpart_CFLAGS = $(AM_CFLAGS)
+
+resolve_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \
+ resolve.c
resolve_LDADD = @TEST_SERVER_LIBS@
resolve_CFLAGS = $(AM_CFLAGS)
-rtspd_SOURCES = rtspd.c \
- getpart.c \
- getpart.h \
- util.c \
- util.h \
- $(top_srcdir)/lib/base64.c \
- $(top_srcdir)/lib/base64.h \
- $(top_srcdir)/lib/curlx.h \
- $(top_srcdir)/lib/memdebug.c \
- $(top_srcdir)/lib/memdebug.h \
- $(top_srcdir)/lib/mprintf.c \
- $(top_srcdir)/lib/strequal.c \
- $(top_srcdir)/lib/timeval.c \
- $(top_srcdir)/lib/warnless.c \
- $(top_srcdir)/lib/warnless.h
+rtspd_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \
+ rtspd.c
rtspd_LDADD = @TEST_SERVER_LIBS@
rtspd_CFLAGS = $(AM_CFLAGS)
-sockfilt_SOURCES = sockfilt.c \
- getpart.c \
- getpart.h \
- util.c \
- util.h \
- $(top_srcdir)/lib/base64.c \
- $(top_srcdir)/lib/base64.h \
- $(top_srcdir)/lib/curlx.h \
- $(top_srcdir)/lib/inet_pton.c \
- $(top_srcdir)/lib/memdebug.c \
- $(top_srcdir)/lib/memdebug.h \
- $(top_srcdir)/lib/mprintf.c \
- $(top_srcdir)/lib/timeval.c \
- $(top_srcdir)/lib/warnless.c \
- $(top_srcdir)/lib/warnless.h
+sockfilt_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \
+ sockfilt.c \
+ $(top_srcdir)/lib/inet_pton.c
sockfilt_LDADD = @TEST_SERVER_LIBS@
sockfilt_CFLAGS = $(AM_CFLAGS)
-sws_SOURCES = sws.c \
- getpart.c \
- getpart.h \
- util.c \
- util.h \
- $(top_srcdir)/lib/base64.c \
- $(top_srcdir)/lib/base64.h \
- $(top_srcdir)/lib/curlx.h \
- $(top_srcdir)/lib/memdebug.c \
- $(top_srcdir)/lib/memdebug.h \
- $(top_srcdir)/lib/mprintf.c \
- $(top_srcdir)/lib/strequal.c \
- $(top_srcdir)/lib/timeval.c \
- $(top_srcdir)/lib/warnless.c \
- $(top_srcdir)/lib/warnless.h
+sws_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \
+ sws.c
sws_LDADD = @TEST_SERVER_LIBS@
sws_CFLAGS = $(AM_CFLAGS)
-tftpd_SOURCES = tftpd.c tftp.h \
- getpart.c \
- getpart.h \
- util.c \
- util.h \
- $(top_srcdir)/lib/base64.c \
- $(top_srcdir)/lib/base64.h \
- $(top_srcdir)/lib/curlx.h \
- $(top_srcdir)/lib/memdebug.c \
- $(top_srcdir)/lib/memdebug.h \
- $(top_srcdir)/lib/mprintf.c \
- $(top_srcdir)/lib/timeval.c \
- $(top_srcdir)/lib/warnless.c \
- $(top_srcdir)/lib/warnless.h
+tftpd_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \
+ tftpd.c \
+ tftp.h
tftpd_LDADD = @TEST_SERVER_LIBS@
tftpd_CFLAGS = $(AM_CFLAGS)
diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c
index 4c5e6a107..4d2c639be 100644
--- a/tests/server/rtspd.c
+++ b/tests/server/rtspd.c
@@ -59,7 +59,6 @@
#include "curlx.h" /* from the private lib dir */
#include "getpart.h"
#include "util.h"
-#include "warnless.h"
/* include memdebug.h last */
#include "memdebug.h"
@@ -1235,7 +1234,7 @@ int main(int argc, char *argv[])
argv[arg]);
return 0;
}
- port = Curl_ultous(ulnum);
+ port = curlx_ultous(ulnum);
arg++;
}
}
diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c
index 50e91f41d..63c0c663c 100644
--- a/tests/server/sockfilt.c
+++ b/tests/server/sockfilt.c
@@ -110,7 +110,6 @@
#include "getpart.h"
#include "inet_pton.h"
#include "util.h"
-#include "warnless.h"
/* include memdebug.h last */
#include "memdebug.h"
@@ -899,7 +898,7 @@ int main(int argc, char *argv[])
argv[arg]);
return 0;
}
- port = Curl_ultous(ulnum);
+ port = curlx_ultous(ulnum);
arg++;
}
}
@@ -916,7 +915,7 @@ int main(int argc, char *argv[])
argv[arg]);
return 0;
}
- connectport = Curl_ultous(ulnum);
+ connectport = curlx_ultous(ulnum);
arg++;
}
}
diff --git a/tests/server/sws.c b/tests/server/sws.c
index 14058e548..56345c1e5 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -60,7 +60,6 @@
#include "curlx.h" /* from the private lib dir */
#include "getpart.h"
#include "util.h"
-#include "warnless.h"
/* include memdebug.h last */
#include "memdebug.h"
@@ -1139,7 +1138,7 @@ int main(int argc, char *argv[])
argv[arg]);
return 0;
}
- port = Curl_ultous(ulnum);
+ port = curlx_ultous(ulnum);
arg++;
}
}
diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c
index 97669896c..a06b815b7 100644
--- a/tests/server/tftpd.c
+++ b/tests/server/tftpd.c
@@ -97,7 +97,6 @@
#include "curlx.h" /* from the private lib dir */
#include "getpart.h"
#include "util.h"
-#include "warnless.h"
/* include memdebug.h last */
#include "memdebug.h"
@@ -717,7 +716,7 @@ int main(int argc, char **argv)
argv[arg]);
return 0;
}
- port = Curl_ultous(ulnum);
+ port = curlx_ultous(ulnum);
arg++;
}
}