Commit 7d22ce55 authored by Yang Tse's avatar Yang Tse
Browse files

libcurl private function Curl_memrchr() now in curl_memrchr.c and curl_memrchr.h

parent b64dd3c6
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ OBJS = $(OBJ_DIR)\base64.obj $(OBJ_DIR)\connect.obj &
       $(OBJ_DIR)\timeval.obj          $(OBJ_DIR)\transfer.obj       &
       $(OBJ_DIR)\url.obj              $(OBJ_DIR)\version.obj        &
       $(OBJ_DIR)\slist.obj            $(OBJ_DIR)\nonblock.obj       &
       $(OBJ_DIR)\curl_rand.obj
       $(OBJ_DIR)\curl_rand.obj        $(OBJ_DIR)\curl_memrchr.obj

#
# Use $(OBJS) as a template to generate $(OBJS_STAT) and $(OBJS_DYN).
@@ -194,7 +194,7 @@ $(OBJ_DIR)\cookie.obj: cookie.c setup.h config-win32.h ..\include\curl\curlbuild
  ..\include\curl\multi.h urldata.h cookie.h ..\include\curl\curl.h &
  formdata.h timeval.h http_chunks.h hostip.h hash.h llist.h &
  curl_addrinfo.h splay.h strequal.h strtok.h sendf.h curl_memory.h share.h &
  strtoofft.h rawstr.h memdebug.h
  strtoofft.h rawstr.h memdebug.h curl_memrchr.h
$(OBJ_DIR)\http.obj: http.c setup.h config-win32.h ..\include\curl\curlbuild.h &
  ..\include\curl\curlrules.h setup_once.h urldata.h cookie.h &
  ..\include\curl\curl.h ..\include\curl\curlver.h &
@@ -548,3 +548,9 @@ $(OBJ_DIR)\curl_rand.obj: curl_rand.c setup.h config-win32.h &
  ..\include\curl\curlrules.h ..\include\curl\easy.h &
  ..\include\curl\multi.h ..\include\curl\curl.h curl_rand.h &
  ..\include\curl\mprintf.h curl_memory.h memdebug.h
$(OBJ_DIR)\curl_memrchr.obj: curl_memrchr.c setup.h config-win32.h &
  ..\include\curl\curlbuild.h ..\include\curl\curlrules.h setup_once.h &
  ..\include\curl\curl.h ..\include\curl\curlver.h &
  ..\include\curl\curlrules.h ..\include\curl\easy.h &
  ..\include\curl\multi.h ..\include\curl\curl.h curl_memrchr.h &
  ..\include\curl\mprintf.h curl_memory.h memdebug.h
+5 −2
Original line number Diff line number Diff line
@@ -10,7 +10,8 @@ CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
  hostares.c hostasyn.c hostip4.c hostip6.c hostsyn.c hostthre.c	\
  inet_ntop.c parsedate.c select.c gtls.c sslgen.c tftp.c splay.c	\
  strdup.c socks.c ssh.c nss.c qssl.c rawstr.c curl_addrinfo.c          \
  socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c
  socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c		\
  curl_memrchr.c

HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h	\
  progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h	\
@@ -21,4 +22,6 @@ HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h \
  strtoofft.h strerror.h inet_ntop.h curlx.h curl_memory.h setup.h	\
  transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h gtls.h	\
  tftp.h sockaddr.h splay.h strdup.h setup_once.h socks.h ssh.h nssg.h	\
  curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h slist.h nonblock.h
  curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h slist.h nonblock.h	\
  curl_memrchr.h
+6 −1
Original line number Diff line number Diff line
@@ -13,7 +13,9 @@ objs = o.base64 o.connect o.cookie o.dict \
	o.security o.select o.sendf o.speedcheck o.ssluse \
	o.strequal o.strtok o.telnet o.timeval \
	o.transfer o.url o.version o.strtoofft o.sslgen o.gtls \
	o.rawstr o.curl_addrinfo o.slist o.nonblock o.curl_rand
	o.rawstr o.curl_addrinfo o.slist o.nonblock o.curl_rand \
	o.curl_memrchr


# Compile options:
linkopts	= -o libcurl
@@ -36,6 +38,9 @@ o.cookie: c.cookie
o.curl_addrinfo:	c.curl_addrinfo
		gcc $(compileropts) -c -o curl_addrinfo.o c.curl_addrinfo

o.curl_memrchr:	c.curl_memrchr
		gcc $(compileropts) -c -o curl_memrchr.o c.curl_memrchr

o.curl_rand:	c.curl_rand
		gcc $(compileropts) -c -o curl_rand.o c.curl_rand

+1 −0
Original line number Diff line number Diff line
@@ -450,6 +450,7 @@ X_OBJS= \
	$(DIROBJ)\content_encoding.obj \
	$(DIROBJ)\cookie.obj \
	$(DIROBJ)\curl_addrinfo.obj \
	$(DIROBJ)\curl_memrchr.obj \
	$(DIROBJ)\curl_rand.obj \
	$(DIROBJ)\curl_sspi.obj \
	$(DIROBJ)\dict.obj \
+1 −17
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ Example set of cookies:
#include "share.h"
#include "strtoofft.h"
#include "rawstr.h"
#include "curl_memrchr.h"

/* The last #include file should be: */
#include "memdebug.h"
@@ -168,23 +169,6 @@ static void strstore(char **str, const char *newstr)
}


/*
 * The memrchr() function is like the memchr() function, except that it
 * searches backwards from the end of the n bytes pointed to by s instead of
 * forwards from the front.
 *
 * Exists in glibc but is not widely available on other systems.
 */
static void *memrchr(const char *s, int c, size_t n)
{
  while(n--) {
    if(s[n] == c)
      return &s[n];
  }
  return NULL;
}


/****************************************************************************
 *
 * Curl_cookie_add()
Loading