From cb9da0bf38c18e6406bbba4f5373fb41e4dac2f5 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 29 Feb 2012 15:07:32 -0500 Subject: Fix all identifiers with names beginning with underscore. These are reserved in C. We'd been erroneously using them to indicate internal use. Instead, we now use a trailing underscore whenever we'd been using a leading underscore. This is an automatic conversion. The script that produced was made by running the following script over the output of git ls-tree -r --name-only HEAD | grep '\.[ch]$' | \ xargs ctags --c-kinds=defglmpstuvx -o - | grep '^_' | \ cut -f 1 | sort| uniq (GNU ctags was required.) ===== #!/usr/bin/perl -w -n use strict; BEGIN { print "#!/usr/bin/perl -w -i -p\n\n"; } chomp; next if (/^__func__/ or /^_FILE_OFFSET_BITS/ or /^_FORTIFY_SOURCE/ or /^_GNU_SOURCE/ or /^_WIN32/ or /^_DARWIN_UNLIMITED/ or /^_FILE_OFFSET_BITS/ or /^_LARGEFILE64_SOURCE/ or /^_LFS64_LARGEFILE/ or /^__cdecl/ or /^__attribute__/ or /^__func__/ or /^_SYS_TREE_H_/); my $ident = $_; my $better = $ident; $better =~ s/^_//; if ($ident !~ /EVENT_LOG_/) { $better = "${better}_"; } print "s/(? */ #ifndef TAILQ_ENTRY -#define _EVENT_DEFINED_TQENTRY +#define EVENT_DEFINED_TQENTRY_ #define TAILQ_ENTRY(type) \ struct { \ struct type *tqe_next; /* next element */ \ @@ -75,7 +75,7 @@ struct { \ #endif /* !TAILQ_ENTRY */ #ifndef TAILQ_HEAD -#define _EVENT_DEFINED_TQHEAD +#define EVENT_DEFINED_TQHEAD_ #define TAILQ_HEAD(name, type) \ struct name { \ struct type *tqh_first; \ @@ -85,7 +85,7 @@ struct name { \ /* Fix so that people don't have to run with */ #ifndef LIST_ENTRY -#define _EVENT_DEFINED_LISTENTRY +#define EVENT_DEFINED_LISTENTRY_ #define LIST_ENTRY(type) \ struct { \ struct type *le_next; /* next element */ \ @@ -120,7 +120,7 @@ struct event { /* Allows deletes in callback */ short *ev_pncalls; } ev_signal; - } _ev; + } ev_; short ev_events; short ev_res; /* result passed to event callback */ @@ -136,21 +136,21 @@ struct event { TAILQ_HEAD (event_list, event); -#ifdef _EVENT_DEFINED_TQENTRY +#ifdef EVENT_DEFINED_TQENTRY_ #undef TAILQ_ENTRY #endif -#ifdef _EVENT_DEFINED_TQHEAD +#ifdef EVENT_DEFINED_TQHEAD_ #undef TAILQ_HEAD #endif -#ifdef _EVENT_DEFINED_LISTENTRY +#ifdef EVENT_DEFINED_LISTENTRY_ #undef LIST_ENTRY struct event_dlist; -#undef _EVENT_DEFINED_LISTENTRY +#undef EVENT_DEFINED_LISTENTRY_ #else LIST_HEAD (event_dlist, event); -#endif /* _EVENT_DEFINED_LISTENTRY */ +#endif /* EVENT_DEFINED_LISTENTRY_ */ #ifdef __cplusplus } -- cgit v1.2.1