Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 6 commits
  • 4 files changed
  • 0 comments
  • 2 contributors
24  src/common/util.c
@@ -2679,6 +2679,30 @@ tor_sscanf(const char *buf, const char *pattern, ...)
2679 2679
   return r;
2680 2680
 }
2681 2681
 
  2682
+/** Append the string produced by tor_asprintf(<b>pattern</b>, <b>...</b>)
  2683
+ * to <b>sl</b>. */
  2684
+void
  2685
+smartlist_asprintf_add(struct smartlist_t *sl, const char *pattern, ...)
  2686
+{
  2687
+  va_list ap;
  2688
+  va_start(ap, pattern);
  2689
+  smartlist_vasprintf_add(sl, pattern, ap);
  2690
+  va_end(ap);
  2691
+}
  2692
+
  2693
+/** va_list-based backend of smartlist_asprintf_add. */
  2694
+void
  2695
+smartlist_vasprintf_add(struct smartlist_t *sl, const char *pattern,
  2696
+                        va_list args)
  2697
+{
  2698
+  char *str = NULL;
  2699
+
  2700
+  tor_vasprintf(&str, pattern, args);
  2701
+  tor_assert(str != NULL);
  2702
+
  2703
+  smartlist_add(sl, str);
  2704
+}
  2705
+
2682 2706
 /** Return a new list containing the filenames in the directory <b>dirname</b>.
2683 2707
  * Return NULL on error or if <b>dirname</b> is not a directory.
2684 2708
  */
5  src/common/util.h
@@ -220,6 +220,11 @@ int tor_sscanf(const char *buf, const char *pattern, ...)
220 220
 #endif
221 221
   ;
222 222
 
  223
+void smartlist_asprintf_add(struct smartlist_t *sl, const char *pattern, ...)
  224
+  CHECK_PRINTF(2, 3);
  225
+void smartlist_vasprintf_add(struct smartlist_t *sl, const char *pattern,
  226
+                             va_list args);
  227
+
223 228
 int hex_decode_digit(char c);
224 229
 void base16_encode(char *dest, size_t destlen, const char *src, size_t srclen);
225 230
 int base16_decode(char *dest, size_t destlen, const char *src, size_t srclen);
2  src/or/config.c
@@ -718,7 +718,7 @@ set_options(or_options_t *new_val, char **msg)
718 718
       if (!option_is_same(&options_format, new_val, old_options,
719 719
         options_format.vars[i].name)) {
720 720
         line = get_assigned_option(&options_format, new_val,
721  
-        options_format.vars[i].name, 0);
  721
+        options_format.vars[i].name, 1);
722 722
 
723 723
         if (line) {
724 724
           for (; line; line = line->next) {
8  src/or/control.c
@@ -4008,20 +4008,18 @@ control_event_conf_changed(smartlist_t *elements)
4008 4008
   int i;
4009 4009
   char *result;
4010 4010
   smartlist_t *lines;
4011  
-  if (smartlist_len(elements) == 0) {
  4011
+  if (!EVENT_IS_INTERESTING(EVENT_CONF_CHANGED) || smartlist_len(elements) == 0) {
4012 4012
     return 0;
4013 4013
   }
4014 4014
   lines = smartlist_create();
4015 4015
   for (i = 0; i < smartlist_len(elements); i += 2) {
4016 4016
     char *k = smartlist_get(elements, i);
4017 4017
     char *v = smartlist_get(elements, i+1);
4018  
-    char *tmp;
4019 4018
     if (v == NULL) {
4020  
-      tor_asprintf(&tmp, "650-%s", k);
  4019
+      smartlist_asprintf_add(lines, "650-%s", k);
4021 4020
     } else {
4022  
-      tor_asprintf(&tmp, "650-%s=%s", k, v);
  4021
+      smartlist_asprintf_add(lines, "650-%s=%s", k, v);
4023 4022
     }
4024  
-    smartlist_add(lines, tmp);
4025 4023
   }
4026 4024
   result = smartlist_join_strings(lines, "\r\n", 0, NULL);
4027 4025
   send_control_event(EVENT_CONF_CHANGED, 0,

No commit comments for this range

Something went wrong with that request. Please try again.