Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: krkhan/tor
base: master
...
head fork: krkhan/tor
compare: bug1692
  • 6 commits
  • 4 files changed
  • 0 commit comments
  • 2 contributors
24 src/common/util.c
View
@@ -2679,6 +2679,30 @@ tor_sscanf(const char *buf, const char *pattern, ...)
return r;
}
+/** Append the string produced by tor_asprintf(<b>pattern</b>, <b>...</b>)
+ * to <b>sl</b>. */
+void
+smartlist_asprintf_add(struct smartlist_t *sl, const char *pattern, ...)
+{
+ va_list ap;
+ va_start(ap, pattern);
+ smartlist_vasprintf_add(sl, pattern, ap);
+ va_end(ap);
+}
+
+/** va_list-based backend of smartlist_asprintf_add. */
+void
+smartlist_vasprintf_add(struct smartlist_t *sl, const char *pattern,
+ va_list args)
+{
+ char *str = NULL;
+
+ tor_vasprintf(&str, pattern, args);
+ tor_assert(str != NULL);
+
+ smartlist_add(sl, str);
+}
+
/** Return a new list containing the filenames in the directory <b>dirname</b>.
* Return NULL on error or if <b>dirname</b> is not a directory.
*/
5 src/common/util.h
View
@@ -220,6 +220,11 @@ int tor_sscanf(const char *buf, const char *pattern, ...)
#endif
;
+void smartlist_asprintf_add(struct smartlist_t *sl, const char *pattern, ...)
+ CHECK_PRINTF(2, 3);
+void smartlist_vasprintf_add(struct smartlist_t *sl, const char *pattern,
+ va_list args);
+
int hex_decode_digit(char c);
void base16_encode(char *dest, size_t destlen, const char *src, size_t srclen);
int base16_decode(char *dest, size_t destlen, const char *src, size_t srclen);
2  src/or/config.c
View
@@ -718,7 +718,7 @@ set_options(or_options_t *new_val, char **msg)
if (!option_is_same(&options_format, new_val, old_options,
options_format.vars[i].name)) {
line = get_assigned_option(&options_format, new_val,
- options_format.vars[i].name, 0);
+ options_format.vars[i].name, 1);
if (line) {
for (; line; line = line->next) {
8 src/or/control.c
View
@@ -4008,20 +4008,18 @@ control_event_conf_changed(smartlist_t *elements)
int i;
char *result;
smartlist_t *lines;
- if (smartlist_len(elements) == 0) {
+ if (!EVENT_IS_INTERESTING(EVENT_CONF_CHANGED) || smartlist_len(elements) == 0) {
return 0;
}
lines = smartlist_create();
for (i = 0; i < smartlist_len(elements); i += 2) {
char *k = smartlist_get(elements, i);
char *v = smartlist_get(elements, i+1);
- char *tmp;
if (v == NULL) {
- tor_asprintf(&tmp, "650-%s", k);
+ smartlist_asprintf_add(lines, "650-%s", k);
} else {
- tor_asprintf(&tmp, "650-%s=%s", k, v);
+ smartlist_asprintf_add(lines, "650-%s=%s", k, v);
}
- smartlist_add(lines, tmp);
}
result = smartlist_join_strings(lines, "\r\n", 0, NULL);
send_control_event(EVENT_CONF_CHANGED, 0,

No commit comments for this range

Something went wrong with that request. Please try again.