[Freeswitch-svn] [commit] r11785 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/su

FreeSWITCH SVN mikej at freeswitch.org
Wed Feb 11 08:27:51 PST 2009


Author: mikej
Date: Wed Feb 11 10:27:51 2009
New Revision: 11785

Log:
Thu Jan  8 12:08:14 CST 2009  Pekka Pessi <first.last at nokia.com>
  * memspn.c, memcspn.c: use functions from <sofia-sip/su_string.h>



Modified:
   freeswitch/trunk/libs/sofia-sip/.update
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/memcspn.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/memspn.c

Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Wed Feb 11 10:27:51 2009
@@ -1 +1 @@
-Wed Feb 11 10:23:36 CST 2009
+Wed Feb 11 10:27:42 CST 2009

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/memcspn.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/memcspn.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/memcspn.c	Wed Feb 11 10:27:51 2009
@@ -32,50 +32,13 @@
 
 #include "config.h"
 
-#include <string.h>
-#include <limits.h>
+#include <sofia-sip/su_string.h>
+
+size_t memcspn(const void *mem, size_t memlen,
+	       const void *reject, size_t rejectlen);
 
-/**Search memory for bytes not in a given set.
- *
- * The memcspn() function calculates the length of the memory area @a mem
- * which consists entirely of bytes not in @a reject.
- *
- * @param mem        pointer to memory area
- * @param memlen     size of @a mem in bytes
- * @param reject     pointer to table containing bytes to reject
- * @param rejectlen  size of @a reject table
- *
- * @return
- * The memspn() function returns the number of bytes in the memory area @a
- * which consists entirely of bytes not in @a reject.
- * @par
- * If @a rejectlen is 0, or @a reject is NULL, it returns @a memlen, size of
- * the memory area.
- */
 size_t memcspn(const void *mem, size_t memlen,
 	       const void *reject, size_t rejectlen)
 {
-  size_t i;
-
-  unsigned char const *m = mem, *r = reject;
-
-  char rejected[UCHAR_MAX + 1];
-
-  if (rejectlen == 0 || reject == 0)
-    return memlen;
-
-  if (mem == NULL || memlen == 0)
-    return 0;
-
-  memset(rejected, 0, sizeof rejected);
-
-  for (i = 0; i < rejectlen; i++)
-    rejected[r[i]] = 1;
-
-  for (i = 0; i < memlen; i++)
-    if (rejected[m[i]])
-      break;
-
-  return i;
+  return su_memcspn(mem, memlen, reject, rejectlen);
 }
-

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/memspn.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/memspn.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/memspn.c	Wed Feb 11 10:27:51 2009
@@ -34,43 +34,13 @@
 
 #include "config.h"
 
-#include <string.h>
-#include <limits.h>
+#include <sofia-sip/su_string.h>
+
+size_t memspn(const void *mem, size_t memlen,
+	      const void *accept, size_t acceptlen);
 
-/**Scan memory for a set of bytes.
- *
- * The memspn() function calculates the length of the memory area @a mem
- * which consists entirely of bytes in @a accept.
- *
- * @param mem        pointer to memory area
- * @param memlen     size of @a mem in bytes
- * @param accept     pointer to table containing bytes to accept
- * @param acceptlen  size of @a accept table
- *
- * @return
- * The memspn() function returns the number of bbytes in the memory area @a
- * which consists entirely of bytes in @a accept.
- */
 size_t memspn(const void *mem, size_t memlen,
 	      const void *accept, size_t acceptlen)
 {
-  size_t i;
-
-  unsigned char const *m = mem, *a = accept;
-
-  char accepted[UCHAR_MAX + 1];
-
-  if (mem == NULL || memlen == 0 || acceptlen == 0 || accept == NULL)
-    return 0;
-
-  memset(accepted, 0, sizeof accepted);
-
-  for (i = 0; i < acceptlen; i++)
-    accepted[a[i]] = 1;
-
-  for (i = 0; i < memlen; i++)
-    if (!accepted[m[i]])
-      break;
-
-  return i;
+  return su_memspn(mem, memlen, accept, acceptlen);
 }



More information about the Freeswitch-svn mailing list