pcrs: Request JIT compilation if it's supported
[privoxy.git] / client-tags.c
index c8d860e..a8cb696 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Purpose     :  Functions related to client-specific tags.
  *
- * Copyright   :  Copyright (C) 2016 Fabian Keil <fk@fabiankeil.de>
+ * Copyright   :  Copyright (C) 2016-2017 Fabian Keil <fk@fabiankeil.de>
  *
  *                This program is free software; you can redistribute it
  *                and/or modify it under the terms of the GNU General
@@ -234,7 +234,7 @@ void get_tag_list_for_client(struct list *tag_list,
       {
          struct client_specific_tag *next_tag = enabled_tags->next;
          log_error(LOG_LEVEL_INFO,
-            "Tag '%s' for client %s expired %u seconds ago. Deleting it.",
+            "Tag '%s' for client %s expired %ld seconds ago. Deleting it.",
             enabled_tags->name, client_address,
             (now - enabled_tags->end_of_life));
          remove_tag_for_client(client_address, enabled_tags->name);
@@ -276,14 +276,14 @@ time_t get_next_tag_timeout_for_client(const char *client_address)
    enabled_tags = get_tags_for_client(client_address);
    while (enabled_tags != NULL)
    {
-      log_error(LOG_LEVEL_CGI, "Evaluating tag '%s' for client %s. End of life %d",
+      log_error(LOG_LEVEL_CGI, "Evaluating tag '%s' for client %s. End of life %ld",
          enabled_tags->name, client_address, enabled_tags->end_of_life);
       if (enabled_tags->end_of_life)
       {
           time_t time_left = enabled_tags->end_of_life - now;
           /* Add a second to make sure the tag will have expired */
           time_left++;
-          log_error(LOG_LEVEL_CGI, "%d > %d?", next_timeout, time_left);
+          log_error(LOG_LEVEL_CGI, "%ld > %ld?", next_timeout, time_left);
           if (next_timeout == 0 || next_timeout > time_left)
           {
              next_timeout = time_left;
@@ -294,7 +294,7 @@ time_t get_next_tag_timeout_for_client(const char *client_address)
 
    privoxy_mutex_unlock(&client_tags_mutex);
 
-   log_error(LOG_LEVEL_CGI, "Next timeout in %d seconds", next_timeout);
+   log_error(LOG_LEVEL_CGI, "Next timeout in %ld seconds", next_timeout);
 
    return next_timeout;
 
@@ -473,17 +473,16 @@ static void remove_tag_for_client(const char *client_address, const char *tag)
                /* Client has preceding client */
                clients_with_tags->prev->next = clients_with_tags->next;
             }
-            freez(clients_with_tags->client);
             if (clients_with_tags == requested_tags)
             {
-               /* Removing last tag */
-               freez(requested_tags);
-               clients_with_tags = requested_tags;
-            }
-            else
-            {
-               freez(clients_with_tags);
+               /*
+                * We're in the process of removing the last tag,
+                * mark the global list as empty.
+                */
+               requested_tags = NULL;
             }
+            freez(clients_with_tags->client);
+            freez(clients_with_tags);
          }
          freez(enabled_tags->name);
          freez(enabled_tags);
@@ -569,7 +568,7 @@ jb_err enable_client_specific_tag(struct client_state *csp,
    {
       add_tag_for_client(csp->client_address, tag_name, time_to_live);
       log_error(LOG_LEVEL_INFO,
-         "Tag '%s' enabled for client '%s'. TTL: %d.",
+         "Tag '%s' enabled for client '%s'. TTL: %ld.",
          tag->name, csp->client_address, time_to_live);
    }