- int i;
- unsigned int max_tag_len = 0;
-
- /* Allocate a buffer for escaping tags. This is large enough to
- * hold a fully escaped tag with every character doubled plus
- * enclosing quotes and a NUL. */
- for (i = 0; i < add_tags_count; i++)
- if (strlen (argv[add_tags[i]] + 1) > max_tag_len)
- max_tag_len = strlen (argv[add_tags[i]] + 1);
- for (i = 0; i < remove_tags_count; i++)
- if (strlen (argv[remove_tags[i]] + 1) > max_tag_len)
- max_tag_len = strlen (argv[remove_tags[i]] + 1);
- escaped = talloc_array(ctx, char, max_tag_len * 2 + 3);
- if (!escaped)
- return NULL;
+ size_t i;
+
+ /* Don't optimize if there are no tag changes. */
+ if (tag_op_list_size (list) == 0)
+ return talloc_strdup (ctx, orig_query_string);