[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Remove _ex suffix from typed_var_*_ex() functions.



commit 88839ab2ac489af7b80c2812fc87ab8b89075fbb
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Sep 4 14:58:56 2019 -0400

    Remove _ex suffix from typed_var_*_ex() functions.
    
    Now that the variants of these functions that took config_line_t are
    gone, there is no longer any reason for the remaining variants to
    have "ex" at the end of their names.
    
    This commit was made by running this perl script over all the files
    in src/:
    
    #!/usr/bin/perl -w -i -p
    
    s{typed_var_(assign|free|encode|copy|eq|ok|kvassign|kvencode|mark_fragile)_ex}
     {typed_var_$1}g;
---
 src/lib/confmgt/structvar.c | 18 +++++++++---------
 src/lib/confmgt/typedvar.c  | 38 +++++++++++++++++++-------------------
 src/lib/confmgt/typedvar.h  | 18 +++++++++---------
 3 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/src/lib/confmgt/structvar.c b/src/lib/confmgt/structvar.c
index 97a8fb363..32f616c21 100644
--- a/src/lib/confmgt/structvar.c
+++ b/src/lib/confmgt/structvar.c
@@ -103,7 +103,7 @@ struct_var_assign(void *object, const char *value, char **errmsg,
   void *p = struct_get_mptr(object, member);
   const var_type_def_t *def = get_type_def(member);
 
-  return typed_var_assign_ex(p, value, errmsg, def);
+  return typed_var_assign(p, value, errmsg, def);
 }
 
 /**
@@ -116,7 +116,7 @@ struct_var_free(void *object, const struct_member_t *member)
   void *p = struct_get_mptr(object, member);
   const var_type_def_t *def = get_type_def(member);
 
-  typed_var_free_ex(p, def);
+  typed_var_free(p, def);
 }
 
 /**
@@ -129,7 +129,7 @@ struct_var_encode(const void *object, const struct_member_t *member)
   const void *p = struct_get_ptr(object, member);
   const var_type_def_t *def = get_type_def(member);
 
-  return typed_var_encode_ex(p, def);
+  return typed_var_encode(p, def);
 }
 
 /**
@@ -143,7 +143,7 @@ struct_var_copy(void *dest, const void *src, const struct_member_t *member)
   const void *p_src = struct_get_ptr(src, member);
   const var_type_def_t *def = get_type_def(member);
 
-  return typed_var_copy_ex(p_dest, p_src, def);
+  return typed_var_copy(p_dest, p_src, def);
 }
 
 /**
@@ -157,7 +157,7 @@ struct_var_eq(const void *a, const void *b, const struct_member_t *member)
   const void *p_b = struct_get_ptr(b, member);
   const var_type_def_t *def = get_type_def(member);
 
-  return typed_var_eq_ex(p_a, p_b, def);
+  return typed_var_eq(p_a, p_b, def);
 }
 
 /**
@@ -170,7 +170,7 @@ struct_var_ok(const void *object, const struct_member_t *member)
   const void *p = struct_get_ptr(object, member);
   const var_type_def_t *def = get_type_def(member);
 
-  return typed_var_ok_ex(p, def);
+  return typed_var_ok(p, def);
 }
 
 /**
@@ -185,7 +185,7 @@ struct_var_kvassign(void *object, const struct config_line_t *line,
   void *p = struct_get_mptr(object, member);
   const var_type_def_t *def = get_type_def(member);
 
-  return typed_var_kvassign_ex(p, line, errmsg, def);
+  return typed_var_kvassign(p, line, errmsg, def);
 }
 
 /**
@@ -198,7 +198,7 @@ struct_var_kvencode(const void *object, const struct_member_t *member)
   const void *p = struct_get_ptr(object, member);
   const var_type_def_t *def = get_type_def(member);
 
-  return typed_var_kvencode_ex(member->name, p, def);
+  return typed_var_kvencode(member->name, p, def);
 }
 
 /**
@@ -211,7 +211,7 @@ struct_var_mark_fragile(void *object, const struct_member_t *member)
 {
   void *p = struct_get_mptr(object, member);
   const var_type_def_t *def = get_type_def(member);
-  return typed_var_mark_fragile_ex(p, def);
+  return typed_var_mark_fragile(p, def);
 }
 
 /**
diff --git a/src/lib/confmgt/typedvar.c b/src/lib/confmgt/typedvar.c
index 1a1dcf73d..43040e1e0 100644
--- a/src/lib/confmgt/typedvar.c
+++ b/src/lib/confmgt/typedvar.c
@@ -40,13 +40,13 @@
  * string holding an error message, and return -1.
  **/
 int
-typed_var_assign_ex(void *target, const char *value, char **errmsg,
+typed_var_assign(void *target, const char *value, char **errmsg,
                     const var_type_def_t *def)
 {
   if (BUG(!def))
     return -1; // LCOV_EXCL_LINE
   // clear old value if needed.
-  typed_var_free_ex(target, def);
+  typed_var_free(target, def);
 
   tor_assert(def->fns->parse);
   return def->fns->parse(target, value, errmsg, def->params);
@@ -55,7 +55,7 @@ typed_var_assign_ex(void *target, const char *value, char **errmsg,
 /**
  * Try to parse a single line from the head of<b>line</b> that encodes an
  * object of the type defined in <b>def</b>. On success and failure, behave as
- * typed_var_assign_ex().
+ * typed_var_assign().
  *
  * All types for which keys are significant should use this function.
  *
@@ -63,7 +63,7 @@ typed_var_assign_ex(void *target, const char *value, char **errmsg,
  * only the first one is handled by this function.
  **/
 int
-typed_var_kvassign_ex(void *target, const config_line_t *line,
+typed_var_kvassign(void *target, const config_line_t *line,
                       char **errmsg, const var_type_def_t *def)
 {
   if (BUG(!def))
@@ -75,7 +75,7 @@ typed_var_kvassign_ex(void *target, const config_line_t *line,
     return def->fns->kv_parse(target, line, errmsg, def->params);
   }
 
-  return typed_var_assign_ex(target, line->value, errmsg, def);
+  return typed_var_assign(target, line->value, errmsg, def);
 }
 
 /**
@@ -83,7 +83,7 @@ typed_var_kvassign_ex(void *target, const config_line_t *line,
  * <b>def</b>, and set <b>target</b> to a reasonable default.
  **/
 void
-typed_var_free_ex(void *target, const var_type_def_t *def)
+typed_var_free(void *target, const var_type_def_t *def)
 {
   if (BUG(!def))
     return; // LCOV_EXCL_LINE
@@ -99,7 +99,7 @@ typed_var_free_ex(void *target, const var_type_def_t *def)
  * Returns NULL if this option has a NULL value, or on internal error.
  **/
 char *
-typed_var_encode_ex(const void *value, const var_type_def_t *def)
+typed_var_encode(const void *value, const var_type_def_t *def)
 {
   if (BUG(!def))
     return NULL; // LCOV_EXCL_LINE
@@ -108,7 +108,7 @@ typed_var_encode_ex(const void *value, const var_type_def_t *def)
 }
 
 /**
- * As typed_var_encode_ex(), but returns a newly allocated config_line_t
+ * As typed_var_encode(), but returns a newly allocated config_line_t
  * object.  The provided <b>key</b> is used as the key of the lines, unless
  * the type is one (line a linelist) that encodes its own keys.
  *
@@ -117,7 +117,7 @@ typed_var_encode_ex(const void *value, const var_type_def_t *def)
  * Returns NULL if there are no lines to encode, or on internal error.
  */
 config_line_t *
-typed_var_kvencode_ex(const char *key, const void *value,
+typed_var_kvencode(const char *key, const void *value,
                       const var_type_def_t *def)
 {
   if (BUG(!def))
@@ -125,7 +125,7 @@ typed_var_kvencode_ex(const char *key, const void *value,
   if (def->fns->kv_encode) {
     return def->fns->kv_encode(key, value, def->params);
   }
-  char *encoded_value = typed_var_encode_ex(value, def);
+  char *encoded_value = typed_var_encode(value, def);
   if (!encoded_value)
     return NULL;
 
@@ -142,7 +142,7 @@ typed_var_kvencode_ex(const char *key, const void *value,
  * Return 0 on success, and -1 on failure.
  **/
 int
-typed_var_copy_ex(void *dest, const void *src, const var_type_def_t *def)
+typed_var_copy(void *dest, const void *src, const var_type_def_t *def)
 {
   if (BUG(!def))
     return -1; // LCOV_EXCL_LINE
@@ -152,13 +152,13 @@ typed_var_copy_ex(void *dest, const void *src, const var_type_def_t *def)
   }
 
   // Otherwise, encode 'src' and parse the result into 'def'.
-  char *enc = typed_var_encode_ex(src, def);
+  char *enc = typed_var_encode(src, def);
   if (!enc) {
-    typed_var_free_ex(dest, def);
+    typed_var_free(dest, def);
     return 0;
   }
   char *err = NULL;
-  int rv = typed_var_assign_ex(dest, enc, &err, def);
+  int rv = typed_var_assign(dest, enc, &err, def);
   if (BUG(rv < 0)) {
     // LCOV_EXCL_START
     log_warn(LD_BUG, "Encoded value %s was not parseable as a %s: %s",
@@ -175,7 +175,7 @@ typed_var_copy_ex(void *dest, const void *src, const var_type_def_t *def)
  * Both types must be as defined by <b>def</b>.
  **/
 bool
-typed_var_eq_ex(const void *a, const void *b, const var_type_def_t *def)
+typed_var_eq(const void *a, const void *b, const var_type_def_t *def)
 {
   if (BUG(!def))
     return false; // LCOV_EXCL_LINE
@@ -186,8 +186,8 @@ typed_var_eq_ex(const void *a, const void *b, const var_type_def_t *def)
   }
 
   // Otherwise, encode the values and compare them.
-  char *enc_a = typed_var_encode_ex(a, def);
-  char *enc_b = typed_var_encode_ex(b, def);
+  char *enc_a = typed_var_encode(a, def);
+  char *enc_b = typed_var_encode(b, def);
   bool eq = !strcmp_opt(enc_a,enc_b);
   tor_free(enc_a);
   tor_free(enc_b);
@@ -199,7 +199,7 @@ typed_var_eq_ex(const void *a, const void *b, const var_type_def_t *def)
  * type definition in <b>def</b>.
  */
 bool
-typed_var_ok_ex(const void *value, const var_type_def_t *def)
+typed_var_ok(const void *value, const var_type_def_t *def)
 {
   if (BUG(!def))
     return false; // LCOV_EXCL_LINE
@@ -216,7 +216,7 @@ typed_var_ok_ex(const void *value, const var_type_def_t *def)
  * assignment instead.
  **/
 void
-typed_var_mark_fragile_ex(void *value, const var_type_def_t *def)
+typed_var_mark_fragile(void *value, const var_type_def_t *def)
 {
   if (BUG(!def)) {
     return; // LCOV_EXCL_LINE
diff --git a/src/lib/confmgt/typedvar.h b/src/lib/confmgt/typedvar.h
index e1ede6f95..23fd8c13e 100644
--- a/src/lib/confmgt/typedvar.h
+++ b/src/lib/confmgt/typedvar.h
@@ -20,20 +20,20 @@ struct config_line_t;
 typedef struct var_type_fns_t var_type_fns_t;
 typedef struct var_type_def_t var_type_def_t;
 
-int typed_var_assign_ex(void *target, const char *value, char **errmsg,
+int typed_var_assign(void *target, const char *value, char **errmsg,
                         const var_type_def_t *def);
-void typed_var_free_ex(void *target, const var_type_def_t *def);
-char *typed_var_encode_ex(const void *value, const var_type_def_t *def);
-int typed_var_copy_ex(void *dest, const void *src, const var_type_def_t *def);
-bool typed_var_eq_ex(const void *a, const void *b, const var_type_def_t *def);
-bool typed_var_ok_ex(const void *value, const var_type_def_t *def);
+void typed_var_free(void *target, const var_type_def_t *def);
+char *typed_var_encode(const void *value, const var_type_def_t *def);
+int typed_var_copy(void *dest, const void *src, const var_type_def_t *def);
+bool typed_var_eq(const void *a, const void *b, const var_type_def_t *def);
+bool typed_var_ok(const void *value, const var_type_def_t *def);
 
-int typed_var_kvassign_ex(void *target, const struct config_line_t *line,
+int typed_var_kvassign(void *target, const struct config_line_t *line,
                            char **errmsg, const var_type_def_t *def);
-struct config_line_t *typed_var_kvencode_ex(const char *key, const void *value,
+struct config_line_t *typed_var_kvencode(const char *key, const void *value,
                                             const var_type_def_t *def);
 
-void typed_var_mark_fragile_ex(void *value, const var_type_def_t *def);
+void typed_var_mark_fragile(void *value, const var_type_def_t *def);
 
 bool var_type_is_cumulative(const var_type_def_t *def);
 bool var_type_is_contained(const var_type_def_t *def);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits