168
* is farmed out to the generate function.
169
*/
170
static const char *anonymize_str(struct hashmap *map,
171
- char *(*generate)(void *),
172
- const char *orig, size_t len,
173
- void *data)
171
+ char *(*generate)(void),
172
+ const char *orig, size_t len)
173
{
174
struct anonymized_entry_key key;
175
struct anonymized_entry *ret;
188
/* ...and finally generate a new mapping if necessary */
189
if (!ret)
190
ret = add_anonymized_entry(map, key.hash.hash,
192
- orig, len, generate(data));
191
+ orig, len, generate());
192
193
return ret->anon;
194
}
201
*/
202
static void anonymize_path(struct strbuf *out, const char *path,
203
struct hashmap *map,
205
- char *(*generate)(void *))
204
+ char *(*generate)(void))
205
{
206
while (*path) {
207
const char *end_of_component = strchrnul(path, '/');
208
size_t len = end_of_component - path;
210
- const char *c = anonymize_str(map, generate, path, len, NULL);
209
+ const char *c = anonymize_str(map, generate, path, len);
210
strbuf_addstr(out, c);
211
path = end_of_component;
212
if (*path)
381
printf("%s", path);
382
}
383
385
-static char *anonymize_path_component(void *data)
384
+static char *anonymize_path_component(void)
385
{
386
static int counter;
387
struct strbuf out = STRBUF_INIT;
403
}
404
}
405
407
-static char *generate_fake_oid(void *data)
406
+static char *generate_fake_oid(void)
407
{
408
static uint32_t counter = 1; /* avoid null oid */
409
const unsigned hashsz = the_hash_algo->rawsz;
419
{
420
static struct hashmap objs;
421
size_t len = strlen(oid_hex);
423
- return anonymize_str(&objs, generate_fake_oid, oid_hex, len, NULL);
422
+ return anonymize_str(&objs, generate_fake_oid, oid_hex, len);
423
}
424
425
static void show_filemodify(struct diff_queue_struct *q,
516
return bol;
517
}
518
520
-static char *anonymize_ref_component(void *data)
519
+static char *anonymize_ref_component(void)
520
{
521
static int counter;
522
struct strbuf out = STRBUF_INIT;
562
return xstrfmt("subject %d\n\nbody\n", counter++);
563
}
564
566
-static char *anonymize_ident(void *data)
565
+static char *anonymize_ident(void)
566
{
567
static int counter;
568
struct strbuf out = STRBUF_INIT;
605
606
len = split.mail_end - split.name_begin;
607
ident = anonymize_str(&idents, anonymize_ident,
609
- split.name_begin, len, NULL);
608
+ split.name_begin, len);
609
strbuf_addstr(out, ident);
610
strbuf_addch(out, ' ');
611
strbuf_add(out, split.date_begin, split.tz_end - split.date_begin);
746
show_progress();
747
}
748
750
-static char *anonymize_tag(void *data)
749
+static char *anonymize_tag(void)
750
{
751
static int counter;
752
struct strbuf out = STRBUF_INIT;
808
if (message) {
809
static struct hashmap tags;
810
message = anonymize_str(&tags, anonymize_tag,
812
- message, message_size, NULL);
811
+ message, message_size);
812
message_size = strlen(message);
813
}
814
}