]> rtime.felk.cvut.cz Git - ulut.git/blobdiff - ulut/ul_logreg.c
uLUt: remove abundant inline which prevents linking after build by GCC-6.
[ulut.git] / ulut / ul_logreg.c
index e6fe1323a918c4a6d1c982f2e96a1fcd1ead74bc..c416eb23f81657d8205f2a8cbc88ab3d43733166 100644 (file)
@@ -23,7 +23,9 @@
 
 #include <ctype.h>
 #include <string.h>
+#ifndef __RTL__
 #include <stdlib.h>
+#endif
 #include <ul_logbase.h>
 #include <ul_logreg.h>
 #include <ul_gsacust.h>
@@ -43,7 +45,7 @@ typedef struct ul_log_domains_t {
 
 typedef const char *ul_log_domains_key_t;
 
-inline int
+int
 ul_log_domains_cmp_fnc(const ul_log_domains_key_t *a, const ul_log_domains_key_t *b)
 {
   return strcmp(*a,*b);
@@ -126,6 +128,12 @@ int ul_log_domain_getlevel(const char *name)
 #define UL_MAX_DOMAIN_NAME 20
 #endif /*UL_MAX_DOMAIN_NAME*/
 
+/* Argument syntax:
+ *
+ * <arg> := <assignment> | <arg> (':' | ',') <assignment>
+ * <assignment> := [ <domain> ('.' | '=') ] NUMBER
+ * <domain> := ( IDENTIFIER | "all" | "ALL" )
+ */
 int ul_log_domain_arg2levels(const char *arg)
 {
   const char *p=arg;
@@ -141,7 +149,7 @@ int ul_log_domain_arg2levels(const char *arg)
       strcpy(name,"all");
     }else{
       r=p;
-      while(isalnum(*p)) p++;
+      while(isalnum(*p)||(*p=='_')) p++;
       l=p-r;
       if(l>UL_MAX_DOMAIN_NAME)
         l=UL_MAX_DOMAIN_NAME;
@@ -191,3 +199,18 @@ int ul_logreg_domains_static(ul_log_domain_t *const *domains, int count)
   }
   return 0;
 }
+
+void ul_logreg_for_each_domain(ul_logreg_domain_cb_t *callback, void *context)
+{
+  ul_log_domains_it_t it;
+  ul_log_domain_t *domain;
+  ul_for_each_it(ul_log_domains, &ul_log_domains, it) {
+    domain=ul_log_domains_it2item(&it);
+    if (callback) {
+      int ret;
+      ret = callback(domain, context);
+      if (ret)
+       break;
+    }
+  }
+}