]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add local vars with []
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 10 Dec 2007 21:58:40 +0000 (21:58 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 10 Dec 2007 21:58:40 +0000 (21:58 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6609 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_utils.h
src/switch_utils.c

index 1d090b29411e3a61099435797d662643e73d0772..5025ce2114537fd0d07c2d2780cc94b5a49e18f7 100644 (file)
@@ -341,6 +341,7 @@ SWITCH_DECLARE(switch_status_t) switch_string_match(const char *string, size_t s
 SWITCH_DECLARE(size_t) switch_url_encode(const char *url, char *buf, size_t len);
 SWITCH_DECLARE(char *) switch_url_decode(char *s);
 SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, const char *from, const char *headers, const char *body, const char *file);
+SWITCH_DECLARE(char *) switch_find_end_paren(const char *s, char open, char close);
 
 /* malloc or DIE macros */
 #ifdef NDEBUG
index b8d7e7a9e261991c1770f252b8dc304232b7b0d4..47549a68d25bbc474b087dfddd84a7dec085e277 100644 (file)
 #include "private/switch_core_pvt.h"
 
 
+SWITCH_DECLARE(char *) switch_find_end_paren(const char *s, char open, char close)
+{
+       const char *e = NULL;
+       int depth = 0;
+       
+       while (s && *s && *s == ' ') {
+               s++;
+       }
+
+       if (*s == open) {
+               depth++;
+               for (e = s + 1; e && *e; e++) {
+                       if (*e == open) {
+                               depth++;
+                       } else if (*e == close) {
+                               depth--;
+                               if (!depth) {
+                                       break;
+                               }
+                       }
+               }
+       }
+
+       return (char *)e;
+}
+
+
 SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size_t len)
 {
        char c, *p;