]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[core] add switch_filecmp
authorAnthony Minessale <anthm@signalwire.com>
Fri, 10 Apr 2020 18:44:25 +0000 (18:44 +0000)
committerAndrey Volk <andywolk@gmail.com>
Sat, 23 Oct 2021 19:00:10 +0000 (22:00 +0300)
src/include/switch_utils.h

index ec361a98859432fffb03c6e5abd1fcd32d689d98..e5a794282a7685de9e6279421ae3b335c79257aa 100644 (file)
@@ -1280,6 +1280,31 @@ static inline switch_bool_t switch_is_file_path(const char *file)
        return r ? SWITCH_TRUE : SWITCH_FALSE;
 }
 
+static inline int switch_filecmp(const char *a, const char *b)
+{
+       const char *e;
+
+       if (zstr(a) || zstr(b)) {
+               return -1;
+       }
+
+       while(*a == '{') {
+               if ((e = switch_find_end_paren(a, '{', '}'))) {
+                       a = e + 1;
+                       while(*a == ' ') a++;
+               }
+       }
+
+       while(*b == '{') {
+               if ((e = switch_find_end_paren(b, '{', '}'))) {
+                       b = e + 1;
+                       while(*b == ' ') b++;
+               }
+       }
+
+       return strcmp(a, b);
+}
+
 
 static inline const char *switch_parse_audio_col(switch_audio_col_t col)
 {