]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/log-conf.c
xtypes: Added FIXME with possible segfault.
[libucw.git] / ucw / log-conf.c
index 7c7f97afe8ce2ed0c15fd393b7cecae75ee43eb4..d809c11d00145f9725cce7eb9222d7120994f86a 100644 (file)
@@ -7,13 +7,13 @@
  *     of the GNU Lesser General Public License.
  */
 
-#include "ucw/lib.h"
-#include "ucw/log.h"
-#include "ucw/log-internal.h"
-#include "ucw/conf.h"
-#include "ucw/simple-lists.h"
-#include "ucw/tbf.h"
-#include "ucw/threads.h"
+#include <ucw/lib.h>
+#include <ucw/log.h>
+#include <ucw/log-internal.h>
+#include <ucw/conf.h>
+#include <ucw/simple-lists.h>
+#include <ucw/tbf.h>
+#include <ucw/threads.h>
 
 #include <stdio.h>
 #include <string.h>
@@ -45,7 +45,7 @@ struct limit_config {
   cnode n;
   clist types;                         // simple_list of names
   double rate;
-  uns burst;
+  uint burst;
 };
 
 static char *
@@ -90,7 +90,7 @@ static struct cf_section limit_config = {
 #define P(x) PTR_TO(struct limit_config, x)
     CF_LIST("Types", P(types), &cf_string_list_config),
     CF_DOUBLE("Rate", P(rate)),
-    CF_UNS("Burst", P(burst)),
+    CF_UINT("Burst", P(burst)),
 #undef P
     CF_END
   }
@@ -186,13 +186,13 @@ log_config_init(void)
 
 /*** Type sets ***/
 
-static uns
+static uint
 log_type_mask(clist *l)
 {
   if (clist_empty(l))
     return ~0U;
 
-  uns types = 0;
+  uint types = 0;
   CLIST_FOR_EACH(simp_node *, s, *l)
     if (!strcmp(s->s, "all"))
       return ~0U;
@@ -243,7 +243,7 @@ log_limiter(struct log_stream *ls, struct log_msg *m)
          struct log_msg mm = *m;
          mm.flags |= L_LOGGER_ERR;
          mm.raw_msg = "(maximum logging rate exceeded, some messages will be suppressed)";
-         log_pass_msg(0, ls, &mm);
+         log_pass_msg(ls, &mm);
        }
       return 1;
     }
@@ -254,7 +254,7 @@ log_limiter(struct log_stream *ls, struct log_msg *m)
 static void
 log_apply_limits(struct log_stream *ls, struct limit_config *lim)
 {
-  uns mask = log_type_mask(&lim->types);
+  uint mask = log_type_mask(&lim->types);
   if (!mask)
     return;
 
@@ -269,7 +269,7 @@ log_apply_limits(struct log_stream *ls, struct limit_config *lim)
   tbf->burst = lim->burst;
   tbf_init(tbf);
 
-  for (uns i=0; i < LS_NUM_TYPES; i++)
+  for (uint i=0; i < LS_NUM_TYPES; i++)
     if (mask & (1 << i))
       limits[i] = tbf;
 }
@@ -342,7 +342,7 @@ log_configured(const char *name)
 #ifdef TEST
 
 #include <unistd.h>
-#include "ucw/getopt.h"
+#include <ucw/getopt.h>
 
 int main(int argc, char **argv)
 {
@@ -353,7 +353,7 @@ int main(int argc, char **argv)
 
   int type = log_register_type("foo");
   struct log_stream *ls = log_new_configured("combined");
-  for (uns i=0; i<10; i++)
+  for (uint i=0; i<10; i++)
     {
       msg(L_INFO | ls->regnum | type, "Hello, universe!");
       usleep(200000);