]> granicus.if.org Git - libevent/log
libevent
12 years agoMerge remote-tracking branch 'ross/eventarg-v2'
Nick Mathewson [Tue, 13 Mar 2012 23:11:11 +0000 (19:11 -0400)]
Merge remote-tracking branch 'ross/eventarg-v2'

12 years agoMerge remote-tracking branch 'origin/patches-2.0'
Nick Mathewson [Tue, 13 Mar 2012 19:56:35 +0000 (15:56 -0400)]
Merge remote-tracking branch 'origin/patches-2.0'

Conflicts:
configure.in

12 years agoMerge remote-tracking branch 'sebastian/clang_unknown_warning_options' into patches-2.0
Nick Mathewson [Tue, 13 Mar 2012 19:49:49 +0000 (15:49 -0400)]
Merge remote-tracking branch 'sebastian/clang_unknown_warning_options' into patches-2.0

12 years agoAdd a test for using event_self_cbarg() with event_assign().
Ross Lagerwall [Tue, 13 Mar 2012 19:42:40 +0000 (21:42 +0200)]
Add a test for using event_self_cbarg() with event_assign().

12 years agoevent_self_cbarg() works with event_assign() for consistency with event_new().
Ross Lagerwall [Tue, 13 Mar 2012 19:41:22 +0000 (21:41 +0200)]
event_self_cbarg() works with event_assign() for consistency with event_new().

12 years agoProperly zero the kevent in kq_setup_kevent()
Sebastian Hahn [Tue, 13 Mar 2012 07:33:06 +0000 (08:33 +0100)]
Properly zero the kevent in kq_setup_kevent()

Detected by clang

12 years agoDon't do clang version detection when disabling some flags
Sebastian Hahn [Tue, 13 Mar 2012 05:40:56 +0000 (06:40 +0100)]
Don't do clang version detection when disabling some flags

When clang 2.9 was around we hoped they'd introduce support for the
normalized=id and override-init warnings by 3.0, but they haven't. We
should only add the version detection back in when clang actually
supports those warnings.

12 years agoAdd a regression test for event_self_cbarg().
Ross Lagerwall [Mon, 12 Mar 2012 19:32:45 +0000 (21:32 +0200)]
Add a regression test for event_self_cbarg().

12 years agoUpdate sample/signal-test.c to use the new event_self_cbarg().
Ross Lagerwall [Mon, 12 Mar 2012 18:54:32 +0000 (20:54 +0200)]
Update sample/signal-test.c to use the new event_self_cbarg().

12 years agoAdd event_self_cbarg() to be used in conjunction with event_new().
Ross Lagerwall [Mon, 12 Mar 2012 18:42:39 +0000 (20:42 +0200)]
Add event_self_cbarg() to be used in conjunction with event_new().

event_self_cbarg() returns a magic value which makes event_new()
pass the event itself as the callback argument.

12 years agoMerge pull request #43 from rosslagerwall/build-output
Nick Mathewson [Tue, 6 Mar 2012 14:50:57 +0000 (06:50 -0800)]
Merge pull request #43 from rosslagerwall/build-output

Print status information to stdout for event_rpcgen.py

12 years agoevent_rpcgen.py now prints status information to stdout and errors to stderr.
Ross Lagerwall [Tue, 6 Mar 2012 04:05:04 +0000 (06:05 +0200)]
event_rpcgen.py now prints status information to stdout and errors to stderr.

Before, running make > /dev/null would result in status information cluttering
the error log. This changes it so that event_rpcgen.py prints status
information to stdout like the rest of the build tools.

12 years agoAdd netinet/in.h include to fix test-fdleak on openbsd
Nick Mathewson [Thu, 1 Mar 2012 00:36:17 +0000 (19:36 -0500)]
Add netinet/in.h include to fix test-fdleak on openbsd

12 years agoRestore accidentally disabled nanosleep implementation of evutil_usleep.
Nick Mathewson [Wed, 29 Feb 2012 22:36:12 +0000 (17:36 -0500)]
Restore accidentally disabled nanosleep implementation of evutil_usleep.

12 years agoFix doxygen to use new macro conventions
Nick Mathewson [Wed, 29 Feb 2012 20:48:59 +0000 (15:48 -0500)]
Fix doxygen to use new macro conventions

12 years agoClean up lingering _identifiers.
Nick Mathewson [Wed, 29 Feb 2012 20:47:16 +0000 (15:47 -0500)]
Clean up lingering _identifiers.

12 years agoApply the naming convention to our EVUTIL_IS* functions
Nick Mathewson [Wed, 29 Feb 2012 20:07:33 +0000 (15:07 -0500)]
Apply the naming convention to our EVUTIL_IS* functions

12 years agoHave all visible internal function names end with an underscore.
Nick Mathewson [Wed, 29 Feb 2012 20:07:33 +0000 (15:07 -0500)]
Have all visible internal function names end with an underscore.

We haven't had a convention for naming internal functions in -internal.h
versus naming visible functions in include/**.h.  This patch changes every
function declared in a -internal.h file to be named ending with an
underscore.

Static function names are unaffected, since there's no risk of calling them
from outside Libevent.

This is an automatic conversion.  The script that produced was made by
running the following script over the output of

ctags --c-kinds=pf -o - *-internal.h |  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;

my $ident = $_;

next if ($ident =~ /_$/);
next if ($ident =~ /^TAILQ/);

my $better = "${ident}_";

print "s/(?<![A-Za-z0-9_])$ident(?![A-Za-z0-9_])/$better/g;\n";

=== And then running the script below that it generated over all
=== the .c and .h files again
#!/usr/bin/perl -w -i -p

s/(?<![A-Za-z0-9_])bufferevent_async_can_connect(?![A-Za-z0-9_])/bufferevent_async_can_connect_/g;
s/(?<![A-Za-z0-9_])bufferevent_async_connect(?![A-Za-z0-9_])/bufferevent_async_connect_/g;
s/(?<![A-Za-z0-9_])bufferevent_async_new(?![A-Za-z0-9_])/bufferevent_async_new_/g;
s/(?<![A-Za-z0-9_])bufferevent_async_set_connected(?![A-Za-z0-9_])/bufferevent_async_set_connected_/g;
s/(?<![A-Za-z0-9_])bufferevent_decref(?![A-Za-z0-9_])/bufferevent_decref_/g;
s/(?<![A-Za-z0-9_])bufferevent_disable_hard(?![A-Za-z0-9_])/bufferevent_disable_hard_/g;
s/(?<![A-Za-z0-9_])bufferevent_enable_locking(?![A-Za-z0-9_])/bufferevent_enable_locking_/g;
s/(?<![A-Za-z0-9_])bufferevent_incref(?![A-Za-z0-9_])/bufferevent_incref_/g;
s/(?<![A-Za-z0-9_])bufferevent_init_common(?![A-Za-z0-9_])/bufferevent_init_common_/g;
s/(?<![A-Za-z0-9_])bufferevent_remove_from_rate_limit_group_internal(?![A-Za-z0-9_])/bufferevent_remove_from_rate_limit_group_internal_/g;
s/(?<![A-Za-z0-9_])bufferevent_suspend_read(?![A-Za-z0-9_])/bufferevent_suspend_read_/g;
s/(?<![A-Za-z0-9_])bufferevent_suspend_write(?![A-Za-z0-9_])/bufferevent_suspend_write_/g;
s/(?<![A-Za-z0-9_])bufferevent_unsuspend_read(?![A-Za-z0-9_])/bufferevent_unsuspend_read_/g;
s/(?<![A-Za-z0-9_])bufferevent_unsuspend_write(?![A-Za-z0-9_])/bufferevent_unsuspend_write_/g;
s/(?<![A-Za-z0-9_])evbuffer_commit_read(?![A-Za-z0-9_])/evbuffer_commit_read_/g;
s/(?<![A-Za-z0-9_])evbuffer_commit_write(?![A-Za-z0-9_])/evbuffer_commit_write_/g;
s/(?<![A-Za-z0-9_])evbuffer_invoke_callbacks(?![A-Za-z0-9_])/evbuffer_invoke_callbacks_/g;
s/(?<![A-Za-z0-9_])evbuffer_launch_read(?![A-Za-z0-9_])/evbuffer_launch_read_/g;
s/(?<![A-Za-z0-9_])evbuffer_launch_write(?![A-Za-z0-9_])/evbuffer_launch_write_/g;
s/(?<![A-Za-z0-9_])evbuffer_overlapped_new(?![A-Za-z0-9_])/evbuffer_overlapped_new_/g;
s/(?<![A-Za-z0-9_])evbuffer_set_parent(?![A-Za-z0-9_])/evbuffer_set_parent_/g;
s/(?<![A-Za-z0-9_])event_active_nolock(?![A-Za-z0-9_])/event_active_nolock_/g;
s/(?<![A-Za-z0-9_])event_base_add_virtual(?![A-Za-z0-9_])/event_base_add_virtual_/g;
s/(?<![A-Za-z0-9_])event_base_assert_ok(?![A-Za-z0-9_])/event_base_assert_ok_/g;
s/(?<![A-Za-z0-9_])event_base_del_virtual(?![A-Za-z0-9_])/event_base_del_virtual_/g;
s/(?<![A-Za-z0-9_])event_base_get_deferred_cb_queue(?![A-Za-z0-9_])/event_base_get_deferred_cb_queue_/g;
s/(?<![A-Za-z0-9_])event_base_get_iocp(?![A-Za-z0-9_])/event_base_get_iocp_/g;
s/(?<![A-Za-z0-9_])event_base_start_iocp(?![A-Za-z0-9_])/event_base_start_iocp_/g;
s/(?<![A-Za-z0-9_])event_base_stop_iocp(?![A-Za-z0-9_])/event_base_stop_iocp_/g;
s/(?<![A-Za-z0-9_])event_changelist_add(?![A-Za-z0-9_])/event_changelist_add_/g;
s/(?<![A-Za-z0-9_])event_changelist_del(?![A-Za-z0-9_])/event_changelist_del_/g;
s/(?<![A-Za-z0-9_])event_changelist_freemem(?![A-Za-z0-9_])/event_changelist_freemem_/g;
s/(?<![A-Za-z0-9_])event_changelist_init(?![A-Za-z0-9_])/event_changelist_init_/g;
s/(?<![A-Za-z0-9_])event_changelist_remove_all(?![A-Za-z0-9_])/event_changelist_remove_all_/g;
s/(?<![A-Za-z0-9_])event_deferred_cb_cancel(?![A-Za-z0-9_])/event_deferred_cb_cancel_/g;
s/(?<![A-Za-z0-9_])event_deferred_cb_init(?![A-Za-z0-9_])/event_deferred_cb_init_/g;
s/(?<![A-Za-z0-9_])event_deferred_cb_queue_init(?![A-Za-z0-9_])/event_deferred_cb_queue_init_/g;
s/(?<![A-Za-z0-9_])event_deferred_cb_schedule(?![A-Za-z0-9_])/event_deferred_cb_schedule_/g;
s/(?<![A-Za-z0-9_])event_get_win32_extension_fns(?![A-Za-z0-9_])/event_get_win32_extension_fns_/g;
s/(?<![A-Za-z0-9_])event_iocp_activate_overlapped(?![A-Za-z0-9_])/event_iocp_activate_overlapped_/g;
s/(?<![A-Za-z0-9_])event_iocp_port_associate(?![A-Za-z0-9_])/event_iocp_port_associate_/g;
s/(?<![A-Za-z0-9_])event_iocp_port_launch(?![A-Za-z0-9_])/event_iocp_port_launch_/g;
s/(?<![A-Za-z0-9_])event_iocp_shutdown(?![A-Za-z0-9_])/event_iocp_shutdown_/g;
s/(?<![A-Za-z0-9_])event_overlapped_init(?![A-Za-z0-9_])/event_overlapped_init_/g;
s/(?<![A-Za-z0-9_])evhttp_connection_connect(?![A-Za-z0-9_])/evhttp_connection_connect_/g;
s/(?<![A-Za-z0-9_])evhttp_connection_fail(?![A-Za-z0-9_])/evhttp_connection_fail_/g;
s/(?<![A-Za-z0-9_])evhttp_connection_reset(?![A-Za-z0-9_])/evhttp_connection_reset_/g;
s/(?<![A-Za-z0-9_])evhttp_parse_firstline(?![A-Za-z0-9_])/evhttp_parse_firstline_/g;
s/(?<![A-Za-z0-9_])evhttp_parse_headers(?![A-Za-z0-9_])/evhttp_parse_headers_/g;
s/(?<![A-Za-z0-9_])evhttp_response_code(?![A-Za-z0-9_])/evhttp_response_code_/g;
s/(?<![A-Za-z0-9_])evhttp_send_page(?![A-Za-z0-9_])/evhttp_send_page_/g;
s/(?<![A-Za-z0-9_])evhttp_start_read(?![A-Za-z0-9_])/evhttp_start_read_/g;
s/(?<![A-Za-z0-9_])EVLOCK_TRY_LOCK(?![A-Za-z0-9_])/EVLOCK_TRY_LOCK_/g;
s/(?<![A-Za-z0-9_])evmap_check_integrity(?![A-Za-z0-9_])/evmap_check_integrity_/g;
s/(?<![A-Za-z0-9_])evmap_delete_all(?![A-Za-z0-9_])/evmap_delete_all_/g;
s/(?<![A-Za-z0-9_])evmap_foreach_event(?![A-Za-z0-9_])/evmap_foreach_event_/g;
s/(?<![A-Za-z0-9_])evmap_io_active(?![A-Za-z0-9_])/evmap_io_active_/g;
s/(?<![A-Za-z0-9_])evmap_io_add(?![A-Za-z0-9_])/evmap_io_add_/g;
s/(?<![A-Za-z0-9_])evmap_io_clear(?![A-Za-z0-9_])/evmap_io_clear_/g;
s/(?<![A-Za-z0-9_])evmap_io_del(?![A-Za-z0-9_])/evmap_io_del_/g;
s/(?<![A-Za-z0-9_])evmap_io_get_fdinfo(?![A-Za-z0-9_])/evmap_io_get_fdinfo_/g;
s/(?<![A-Za-z0-9_])evmap_io_initmap(?![A-Za-z0-9_])/evmap_io_initmap_/g;
s/(?<![A-Za-z0-9_])evmap_reinit(?![A-Za-z0-9_])/evmap_reinit_/g;
s/(?<![A-Za-z0-9_])evmap_signal_active(?![A-Za-z0-9_])/evmap_signal_active_/g;
s/(?<![A-Za-z0-9_])evmap_signal_add(?![A-Za-z0-9_])/evmap_signal_add_/g;
s/(?<![A-Za-z0-9_])evmap_signal_clear(?![A-Za-z0-9_])/evmap_signal_clear_/g;
s/(?<![A-Za-z0-9_])evmap_signal_del(?![A-Za-z0-9_])/evmap_signal_del_/g;
s/(?<![A-Za-z0-9_])evmap_signal_initmap(?![A-Za-z0-9_])/evmap_signal_initmap_/g;
s/(?<![A-Za-z0-9_])evrpc_hook_associate_meta(?![A-Za-z0-9_])/evrpc_hook_associate_meta_/g;
s/(?<![A-Za-z0-9_])evrpc_hook_context_free(?![A-Za-z0-9_])/evrpc_hook_context_free_/g;
s/(?<![A-Za-z0-9_])evrpc_hook_meta_new(?![A-Za-z0-9_])/evrpc_hook_meta_new_/g;
s/(?<![A-Za-z0-9_])evrpc_reqstate_free(?![A-Za-z0-9_])/evrpc_reqstate_free_/g;
s/(?<![A-Za-z0-9_])evsig_dealloc(?![A-Za-z0-9_])/evsig_dealloc_/g;
s/(?<![A-Za-z0-9_])evsig_init(?![A-Za-z0-9_])/evsig_init_/g;
s/(?<![A-Za-z0-9_])evsig_set_base(?![A-Za-z0-9_])/evsig_set_base_/g;
s/(?<![A-Za-z0-9_])ev_token_bucket_get_tick(?![A-Za-z0-9_])/ev_token_bucket_get_tick_/g;
s/(?<![A-Za-z0-9_])ev_token_bucket_init(?![A-Za-z0-9_])/ev_token_bucket_init_/g;
s/(?<![A-Za-z0-9_])ev_token_bucket_update(?![A-Za-z0-9_])/ev_token_bucket_update_/g;
s/(?<![A-Za-z0-9_])evutil_accept4(?![A-Za-z0-9_])/evutil_accept4_/g;
s/(?<![A-Za-z0-9_])evutil_addrinfo_append(?![A-Za-z0-9_])/evutil_addrinfo_append_/g;
s/(?<![A-Za-z0-9_])evutil_adjust_hints_for_addrconfig(?![A-Za-z0-9_])/evutil_adjust_hints_for_addrconfig_/g;
s/(?<![A-Za-z0-9_])evutil_ersatz_socketpair(?![A-Za-z0-9_])/evutil_ersatz_socketpair_/g;
s/(?<![A-Za-z0-9_])evutil_eventfd(?![A-Za-z0-9_])/evutil_eventfd_/g;
s/(?<![A-Za-z0-9_])evutil_format_sockaddr_port(?![A-Za-z0-9_])/evutil_format_sockaddr_port_/g;
s/(?<![A-Za-z0-9_])evutil_getaddrinfo_async(?![A-Za-z0-9_])/evutil_getaddrinfo_async_/g;
s/(?<![A-Za-z0-9_])evutil_getaddrinfo_common(?![A-Za-z0-9_])/evutil_getaddrinfo_common_/g;
s/(?<![A-Za-z0-9_])evutil_getenv(?![A-Za-z0-9_])/evutil_getenv_/g;
s/(?<![A-Za-z0-9_])evutil_hex_char_to_int(?![A-Za-z0-9_])/evutil_hex_char_to_int_/g;
s/(?<![A-Za-z0-9_])EVUTIL_ISALNUM(?![A-Za-z0-9_])/EVUTIL_ISALNUM_/g;
s/(?<![A-Za-z0-9_])EVUTIL_ISALPHA(?![A-Za-z0-9_])/EVUTIL_ISALPHA_/g;
s/(?<![A-Za-z0-9_])EVUTIL_ISDIGIT(?![A-Za-z0-9_])/EVUTIL_ISDIGIT_/g;
s/(?<![A-Za-z0-9_])EVUTIL_ISLOWER(?![A-Za-z0-9_])/EVUTIL_ISLOWER_/g;
s/(?<![A-Za-z0-9_])EVUTIL_ISPRINT(?![A-Za-z0-9_])/EVUTIL_ISPRINT_/g;
s/(?<![A-Za-z0-9_])EVUTIL_ISSPACE(?![A-Za-z0-9_])/EVUTIL_ISSPACE_/g;
s/(?<![A-Za-z0-9_])EVUTIL_ISUPPER(?![A-Za-z0-9_])/EVUTIL_ISUPPER_/g;
s/(?<![A-Za-z0-9_])EVUTIL_ISXDIGIT(?![A-Za-z0-9_])/EVUTIL_ISXDIGIT_/g;
s/(?<![A-Za-z0-9_])evutil_load_windows_system_library(?![A-Za-z0-9_])/evutil_load_windows_system_library_/g;
s/(?<![A-Za-z0-9_])evutil_make_internal_pipe(?![A-Za-z0-9_])/evutil_make_internal_pipe_/g;
s/(?<![A-Za-z0-9_])evutil_new_addrinfo(?![A-Za-z0-9_])/evutil_new_addrinfo_/g;
s/(?<![A-Za-z0-9_])evutil_open_closeonexec(?![A-Za-z0-9_])/evutil_open_closeonexec_/g;
s/(?<![A-Za-z0-9_])evutil_read_file(?![A-Za-z0-9_])/evutil_read_file_/g;
s/(?<![A-Za-z0-9_])evutil_resolve(?![A-Za-z0-9_])/evutil_resolve_/g;
s/(?<![A-Za-z0-9_])evutil_set_evdns_getaddrinfo_fn(?![A-Za-z0-9_])/evutil_set_evdns_getaddrinfo_fn_/g;
s/(?<![A-Za-z0-9_])evutil_sockaddr_is_loopback(?![A-Za-z0-9_])/evutil_sockaddr_is_loopback_/g;
s/(?<![A-Za-z0-9_])evutil_socket(?![A-Za-z0-9_])/evutil_socket_/g;
s/(?<![A-Za-z0-9_])evutil_socket_connect(?![A-Za-z0-9_])/evutil_socket_connect_/g;
s/(?<![A-Za-z0-9_])evutil_socket_finished_connecting(?![A-Za-z0-9_])/evutil_socket_finished_connecting_/g;
s/(?<![A-Za-z0-9_])EVUTIL_TOLOWER(?![A-Za-z0-9_])/EVUTIL_TOLOWER_/g;
s/(?<![A-Za-z0-9_])EVUTIL_TOUPPER(?![A-Za-z0-9_])/EVUTIL_TOUPPER_/g;
s/(?<![A-Za-z0-9_])evutil_tv_to_msec(?![A-Za-z0-9_])/evutil_tv_to_msec_/g;
s/(?<![A-Za-z0-9_])evutil_usleep(?![A-Za-z0-9_])/evutil_usleep_/g;
s/(?<![A-Za-z0-9_])ht_improve_hash(?![A-Za-z0-9_])/ht_improve_hash_/g;
s/(?<![A-Za-z0-9_])ht_string_hash(?![A-Za-z0-9_])/ht_string_hash_/g;
s/(?<![A-Za-z0-9_])min_heap_adjust(?![A-Za-z0-9_])/min_heap_adjust_/g;
s/(?<![A-Za-z0-9_])min_heap_ctor(?![A-Za-z0-9_])/min_heap_ctor_/g;
s/(?<![A-Za-z0-9_])min_heap_dtor(?![A-Za-z0-9_])/min_heap_dtor_/g;
s/(?<![A-Za-z0-9_])min_heap_elem_init(?![A-Za-z0-9_])/min_heap_elem_init_/g;
s/(?<![A-Za-z0-9_])min_heap_elt_is_top(?![A-Za-z0-9_])/min_heap_elt_is_top_/g;
s/(?<![A-Za-z0-9_])min_heap_empty(?![A-Za-z0-9_])/min_heap_empty_/g;
s/(?<![A-Za-z0-9_])min_heap_erase(?![A-Za-z0-9_])/min_heap_erase_/g;
s/(?<![A-Za-z0-9_])min_heap_pop(?![A-Za-z0-9_])/min_heap_pop_/g;
s/(?<![A-Za-z0-9_])min_heap_push(?![A-Za-z0-9_])/min_heap_push_/g;
s/(?<![A-Za-z0-9_])min_heap_reserve(?![A-Za-z0-9_])/min_heap_reserve_/g;
s/(?<![A-Za-z0-9_])min_heap_size(?![A-Za-z0-9_])/min_heap_size_/g;
s/(?<![A-Za-z0-9_])min_heap_top(?![A-Za-z0-9_])/min_heap_top_/g;

12 years agoFix some problems introduced by automated identifier cleanup script
Nick Mathewson [Wed, 29 Feb 2012 20:07:32 +0000 (15:07 -0500)]
Fix some problems introduced by automated identifier cleanup script

12 years agoMake event_rpcgen.py output conform to indentifier conventions, more
Nick Mathewson [Wed, 29 Feb 2012 20:07:32 +0000 (15:07 -0500)]
Make event_rpcgen.py output conform to indentifier conventions, more

12 years agoFix all identifiers with names beginning with underscore.
Nick Mathewson [Wed, 29 Feb 2012 20:07:32 +0000 (15:07 -0500)]
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/(?<![A-Za-z0-9_])$ident(?![A-Za-z0-9_])/$better/g;\n";

=== And then running the script below that it generated over all
=== the .c and .h files again
#!/usr/bin/perl -w -i -p

s/(?<![A-Za-z0-9_])_ARC4_LOCK(?![A-Za-z0-9_])/ARC4_LOCK_/g;
s/(?<![A-Za-z0-9_])_ARC4_UNLOCK(?![A-Za-z0-9_])/ARC4_UNLOCK_/g;
s/(?<![A-Za-z0-9_])_bev_group_random_element(?![A-Za-z0-9_])/bev_group_random_element_/g;
s/(?<![A-Za-z0-9_])_bev_group_refill_callback(?![A-Za-z0-9_])/bev_group_refill_callback_/g;
s/(?<![A-Za-z0-9_])_bev_group_suspend_reading(?![A-Za-z0-9_])/bev_group_suspend_reading_/g;
s/(?<![A-Za-z0-9_])_bev_group_suspend_writing(?![A-Za-z0-9_])/bev_group_suspend_writing_/g;
s/(?<![A-Za-z0-9_])_bev_group_unsuspend_reading(?![A-Za-z0-9_])/bev_group_unsuspend_reading_/g;
s/(?<![A-Za-z0-9_])_bev_group_unsuspend_writing(?![A-Za-z0-9_])/bev_group_unsuspend_writing_/g;
s/(?<![A-Za-z0-9_])_bev_refill_callback(?![A-Za-z0-9_])/bev_refill_callback_/g;
s/(?<![A-Za-z0-9_])_bufferevent_add_event(?![A-Za-z0-9_])/bufferevent_add_event_/g;
s/(?<![A-Za-z0-9_])_bufferevent_cancel_all(?![A-Za-z0-9_])/bufferevent_cancel_all_/g;
s/(?<![A-Za-z0-9_])_bufferevent_decref_and_unlock(?![A-Za-z0-9_])/bufferevent_decref_and_unlock_/g;
s/(?<![A-Za-z0-9_])_bufferevent_decrement_read_buckets(?![A-Za-z0-9_])/bufferevent_decrement_read_buckets_/g;
s/(?<![A-Za-z0-9_])_bufferevent_decrement_write_buckets(?![A-Za-z0-9_])/bufferevent_decrement_write_buckets_/g;
s/(?<![A-Za-z0-9_])_bufferevent_del_generic_timeout_cbs(?![A-Za-z0-9_])/bufferevent_del_generic_timeout_cbs_/g;
s/(?<![A-Za-z0-9_])_bufferevent_generic_adj_timeouts(?![A-Za-z0-9_])/bufferevent_generic_adj_timeouts_/g;
s/(?<![A-Za-z0-9_])_bufferevent_get_read_max(?![A-Za-z0-9_])/bufferevent_get_read_max_/g;
s/(?<![A-Za-z0-9_])_bufferevent_get_rlim_max(?![A-Za-z0-9_])/bufferevent_get_rlim_max_/g;
s/(?<![A-Za-z0-9_])_bufferevent_get_write_max(?![A-Za-z0-9_])/bufferevent_get_write_max_/g;
s/(?<![A-Za-z0-9_])_bufferevent_incref_and_lock(?![A-Za-z0-9_])/bufferevent_incref_and_lock_/g;
s/(?<![A-Za-z0-9_])_bufferevent_init_generic_timeout_cbs(?![A-Za-z0-9_])/bufferevent_init_generic_timeout_cbs_/g;
s/(?<![A-Za-z0-9_])_bufferevent_ratelim_init(?![A-Za-z0-9_])/bufferevent_ratelim_init_/g;
s/(?<![A-Za-z0-9_])_bufferevent_run_eventcb(?![A-Za-z0-9_])/bufferevent_run_eventcb_/g;
s/(?<![A-Za-z0-9_])_bufferevent_run_readcb(?![A-Za-z0-9_])/bufferevent_run_readcb_/g;
s/(?<![A-Za-z0-9_])_bufferevent_run_writecb(?![A-Za-z0-9_])/bufferevent_run_writecb_/g;
s/(?<![A-Za-z0-9_])_ev(?![A-Za-z0-9_])/ev_/g;
s/(?<![A-Za-z0-9_])_evbuffer_chain_pin(?![A-Za-z0-9_])/evbuffer_chain_pin_/g;
s/(?<![A-Za-z0-9_])_evbuffer_chain_unpin(?![A-Za-z0-9_])/evbuffer_chain_unpin_/g;
s/(?<![A-Za-z0-9_])_evbuffer_decref_and_unlock(?![A-Za-z0-9_])/evbuffer_decref_and_unlock_/g;
s/(?<![A-Za-z0-9_])_evbuffer_expand_fast(?![A-Za-z0-9_])/evbuffer_expand_fast_/g;
s/(?<![A-Za-z0-9_])_evbuffer_incref(?![A-Za-z0-9_])/evbuffer_incref_/g;
s/(?<![A-Za-z0-9_])_evbuffer_incref_and_lock(?![A-Za-z0-9_])/evbuffer_incref_and_lock_/g;
s/(?<![A-Za-z0-9_])_EVBUFFER_IOVEC_IS_NATIVE(?![A-Za-z0-9_])/EVBUFFER_IOVEC_IS_NATIVE_/g;
s/(?<![A-Za-z0-9_])_evbuffer_overlapped_get_fd(?![A-Za-z0-9_])/evbuffer_overlapped_get_fd_/g;
s/(?<![A-Za-z0-9_])_evbuffer_overlapped_set_fd(?![A-Za-z0-9_])/evbuffer_overlapped_set_fd_/g;
s/(?<![A-Za-z0-9_])_evbuffer_read_setup_vecs(?![A-Za-z0-9_])/evbuffer_read_setup_vecs_/g;
s/(?<![A-Za-z0-9_])_evbuffer_validate(?![A-Za-z0-9_])/evbuffer_validate_/g;
s/(?<![A-Za-z0-9_])_evdns_log(?![A-Za-z0-9_])/evdns_log_/g;
s/(?<![A-Za-z0-9_])_evdns_nameserver_add_impl(?![A-Za-z0-9_])/evdns_nameserver_add_impl_/g;
s/(?<![A-Za-z0-9_])_EVENT_CONFIG_H_(?![A-Za-z0-9_])/EVENT_CONFIG_H__/g;
s/(?<![A-Za-z0-9_])_event_debug_assert_is_setup(?![A-Za-z0-9_])/event_debug_assert_is_setup_/g;
s/(?<![A-Za-z0-9_])_event_debug_assert_not_added(?![A-Za-z0-9_])/event_debug_assert_not_added_/g;
s/(?<![A-Za-z0-9_])_event_debug_get_logging_mask(?![A-Za-z0-9_])/event_debug_get_logging_mask_/g;
s/(?<![A-Za-z0-9_])_event_debug_logging_mask(?![A-Za-z0-9_])/event_debug_logging_mask_/g;
s/(?<![A-Za-z0-9_])_event_debug_map_lock(?![A-Za-z0-9_])/event_debug_map_lock_/g;
s/(?<![A-Za-z0-9_])_event_debug_mode_on(?![A-Za-z0-9_])/event_debug_mode_on_/g;
s/(?<![A-Za-z0-9_])_event_debug_note_add(?![A-Za-z0-9_])/event_debug_note_add_/g;
s/(?<![A-Za-z0-9_])_event_debug_note_del(?![A-Za-z0-9_])/event_debug_note_del_/g;
s/(?<![A-Za-z0-9_])_event_debug_note_setup(?![A-Za-z0-9_])/event_debug_note_setup_/g;
s/(?<![A-Za-z0-9_])_event_debug_note_teardown(?![A-Za-z0-9_])/event_debug_note_teardown_/g;
s/(?<![A-Za-z0-9_])_event_debugx(?![A-Za-z0-9_])/event_debugx_/g;
s/(?<![A-Za-z0-9_])_EVENT_DEFINED_LISTENTRY(?![A-Za-z0-9_])/EVENT_DEFINED_LISTENTRY_/g;
s/(?<![A-Za-z0-9_])_EVENT_DEFINED_TQENTRY(?![A-Za-z0-9_])/EVENT_DEFINED_TQENTRY_/g;
s/(?<![A-Za-z0-9_])_EVENT_DEFINED_TQHEAD(?![A-Za-z0-9_])/EVENT_DEFINED_TQHEAD_/g;
s/(?<![A-Za-z0-9_])_EVENT_DNS_USE_FTIME_FOR_ID(?![A-Za-z0-9_])/EVENT_DNS_USE_FTIME_FOR_ID_/g;
s/(?<![A-Za-z0-9_])_EVENT_ERR_ABORT(?![A-Za-z0-9_])/EVENT_ERR_ABORT_/g;
s/(?<![A-Za-z0-9_])_EVENT_EVCONFIG__PRIVATE_H(?![A-Za-z0-9_])/EVENT_EVCONFIG__PRIVATE_H_/g;
s/(?<![A-Za-z0-9_])_event_iocp_port_unlock_and_free(?![A-Za-z0-9_])/event_iocp_port_unlock_and_free_/g;
s/(?<![A-Za-z0-9_])_EVENT_LOG_DEBUG(?![A-Za-z0-9_])/EVENT_LOG_DEBUG/g;
s/(?<![A-Za-z0-9_])_EVENT_LOG_ERR(?![A-Za-z0-9_])/EVENT_LOG_ERR/g;
s/(?<![A-Za-z0-9_])_EVENT_LOG_MSG(?![A-Za-z0-9_])/EVENT_LOG_MSG/g;
s/(?<![A-Za-z0-9_])_EVENT_LOG_WARN(?![A-Za-z0-9_])/EVENT_LOG_WARN/g;
s/(?<![A-Za-z0-9_])_event_strlcpy(?![A-Za-z0-9_])/event_strlcpy_/g;
s/(?<![A-Za-z0-9_])_EVHTTP_REQ_UNKNOWN(?![A-Za-z0-9_])/EVHTTP_REQ_UNKNOWN_/g;
s/(?<![A-Za-z0-9_])_EVLOCK_SORTLOCKS(?![A-Za-z0-9_])/EVLOCK_SORTLOCKS_/g;
s/(?<![A-Za-z0-9_])_evrpc_hooks(?![A-Za-z0-9_])/evrpc_hooks_/g;
s/(?<![A-Za-z0-9_])_evsig_restore_handler(?![A-Za-z0-9_])/evsig_restore_handler_/g;
s/(?<![A-Za-z0-9_])_evsig_set_handler(?![A-Za-z0-9_])/evsig_set_handler_/g;
s/(?<![A-Za-z0-9_])_evthread_cond_fns(?![A-Za-z0-9_])/evthread_cond_fns_/g;
s/(?<![A-Za-z0-9_])_evthread_debug_get_real_lock(?![A-Za-z0-9_])/evthread_debug_get_real_lock_/g;
s/(?<![A-Za-z0-9_])_evthread_id_fn(?![A-Za-z0-9_])/evthread_id_fn_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_cond_alloc(?![A-Za-z0-9_])/evthreadimpl_cond_alloc_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_cond_free(?![A-Za-z0-9_])/evthreadimpl_cond_free_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_cond_signal(?![A-Za-z0-9_])/evthreadimpl_cond_signal_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_cond_wait(?![A-Za-z0-9_])/evthreadimpl_cond_wait_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_get_id(?![A-Za-z0-9_])/evthreadimpl_get_id_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_is_lock_debugging_enabled(?![A-Za-z0-9_])/evthreadimpl_is_lock_debugging_enabled_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_lock_alloc(?![A-Za-z0-9_])/evthreadimpl_lock_alloc_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_lock_free(?![A-Za-z0-9_])/evthreadimpl_lock_free_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_locking_enabled(?![A-Za-z0-9_])/evthreadimpl_locking_enabled_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_lock_lock(?![A-Za-z0-9_])/evthreadimpl_lock_lock_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_lock_unlock(?![A-Za-z0-9_])/evthreadimpl_lock_unlock_/g;
s/(?<![A-Za-z0-9_])_evthread_is_debug_lock_held(?![A-Za-z0-9_])/evthread_is_debug_lock_held_/g;
s/(?<![A-Za-z0-9_])_evthread_lock_debugging_enabled(?![A-Za-z0-9_])/evthread_lock_debugging_enabled_/g;
s/(?<![A-Za-z0-9_])_evthread_lock_fns(?![A-Za-z0-9_])/evthread_lock_fns_/g;
s/(?<![A-Za-z0-9_])_EVUTIL_NIL_CONDITION(?![A-Za-z0-9_])/EVUTIL_NIL_CONDITION_/g;
s/(?<![A-Za-z0-9_])_EVUTIL_NIL_STMT(?![A-Za-z0-9_])/EVUTIL_NIL_STMT_/g;
s/(?<![A-Za-z0-9_])_evutil_weakrand(?![A-Za-z0-9_])/evutil_weakrand_/g;
s/(?<![A-Za-z0-9_])_http_close_detection(?![A-Za-z0-9_])/http_close_detection_/g;
s/(?<![A-Za-z0-9_])_http_connection_test(?![A-Za-z0-9_])/http_connection_test_/g;
s/(?<![A-Za-z0-9_])_http_incomplete_test(?![A-Za-z0-9_])/http_incomplete_test_/g;
s/(?<![A-Za-z0-9_])_http_stream_in_test(?![A-Za-z0-9_])/http_stream_in_test_/g;
s/(?<![A-Za-z0-9_])_internal(?![A-Za-z0-9_])/internal_/g;
s/(?<![A-Za-z0-9_])_mm_free_fn(?![A-Za-z0-9_])/mm_free_fn_/g;
s/(?<![A-Za-z0-9_])_mm_malloc_fn(?![A-Za-z0-9_])/mm_malloc_fn_/g;
s/(?<![A-Za-z0-9_])_mm_realloc_fn(?![A-Za-z0-9_])/mm_realloc_fn_/g;
s/(?<![A-Za-z0-9_])_original_cond_fns(?![A-Za-z0-9_])/original_cond_fns_/g;
s/(?<![A-Za-z0-9_])_original_lock_fns(?![A-Za-z0-9_])/original_lock_fns_/g;
s/(?<![A-Za-z0-9_])_rpc_hook_ctx(?![A-Za-z0-9_])/rpc_hook_ctx_/g;
s/(?<![A-Za-z0-9_])_SYS_QUEUE_H_(?![A-Za-z0-9_])/SYS_QUEUE_H__/g;
s/(?<![A-Za-z0-9_])_t(?![A-Za-z0-9_])/t_/g;
s/(?<![A-Za-z0-9_])_t32(?![A-Za-z0-9_])/t32_/g;
s/(?<![A-Za-z0-9_])_test_ai_eq(?![A-Za-z0-9_])/test_ai_eq_/g;
s/(?<![A-Za-z0-9_])_URI_ADD(?![A-Za-z0-9_])/URI_ADD_/g;
s/(?<![A-Za-z0-9_])_URI_FREE_STR(?![A-Za-z0-9_])/URI_FREE_STR_/g;
s/(?<![A-Za-z0-9_])_URI_SET_STR(?![A-Za-z0-9_])/URI_SET_STR_/g;
s/(?<![A-Za-z0-9_])_warn_helper(?![A-Za-z0-9_])/warn_helper_/g;

12 years agoMake the generated event-config.h use correct include guards
Nick Mathewson [Wed, 29 Feb 2012 20:07:31 +0000 (15:07 -0500)]
Make the generated event-config.h use correct include guards

12 years agoStop referring to an obsolete include guard in bench_http.h
Nick Mathewson [Wed, 29 Feb 2012 20:07:31 +0000 (15:07 -0500)]
Stop referring to an obsolete include guard in bench_http.h

12 years agoMake event_rpcgen.py output conform to indentifier conventions
Nick Mathewson [Wed, 29 Feb 2012 20:07:31 +0000 (15:07 -0500)]
Make event_rpcgen.py output conform to indentifier conventions

12 years agoConvert include-guard macro convention to avoid reserved identifiers
Nick Mathewson [Wed, 29 Feb 2012 20:07:31 +0000 (15:07 -0500)]
Convert include-guard macro convention to avoid reserved identifiers

Previously we used include-guards with names like _EVENT2_EVENT_H_.
But C reserves macros beginning with an underscore for use by the
system.  This patch converts all include guards for files like
include/event2/<fname.h> to be of form EVENT2_<FNAME_H>_INCLUDED_,
and all Libevent 1.x headers in include/<fname.h> to be of the form
EVENT1_<FNAME_H>_INCLUDED_, and all internal libevent headers with
names like <fname.h> to the form <FNAME_H>_INCLUDED_.

FNAME_H is here derived from fname.h by replacing every
non-macro-usable character in fname.h with an underscore, and
putting every remaining character in uppercase.

This is an automatic conversion.  The script that produced was made by
running the following script over all header files:

=====
#!/usr/bin/perl -w

# Run this on every .h file except config.h, sys/queue.h, WIN32/event2/event-config.h

use strict;

my %macros = ();
my %skipped = ();
FILE: for my $fn (@ARGV) {
    my $f = $fn;
    if ($fn !~ /^\.\//) {
$f = "./$fn";
    }
    if ($f eq './config.h' or
$f =~ m#/tree.h$# or
$f =~ m#/queue.h# or
$f =~ m#/event-config.h# or
$f =~ m#/evconfig-private.h#) {
$skipped{$fn} = 1;
next FILE;
    }
    $skipped{$fn} = 0;
    open(F, $fn);
    while (<F>) {
if (/^#ifndef ([A-Za-z0-9_]+)/) {
    $macros{$fn} = $1;
    next FILE;
}
    }
}

print "#!/usr/bin/perl -w -i -p\n\n";
for my $fn (@ARGV) {
    if (! exists $macros{$fn}) {
print "# No macro known for $fn!\n" if (!$skipped{$fn});
    } else {
if ($macros{$fn} !~ /_H_?$/) {
    print "# Weird macro for $fn...\n";
}
my $goodmacro = uc $fn;
$goodmacro =~ s#^\./##;
$goodmacro =~ s#INCLUDE/EVENT2#EVENT2#;
$goodmacro =~ s#INCLUDE/#EVENT1_#;
$goodmacro =~ s#TEST/##;

$goodmacro =~ s#[\/\-\.]#_#g;

print "s/(?<![A-Za-z0-9_])$macros{$fn}(?![A-Za-z0-9_])/${goodmacro}_INCLUDED_/g;\n"
    }
}
=== And then running the script below that it generated over all
=== the .h files again
#!/usr/bin/perl -w -i -p

s/(?<![A-Za-z0-9_])_BUFFEREVENT_INTERNAL_H_(?![A-Za-z0-9_])/BUFFEREVENT_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_CHANGELIST_H_(?![A-Za-z0-9_])/CHANGELIST_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_DEFER_INTERNAL_H_(?![A-Za-z0-9_])/DEFER_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVBUFFER_INTERNAL_H_(?![A-Za-z0-9_])/EVBUFFER_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT_INTERNAL_H_(?![A-Za-z0-9_])/EVENT_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVMAP_H_(?![A-Za-z0-9_])/EVMAP_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVRPC_INTERNAL_H_(?![A-Za-z0-9_])/EVRPC_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVSIGNAL_H_(?![A-Za-z0-9_])/EVSIGNAL_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVTHREAD_INTERNAL_H_(?![A-Za-z0-9_])/EVTHREAD_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT_HT_H(?![A-Za-z0-9_])/HT_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_HTTP_INTERNAL_H_(?![A-Za-z0-9_])/HTTP_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVDNS_H_(?![A-Za-z0-9_])/EVENT1_EVDNS_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT_H_(?![A-Za-z0-9_])/EVENT1_EVENT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_BUFFER_H_(?![A-Za-z0-9_])/EVENT2_BUFFER_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_BUFFER_COMPAT_H_(?![A-Za-z0-9_])/EVENT2_BUFFER_COMPAT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_BUFFEREVENT_H_(?![A-Za-z0-9_])/EVENT2_BUFFEREVENT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_BUFFEREVENT_COMPAT_H_(?![A-Za-z0-9_])/EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_BUFFEREVENT_SSL_H_(?![A-Za-z0-9_])/EVENT2_BUFFEREVENT_SSL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_BUFFEREVENT_STRUCT_H_(?![A-Za-z0-9_])/EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_DNS_H_(?![A-Za-z0-9_])/EVENT2_DNS_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_DNS_COMPAT_H_(?![A-Za-z0-9_])/EVENT2_DNS_COMPAT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_DNS_STRUCT_H_(?![A-Za-z0-9_])/EVENT2_DNS_STRUCT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_EVENT_H_(?![A-Za-z0-9_])/EVENT2_EVENT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_EVENT_COMPAT_H_(?![A-Za-z0-9_])/EVENT2_EVENT_COMPAT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_EVENT_STRUCT_H_(?![A-Za-z0-9_])/EVENT2_EVENT_STRUCT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_HTTP_H_(?![A-Za-z0-9_])/EVENT2_HTTP_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_HTTP_COMPAT_H_(?![A-Za-z0-9_])/EVENT2_HTTP_COMPAT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_HTTP_STRUCT_H_(?![A-Za-z0-9_])/EVENT2_HTTP_STRUCT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_EVENT_KEYVALQ_STRUCT_H_(?![A-Za-z0-9_])/EVENT2_KEYVALQ_STRUCT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_LISTENER_H_(?![A-Za-z0-9_])/EVENT2_LISTENER_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_RPC_H_(?![A-Za-z0-9_])/EVENT2_RPC_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_RPC_COMPAT_H_(?![A-Za-z0-9_])/EVENT2_RPC_COMPAT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_RPC_STRUCT_H_(?![A-Za-z0-9_])/EVENT2_RPC_STRUCT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_TAG_H_(?![A-Za-z0-9_])/EVENT2_TAG_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_TAG_COMPAT_H_(?![A-Za-z0-9_])/EVENT2_TAG_COMPAT_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_THREAD_H_(?![A-Za-z0-9_])/EVENT2_THREAD_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT2_UTIL_H_(?![A-Za-z0-9_])/EVENT2_UTIL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVHTTP_H_(?![A-Za-z0-9_])/EVENT1_EVHTTP_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVRPC_H_(?![A-Za-z0-9_])/EVENT1_EVRPC_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVUTIL_H_(?![A-Za-z0-9_])/EVENT1_EVUTIL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT_IOCP_INTERNAL_H(?![A-Za-z0-9_])/IOCP_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT_IPV6_INTERNAL_H(?![A-Za-z0-9_])/IPV6_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_LOG_H_(?![A-Za-z0-9_])/LOG_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_MIN_HEAP_H_(?![A-Za-z0-9_])/MINHEAP_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT_MM_INTERNAL_H(?![A-Za-z0-9_])/MM_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_RATELIM_INTERNAL_H_(?![A-Za-z0-9_])/RATELIM_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_STRLCPY_INTERNAL_H_(?![A-Za-z0-9_])/STRLCPY_INTERNAL_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_REGRESS_H_(?![A-Za-z0-9_])/REGRESS_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_TESTUTILS_H(?![A-Za-z0-9_])/REGRESS_TESTUTILS_H_INCLUDED_/g;
# Weird macro for test/tinytest.h...
s/(?<![A-Za-z0-9_])TINYTEST_H_INCLUDED_(?![A-Za-z0-9_])/TINYTEST_H_INCLUDED_/g;
# No macro known for test/tinytest_local.h!
# Weird macro for test/tinytest_macros.h...
s/(?<![A-Za-z0-9_])TINYTEST_MACROS_H_INCLUDED_(?![A-Za-z0-9_])/TINYTEST_MACROS_H_INCLUDED_/g;
s/(?<![A-Za-z0-9_])_EVENT_UTIL_INTERNAL_H(?![A-Za-z0-9_])/UTIL_INTERNAL_H_INCLUDED_/g;

12 years agoGenerate event-config.h using the correct macros.
Nick Mathewson [Wed, 29 Feb 2012 20:07:31 +0000 (15:07 -0500)]
Generate event-config.h using the correct macros.

The previous patch didn't change the sed script in Makefile.am, since
that couldn't be done automatically.

12 years agoConvert event-config.h macros to avoid reserved identifiers
Nick Mathewson [Wed, 29 Feb 2012 20:07:31 +0000 (15:07 -0500)]
Convert event-config.h macros to avoid reserved identifiers

C reserves all identifiers beginning with an underscore for system
use.  But we had been mangling our autoconf identifiers with the
prefix "_EVENT_" to avoid conflict with other programs.

Instead, we will now use the prefix "EVENT__".  With any luck, the
double-underscore will still hint "here be dragons" to anybody
tempted to think that event-config.h is a stable api.

This is an automatically generated patch.  The script that produced
it was made by running this script over config.h.in:

=====

#!/usr/bin/perl -w

# Run this on config.h.in

use strict;

my %macros = ();

while (<>) {
    if (/^# *undef +([A-Za-z0-9_]+)/) {
$macros{$1} = 1;
    }
}

print "#!/usr/bin/perl -w -i -p\n\n";
for my $k (sort keys %macros) {
    print "s/(?<![A-Za-z0-9_])_EVENT_$k(?![A-Za-z0-9_])/EVENT__$k/g;\n";
}

== And the script that it generated was then run over all .c and .h files:
#!/usr/bin/perl -w -i -p

s/(?<![A-Za-z0-9_])_EVENT_DISABLE_DEBUG_MODE(?![A-Za-z0-9_])/EVENT__DISABLE_DEBUG_MODE/g;
s/(?<![A-Za-z0-9_])_EVENT_DISABLE_MM_REPLACEMENT(?![A-Za-z0-9_])/EVENT__DISABLE_MM_REPLACEMENT/g;
s/(?<![A-Za-z0-9_])_EVENT_DISABLE_THREAD_SUPPORT(?![A-Za-z0-9_])/EVENT__DISABLE_THREAD_SUPPORT/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_ACCEPT4(?![A-Za-z0-9_])/EVENT__HAVE_ACCEPT4/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_ARC4RANDOM(?![A-Za-z0-9_])/EVENT__HAVE_ARC4RANDOM/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_ARC4RANDOM_BUF(?![A-Za-z0-9_])/EVENT__HAVE_ARC4RANDOM_BUF/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_ARPA_INET_H(?![A-Za-z0-9_])/EVENT__HAVE_ARPA_INET_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_CLOCK_GETTIME(?![A-Za-z0-9_])/EVENT__HAVE_CLOCK_GETTIME/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_DECL_CTL_KERN(?![A-Za-z0-9_])/EVENT__HAVE_DECL_CTL_KERN/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_DECL_KERN_ARND(?![A-Za-z0-9_])/EVENT__HAVE_DECL_KERN_ARND/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_DECL_KERN_RANDOM(?![A-Za-z0-9_])/EVENT__HAVE_DECL_KERN_RANDOM/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_DECL_RANDOM_UUID(?![A-Za-z0-9_])/EVENT__HAVE_DECL_RANDOM_UUID/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_DEVPOLL(?![A-Za-z0-9_])/EVENT__HAVE_DEVPOLL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_DLFCN_H(?![A-Za-z0-9_])/EVENT__HAVE_DLFCN_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_EPOLL(?![A-Za-z0-9_])/EVENT__HAVE_EPOLL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_EPOLL_CREATE1(?![A-Za-z0-9_])/EVENT__HAVE_EPOLL_CREATE1/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_EPOLL_CTL(?![A-Za-z0-9_])/EVENT__HAVE_EPOLL_CTL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_EVENTFD(?![A-Za-z0-9_])/EVENT__HAVE_EVENTFD/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_EVENT_PORTS(?![A-Za-z0-9_])/EVENT__HAVE_EVENT_PORTS/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_FCNTL(?![A-Za-z0-9_])/EVENT__HAVE_FCNTL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_FCNTL_H(?![A-Za-z0-9_])/EVENT__HAVE_FCNTL_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_FD_MASK(?![A-Za-z0-9_])/EVENT__HAVE_FD_MASK/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETADDRINFO(?![A-Za-z0-9_])/EVENT__HAVE_GETADDRINFO/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETEGID(?![A-Za-z0-9_])/EVENT__HAVE_GETEGID/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETEUID(?![A-Za-z0-9_])/EVENT__HAVE_GETEUID/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETHOSTBYNAME_R(?![A-Za-z0-9_])/EVENT__HAVE_GETHOSTBYNAME_R/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETHOSTBYNAME_R_3_ARG(?![A-Za-z0-9_])/EVENT__HAVE_GETHOSTBYNAME_R_3_ARG/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETHOSTBYNAME_R_5_ARG(?![A-Za-z0-9_])/EVENT__HAVE_GETHOSTBYNAME_R_5_ARG/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETHOSTBYNAME_R_6_ARG(?![A-Za-z0-9_])/EVENT__HAVE_GETHOSTBYNAME_R_6_ARG/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETIFADDRS(?![A-Za-z0-9_])/EVENT__HAVE_GETIFADDRS/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETNAMEINFO(?![A-Za-z0-9_])/EVENT__HAVE_GETNAMEINFO/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETPROTOBYNUMBER(?![A-Za-z0-9_])/EVENT__HAVE_GETPROTOBYNUMBER/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETSERVBYNAME(?![A-Za-z0-9_])/EVENT__HAVE_GETSERVBYNAME/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETTIMEOFDAY(?![A-Za-z0-9_])/EVENT__HAVE_GETTIMEOFDAY/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_IFADDRS_H(?![A-Za-z0-9_])/EVENT__HAVE_IFADDRS_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_INET_ATON(?![A-Za-z0-9_])/EVENT__HAVE_INET_ATON/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_INET_NTOP(?![A-Za-z0-9_])/EVENT__HAVE_INET_NTOP/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_INET_PTON(?![A-Za-z0-9_])/EVENT__HAVE_INET_PTON/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_INTTYPES_H(?![A-Za-z0-9_])/EVENT__HAVE_INTTYPES_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_ISSETUGID(?![A-Za-z0-9_])/EVENT__HAVE_ISSETUGID/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_KQUEUE(?![A-Za-z0-9_])/EVENT__HAVE_KQUEUE/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_LIBZ(?![A-Za-z0-9_])/EVENT__HAVE_LIBZ/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_MEMORY_H(?![A-Za-z0-9_])/EVENT__HAVE_MEMORY_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_MMAP(?![A-Za-z0-9_])/EVENT__HAVE_MMAP/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_NANOSLEEP(?![A-Za-z0-9_])/EVENT__HAVE_NANOSLEEP/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_NETDB_H(?![A-Za-z0-9_])/EVENT__HAVE_NETDB_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_NETINET_IN6_H(?![A-Za-z0-9_])/EVENT__HAVE_NETINET_IN6_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_NETINET_IN_H(?![A-Za-z0-9_])/EVENT__HAVE_NETINET_IN_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_NETINET_TCP_H(?![A-Za-z0-9_])/EVENT__HAVE_NETINET_TCP_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_OPENSSL(?![A-Za-z0-9_])/EVENT__HAVE_OPENSSL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_PIPE(?![A-Za-z0-9_])/EVENT__HAVE_PIPE/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_PIPE2(?![A-Za-z0-9_])/EVENT__HAVE_PIPE2/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_POLL(?![A-Za-z0-9_])/EVENT__HAVE_POLL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_POLL_H(?![A-Za-z0-9_])/EVENT__HAVE_POLL_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_PORT_CREATE(?![A-Za-z0-9_])/EVENT__HAVE_PORT_CREATE/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_PORT_H(?![A-Za-z0-9_])/EVENT__HAVE_PORT_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_PTHREAD(?![A-Za-z0-9_])/EVENT__HAVE_PTHREAD/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_PTHREADS(?![A-Za-z0-9_])/EVENT__HAVE_PTHREADS/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_PUTENV(?![A-Za-z0-9_])/EVENT__HAVE_PUTENV/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SA_FAMILY_T(?![A-Za-z0-9_])/EVENT__HAVE_SA_FAMILY_T/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SELECT(?![A-Za-z0-9_])/EVENT__HAVE_SELECT/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SENDFILE(?![A-Za-z0-9_])/EVENT__HAVE_SENDFILE/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SETENV(?![A-Za-z0-9_])/EVENT__HAVE_SETENV/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SETFD(?![A-Za-z0-9_])/EVENT__HAVE_SETFD/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SETRLIMIT(?![A-Za-z0-9_])/EVENT__HAVE_SETRLIMIT/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SIGACTION(?![A-Za-z0-9_])/EVENT__HAVE_SIGACTION/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SIGNAL(?![A-Za-z0-9_])/EVENT__HAVE_SIGNAL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SPLICE(?![A-Za-z0-9_])/EVENT__HAVE_SPLICE/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STDARG_H(?![A-Za-z0-9_])/EVENT__HAVE_STDARG_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STDDEF_H(?![A-Za-z0-9_])/EVENT__HAVE_STDDEF_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STDINT_H(?![A-Za-z0-9_])/EVENT__HAVE_STDINT_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STDLIB_H(?![A-Za-z0-9_])/EVENT__HAVE_STDLIB_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRINGS_H(?![A-Za-z0-9_])/EVENT__HAVE_STRINGS_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRING_H(?![A-Za-z0-9_])/EVENT__HAVE_STRING_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRLCPY(?![A-Za-z0-9_])/EVENT__HAVE_STRLCPY/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRSEP(?![A-Za-z0-9_])/EVENT__HAVE_STRSEP/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRTOK_R(?![A-Za-z0-9_])/EVENT__HAVE_STRTOK_R/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRTOLL(?![A-Za-z0-9_])/EVENT__HAVE_STRTOLL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_ADDRINFO(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_ADDRINFO/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_IN6_ADDR(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_IN6_ADDR/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_IN6_ADDR_S6_ADDR16(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_IN6_ADDR_S6_ADDR32(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_SOCKADDR_IN6(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_SOCKADDR_IN6/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_SOCKADDR_IN_SIN_LEN(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_SOCKADDR_STORAGE/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYSCTL(?![A-Za-z0-9_])/EVENT__HAVE_SYSCTL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_DEVPOLL_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_DEVPOLL_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_EPOLL_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_EPOLL_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_EVENTFD_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_EVENTFD_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_EVENT_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_EVENT_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_IOCTL_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_IOCTL_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_MMAN_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_MMAN_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_PARAM_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_PARAM_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_QUEUE_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_QUEUE_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_RESOURCE_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_RESOURCE_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_SELECT_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_SELECT_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_SENDFILE_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_SENDFILE_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_SOCKET_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_SOCKET_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_STAT_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_STAT_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_SYSCTL_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_SYSCTL_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_TIME_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_TIME_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_TYPES_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_TYPES_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_UIO_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_UIO_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_WAIT_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_WAIT_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_TAILQFOREACH(?![A-Za-z0-9_])/EVENT__HAVE_TAILQFOREACH/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_TIMERADD(?![A-Za-z0-9_])/EVENT__HAVE_TIMERADD/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_TIMERCLEAR(?![A-Za-z0-9_])/EVENT__HAVE_TIMERCLEAR/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_TIMERCMP(?![A-Za-z0-9_])/EVENT__HAVE_TIMERCMP/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_TIMERISSET(?![A-Za-z0-9_])/EVENT__HAVE_TIMERISSET/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_UINT16_T(?![A-Za-z0-9_])/EVENT__HAVE_UINT16_T/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_UINT32_T(?![A-Za-z0-9_])/EVENT__HAVE_UINT32_T/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_UINT64_T(?![A-Za-z0-9_])/EVENT__HAVE_UINT64_T/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_UINT8_T(?![A-Za-z0-9_])/EVENT__HAVE_UINT8_T/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_UINTPTR_T(?![A-Za-z0-9_])/EVENT__HAVE_UINTPTR_T/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_UNISTD_H(?![A-Za-z0-9_])/EVENT__HAVE_UNISTD_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_UNSETENV(?![A-Za-z0-9_])/EVENT__HAVE_UNSETENV/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_USLEEP(?![A-Za-z0-9_])/EVENT__HAVE_USLEEP/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_VASPRINTF(?![A-Za-z0-9_])/EVENT__HAVE_VASPRINTF/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_WORKING_KQUEUE(?![A-Za-z0-9_])/EVENT__HAVE_WORKING_KQUEUE/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_ZLIB_H(?![A-Za-z0-9_])/EVENT__HAVE_ZLIB_H/g;
s/(?<![A-Za-z0-9_])_EVENT_LT_OBJDIR(?![A-Za-z0-9_])/EVENT__LT_OBJDIR/g;
s/(?<![A-Za-z0-9_])_EVENT_NO_MINUS_C_MINUS_O(?![A-Za-z0-9_])/EVENT__NO_MINUS_C_MINUS_O/g;
s/(?<![A-Za-z0-9_])_EVENT_NUMERIC_VERSION(?![A-Za-z0-9_])/EVENT__NUMERIC_VERSION/g;
s/(?<![A-Za-z0-9_])_EVENT_PACKAGE(?![A-Za-z0-9_])/EVENT__PACKAGE/g;
s/(?<![A-Za-z0-9_])_EVENT_PACKAGE_BUGREPORT(?![A-Za-z0-9_])/EVENT__PACKAGE_BUGREPORT/g;
s/(?<![A-Za-z0-9_])_EVENT_PACKAGE_NAME(?![A-Za-z0-9_])/EVENT__PACKAGE_NAME/g;
s/(?<![A-Za-z0-9_])_EVENT_PACKAGE_STRING(?![A-Za-z0-9_])/EVENT__PACKAGE_STRING/g;
s/(?<![A-Za-z0-9_])_EVENT_PACKAGE_TARNAME(?![A-Za-z0-9_])/EVENT__PACKAGE_TARNAME/g;
s/(?<![A-Za-z0-9_])_EVENT_PACKAGE_URL(?![A-Za-z0-9_])/EVENT__PACKAGE_URL/g;
s/(?<![A-Za-z0-9_])_EVENT_PACKAGE_VERSION(?![A-Za-z0-9_])/EVENT__PACKAGE_VERSION/g;
s/(?<![A-Za-z0-9_])_EVENT_PTHREAD_CREATE_JOINABLE(?![A-Za-z0-9_])/EVENT__PTHREAD_CREATE_JOINABLE/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_INT(?![A-Za-z0-9_])/EVENT__SIZEOF_INT/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_LONG(?![A-Za-z0-9_])/EVENT__SIZEOF_LONG/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_LONG_LONG(?![A-Za-z0-9_])/EVENT__SIZEOF_LONG_LONG/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_OFF_T(?![A-Za-z0-9_])/EVENT__SIZEOF_OFF_T/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_PTHREAD_T(?![A-Za-z0-9_])/EVENT__SIZEOF_PTHREAD_T/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_SHORT(?![A-Za-z0-9_])/EVENT__SIZEOF_SHORT/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_SIZE_T(?![A-Za-z0-9_])/EVENT__SIZEOF_SIZE_T/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_VOID_P(?![A-Za-z0-9_])/EVENT__SIZEOF_VOID_P/g;
s/(?<![A-Za-z0-9_])_EVENT_STDC_HEADERS(?![A-Za-z0-9_])/EVENT__STDC_HEADERS/g;
s/(?<![A-Za-z0-9_])_EVENT_TIME_WITH_SYS_TIME(?![A-Za-z0-9_])/EVENT__TIME_WITH_SYS_TIME/g;
s/(?<![A-Za-z0-9_])_EVENT_VERSION(?![A-Za-z0-9_])/EVENT__VERSION/g;
s/(?<![A-Za-z0-9_])_EVENT__ALL_SOURCE(?![A-Za-z0-9_])/EVENT___ALL_SOURCE/g;
s/(?<![A-Za-z0-9_])_EVENT__FILE_OFFSET_BITS(?![A-Za-z0-9_])/EVENT___FILE_OFFSET_BITS/g;
s/(?<![A-Za-z0-9_])_EVENT__GNU_SOURCE(?![A-Za-z0-9_])/EVENT___GNU_SOURCE/g;
s/(?<![A-Za-z0-9_])_EVENT__LARGE_FILES(?![A-Za-z0-9_])/EVENT___LARGE_FILES/g;
s/(?<![A-Za-z0-9_])_EVENT__MINIX(?![A-Za-z0-9_])/EVENT___MINIX/g;
s/(?<![A-Za-z0-9_])_EVENT__POSIX_1_SOURCE(?![A-Za-z0-9_])/EVENT___POSIX_1_SOURCE/g;
s/(?<![A-Za-z0-9_])_EVENT__POSIX_PTHREAD_SEMANTICS(?![A-Za-z0-9_])/EVENT___POSIX_PTHREAD_SEMANTICS/g;
s/(?<![A-Za-z0-9_])_EVENT__POSIX_SOURCE(?![A-Za-z0-9_])/EVENT___POSIX_SOURCE/g;
s/(?<![A-Za-z0-9_])_EVENT__TANDEM_SOURCE(?![A-Za-z0-9_])/EVENT___TANDEM_SOURCE/g;
s/(?<![A-Za-z0-9_])_EVENT___EXTENSIONS__(?![A-Za-z0-9_])/EVENT____EXTENSIONS__/g;
s/(?<![A-Za-z0-9_])_EVENT___func__(?![A-Za-z0-9_])/EVENT____func__/g;
s/(?<![A-Za-z0-9_])_EVENT_const(?![A-Za-z0-9_])/EVENT__const/g;
s/(?<![A-Za-z0-9_])_EVENT_inline(?![A-Za-z0-9_])/EVENT__inline/g;
s/(?<![A-Za-z0-9_])_EVENT_pid_t(?![A-Za-z0-9_])/EVENT__pid_t/g;
s/(?<![A-Za-z0-9_])_EVENT_size_t(?![A-Za-z0-9_])/EVENT__size_t/g;
s/(?<![A-Za-z0-9_])_EVENT_socklen_t(?![A-Za-z0-9_])/EVENT__socklen_t/g;
s/(?<![A-Za-z0-9_])_EVENT_ssize_t(?![A-Za-z0-9_])/EVENT__ssize_t/g;

12 years agoMake event-config.h depend on Makefile.am
Nick Mathewson [Wed, 29 Feb 2012 20:07:14 +0000 (15:07 -0500)]
Make event-config.h depend on Makefile.am

12 years agoCheck for NULL return on win32 mm_calloc, and set ENOMEM.
Nick Mathewson [Tue, 28 Feb 2012 19:49:47 +0000 (14:49 -0500)]
Check for NULL return on win32 mm_calloc, and set ENOMEM.

(It looks like windows doesn't set ENOMEM on overflow from calloc.)

12 years agoDo not use system EAI/AI values if we are not using the system getaddrinfo.
Nick Mathewson [Tue, 28 Feb 2012 19:32:01 +0000 (14:32 -0500)]
Do not use system EAI/AI values if we are not using the system getaddrinfo.

12 years agoReplace sole internal user of socklen_t with ev_socklen_t
Nick Mathewson [Tue, 28 Feb 2012 18:21:05 +0000 (13:21 -0500)]
Replace sole internal user of socklen_t with ev_socklen_t

This lets us remove the socklen_t definition from util-internal.h,
so that util-internal.h no longer confuses ws2tcpip.h

12 years agoFix evmap to work with HT-backed IO maps again.
Nick Mathewson [Tue, 28 Feb 2012 18:09:51 +0000 (13:09 -0500)]
Fix evmap to work with HT-backed IO maps again.

12 years agoevutil_accept4() should take ev_socklen_t
Nick Mathewson [Tue, 28 Feb 2012 17:53:46 +0000 (12:53 -0500)]
evutil_accept4() should take ev_socklen_t

12 years agotest-fdleak: Avoid perror, since it does not capture windows socket errors
Nick Mathewson [Mon, 27 Feb 2012 23:10:45 +0000 (18:10 -0500)]
test-fdleak: Avoid perror, since it does not capture windows socket errors

12 years agoremove debugging prints
Nick Mathewson [Mon, 27 Feb 2012 23:08:27 +0000 (18:08 -0500)]
remove debugging prints

12 years agotest-fdleak: Call event callbacks event_cb.
Nick Mathewson [Mon, 27 Feb 2012 23:06:28 +0000 (18:06 -0500)]
test-fdleak: Call event callbacks event_cb.

12 years agoRemove fixed port from test-fdleak, so two instances can run in parallel
Nick Mathewson [Mon, 27 Feb 2012 23:05:49 +0000 (18:05 -0500)]
Remove fixed port from test-fdleak, so two instances can run in parallel

12 years agoRemove an unsafe programming practice from test-fdleak; add XX comments
Nick Mathewson [Mon, 27 Feb 2012 22:57:01 +0000 (17:57 -0500)]
Remove an unsafe programming practice from test-fdleak; add XX comments

It's a bad idea to have a read callback read a fixed amount; Instead,
we should drain it, or have some way to know that more data is
arrived.  Not unsafe in this case, but let's not encourage people to
learn bad habits.

This commit also notes some other stuff to fix.

12 years agoTry and fix compilation and running of test-fdleak on Windows.
Ross Lagerwall [Sat, 25 Feb 2012 05:47:49 +0000 (07:47 +0200)]
Try and fix compilation and running of test-fdleak on Windows.

12 years agoAllow compilation on machines that do not have setrlimit.
Ross Lagerwall [Sat, 25 Feb 2012 05:36:49 +0000 (07:36 +0200)]
Allow compilation on machines that do not have setrlimit.

12 years agoSimply test-fdleak by running server & client sockets in the same event loop.
Ross Lagerwall [Sat, 25 Feb 2012 05:21:20 +0000 (07:21 +0200)]
Simply test-fdleak by running server & client sockets in the same event loop.

12 years agoAdd a new test: test-fdleak which tests for fd leaks by creating many sockets.
Ross Lagerwall [Thu, 23 Feb 2012 19:40:02 +0000 (21:40 +0200)]
Add a new test: test-fdleak which tests for fd leaks by creating many sockets.

This test opens a server socket, and forks a child which connects to that
server socket many times. It sets a low number for the max open file limit
to catch any file descriptor leaks.
It would not work on Windows since it uses fork() to be able to create both the
server and the clients.

12 years agoIf accept4 is absent, fall back to accept.
Nick Mathewson [Wed, 22 Feb 2012 01:39:17 +0000 (20:39 -0500)]
If accept4 is absent, fall back to accept.

12 years agoAvoid leaking fd in evutil_socket() by Linux.
Nick Mathewson [Wed, 22 Feb 2012 01:38:36 +0000 (20:38 -0500)]
Avoid leaking fd in evutil_socket() by Linux.

Found by Amarin Phaosawasdi

12 years agoRemove the last vestiges of _EVENT_USE_EVENTLIST
Nick Mathewson [Mon, 20 Feb 2012 19:07:08 +0000 (14:07 -0500)]
Remove the last vestiges of _EVENT_USE_EVENTLIST

12 years agoMerge branch '21_eventlist_v3_squashed'
Nick Mathewson [Mon, 20 Feb 2012 18:56:13 +0000 (13:56 -0500)]
Merge branch '21_eventlist_v3_squashed'

12 years agoAdd doxygen for event_base_dump_events
Nick Mathewson [Sun, 12 Feb 2012 02:05:50 +0000 (21:05 -0500)]
Add doxygen for event_base_dump_events

12 years agoRefactor the functions that run over every event.
Nick Mathewson [Sun, 12 Feb 2012 02:01:53 +0000 (21:01 -0500)]
Refactor the functions that run over every event.

Now there are appropriate "for each event", "for each fd", and "for
each signal" helpers that they can use; this makes the code a bit
simpler, and far less duplicated.

This lets me turn back on the functions I disabled when removing
eventlist.

Additionally, check more lists for circularity in
event_base_assert_ok().

Add typedefs for the callback types.

Name fewer things "ctx".

Adds an implementation of Floyd's tortoise-and-hare algorithm to check
for circularity in TAILQs and LISTs, to avoid the abuse of flags that
event_base_assert_ok() was doing before.

Suggested by Dave Hart.

12 years agoFix an "unused return value" warning on write() in signal handler
Nick Mathewson [Fri, 17 Feb 2012 15:42:56 +0000 (10:42 -0500)]
Fix an "unused return value" warning on write() in signal handler

12 years agoStart work on a 2.1 changelog and whats-new
Nick Mathewson [Thu, 16 Feb 2012 06:21:42 +0000 (01:21 -0500)]
Start work on a 2.1 changelog and whats-new

12 years agoAdd another caveat to the TCP_DEFER_ACCEPT documentation
Nick Mathewson [Thu, 16 Feb 2012 02:27:52 +0000 (21:27 -0500)]
Add another caveat to the TCP_DEFER_ACCEPT documentation

12 years agoSupport TCP_DEFER_ACCEPT sockopts for listeners
Mark Ellzey [Tue, 14 Feb 2012 23:04:52 +0000 (18:04 -0500)]
Support TCP_DEFER_ACCEPT sockopts for listeners

A listening socket can be enabled with the sockopt
TCP_DEFER_ACCEPT. This informs the kernel to not call the user-land
accept() until real data has been written to the socket.

A new flag LEV_OPT_DEFERRED_ACCEPT has been introduced to
automatically set this option. Optionally
evutil_make_tcp_listen_socket_deferred() can be called manually.

(Tweaked slightly by nickm.)

12 years agoMerge remote-tracking branch 'github/21_fast_syscalls'
Nick Mathewson [Thu, 16 Feb 2012 02:07:44 +0000 (21:07 -0500)]
Merge remote-tracking branch 'github/21_fast_syscalls'

12 years agoMerge remote-tracking branch 'origin/patches-2.0'
Nick Mathewson [Thu, 16 Feb 2012 01:26:52 +0000 (20:26 -0500)]
Merge remote-tracking branch 'origin/patches-2.0'

12 years agoStop crashing in evdns when nameserver probes give a weird error
Nick Mathewson [Thu, 16 Feb 2012 01:12:32 +0000 (20:12 -0500)]
Stop crashing in evdns when nameserver probes give a weird error

When a nameserver is down, we periodically try sending a "probe"
message to that nameserver to see if it has come back up.  If a
nameserver comes up, we cancel any pending probe messages.

Cancelling a probe message while handling the probe's response would
result in a access-after-free or a double-free, so when we notice that
we're about to call a nameserver up because of having received a probe
from it, we need to check whether current response is the response
from the probe.

There was a case where we didn't to that, though: when the resolver
gave us an unusual error response to our request that it resolve
google.com.  This is pretty rare, but apparently it can happen with
some weird cacheing nameservers -- the one on the mikrotik router, for
example.  Without this patch, we would crash with a NULL pointer
derefernce.

Thanks to Hannes Sowa for finding this issue and helping me track it
down.

12 years agoMerge remote-tracking branch 'origin/patches-2.0'
Nick Mathewson [Tue, 14 Feb 2012 20:44:03 +0000 (15:44 -0500)]
Merge remote-tracking branch 'origin/patches-2.0'

Conflicts:
configure.in

12 years agoChanged OPENSSL_LDFLAGS to OPENSSL_LIBADD
Mark Ellzey [Tue, 14 Feb 2012 20:37:58 +0000 (15:37 -0500)]
Changed OPENSSL_LDFLAGS to OPENSSL_LIBADD

12 years agoAdded OPENSSL_LDFLAGS env variable which is appended to SSL checks.
Mark Ellzey [Tue, 14 Feb 2012 20:01:02 +0000 (15:01 -0500)]
Added OPENSSL_LDFLAGS env variable which is appended to SSL checks.

If openssl is not installed system-wide or not compiled as a shared library,
some systems require various link flags (e.g., -ld).

12 years agoIf open(O_CLOEXEC) fails, fall back to fcntl(CLOEXEC)
Nick Mathewson [Tue, 14 Feb 2012 16:48:55 +0000 (11:48 -0500)]
If open(O_CLOEXEC) fails, fall back to fcntl(CLOEXEC)

This is needed for folks who build with recent Linux kernel headers
but run with older kernels.

12 years agoFix up usage of reserved identifiers in ht-internal.h
Nick Mathewson [Mon, 13 Feb 2012 23:34:00 +0000 (18:34 -0500)]
Fix up usage of reserved identifiers in ht-internal.h

12 years agoPort changes from Tor for ht-internal.h
Nick Mathewson [Mon, 13 Feb 2012 23:04:05 +0000 (18:04 -0500)]
Port changes from Tor for ht-internal.h

12 years agoInvert the sense and the name of HT_CACHE_HASH_VALUES
Nick Mathewson [Mon, 13 Feb 2012 22:59:14 +0000 (17:59 -0500)]
Invert the sense and the name of HT_CACHE_HASH_VALUES

This is meant to make it easier to merge ht-internal.h back upstream
into Tor.

12 years agoSynchronize with upstream tinytest
Nick Mathewson [Mon, 13 Feb 2012 22:49:17 +0000 (17:49 -0500)]
Synchronize with upstream tinytest

12 years agoMerge in a punctuation fix from upstream tinytest
Nick Mathewson [Mon, 13 Feb 2012 22:30:46 +0000 (17:30 -0500)]
Merge in a punctuation fix from upstream tinytest

12 years agoMove libevent 1.x headers to include/, to put all public headers in one place.
Nick Mathewson [Mon, 13 Feb 2012 17:19:08 +0000 (12:19 -0500)]
Move libevent 1.x headers to include/, to put all public headers in one place.

12 years agoMerge remote-tracking branch 'origin/patches-2.0'
Nick Mathewson [Sun, 12 Feb 2012 02:20:47 +0000 (21:20 -0500)]
Merge remote-tracking branch 'origin/patches-2.0'

12 years agoTweak the evutil_open_closeonexec patch to work on windows, old unixes.
Nick Mathewson [Sun, 12 Feb 2012 02:17:18 +0000 (21:17 -0500)]
Tweak the evutil_open_closeonexec patch to work on windows, old unixes.

Windows doesn't have a mode_t as far as I can tell.

Some unixes, iirc, don't like three-argument open without O_CREAT.

12 years agoMake uses of open() close-on-exec safe by introducing evutil_open_closeonexec.
Ross Lagerwall [Sat, 11 Feb 2012 15:23:17 +0000 (17:23 +0200)]
Make uses of open() close-on-exec safe by introducing evutil_open_closeonexec.

In a multi-process/threaded environment, opening fds internally
without the close-on-exec flag could leak fds to child processes.

12 years agoAdd a bufferevent_getcb() to find a bufferevent's current callbacks
Nick Mathewson [Sat, 11 Feb 2012 17:04:15 +0000 (12:04 -0500)]
Add a bufferevent_getcb() to find a bufferevent's current callbacks

12 years agoAlso make win32select.c conditional for IDE users
Nick Mathewson [Sat, 11 Feb 2012 04:56:49 +0000 (23:56 -0500)]
Also make win32select.c conditional for IDE users

12 years agoMerge branch 'ifdef' of git://github.com/rosslagerwall/libevent
Nick Mathewson [Sat, 11 Feb 2012 04:52:27 +0000 (23:52 -0500)]
Merge branch 'ifdef' of git://github.com/rosslagerwall/libevent

12 years agoMerge remote-tracking branch 'origin/patches-2.0'
Nick Mathewson [Sat, 11 Feb 2012 04:51:11 +0000 (23:51 -0500)]
Merge remote-tracking branch 'origin/patches-2.0'

12 years agoAdd an empty section to the changelog for 2.0.18-stable
Nick Mathewson [Sat, 11 Feb 2012 03:20:05 +0000 (22:20 -0500)]
Add an empty section to the changelog for 2.0.18-stable

12 years agoMerge remote-tracking branch 'origin/patches-2.0'
Nick Mathewson [Sat, 11 Feb 2012 03:18:19 +0000 (22:18 -0500)]
Merge remote-tracking branch 'origin/patches-2.0'

12 years agoCorrect a name in the credits. oops
Nick Mathewson [Sat, 11 Feb 2012 03:17:59 +0000 (22:17 -0500)]
Correct a name in the credits. oops

12 years agoMerge remote-tracking branch 'origin/patches-2.0'
Nick Mathewson [Sat, 11 Feb 2012 03:16:46 +0000 (22:16 -0500)]
Merge remote-tracking branch 'origin/patches-2.0'

12 years agoBump version to 2.0.17-stable-dev
Nick Mathewson [Sat, 11 Feb 2012 03:16:14 +0000 (22:16 -0500)]
Bump version to 2.0.17-stable-dev

12 years agoMerge remote-tracking branch 'origin/patches-2.0'
Nick Mathewson [Fri, 10 Feb 2012 23:50:17 +0000 (18:50 -0500)]
Merge remote-tracking branch 'origin/patches-2.0'

12 years agoUpdate the credits in the readme release-2.0.17-stable
Nick Mathewson [Fri, 10 Feb 2012 23:39:31 +0000 (18:39 -0500)]
Update the credits in the readme

12 years agoFinalize the changelog
Nick Mathewson [Fri, 10 Feb 2012 23:36:10 +0000 (18:36 -0500)]
Finalize the changelog

12 years agoFix compilation on osx
Nick Mathewson [Fri, 10 Feb 2012 23:04:04 +0000 (18:04 -0500)]
Fix compilation on osx

12 years agoMerge remote-tracking branch 'origin/patches-2.0'
Nick Mathewson [Fri, 10 Feb 2012 22:33:50 +0000 (17:33 -0500)]
Merge remote-tracking branch 'origin/patches-2.0'

Conflicts:
Makefile.am
WIN32-Code/event2/event-config.h
configure.in

12 years agoUpdate copyright notices to 2012
Nick Mathewson [Fri, 10 Feb 2012 22:29:53 +0000 (17:29 -0500)]
Update copyright notices to 2012

12 years agoBump version to 2.0.17-stable
Nick Mathewson [Fri, 10 Feb 2012 21:49:05 +0000 (16:49 -0500)]
Bump version to 2.0.17-stable

12 years agoPrefer epoll_create1 on Linuxen that have it
Nick Mathewson [Fri, 10 Feb 2012 21:39:46 +0000 (16:39 -0500)]
Prefer epoll_create1 on Linuxen that have it

12 years agoSave some syscalls when constructing a socket for a bufferevent
Nick Mathewson [Fri, 10 Feb 2012 21:33:25 +0000 (16:33 -0500)]
Save some syscalls when constructing a socket for a bufferevent

12 years agoSave some syscalls when creating evdns sockets
Nick Mathewson [Fri, 10 Feb 2012 21:32:50 +0000 (16:32 -0500)]
Save some syscalls when creating evdns sockets

12 years agoSave syscalls when constructing listener sockets for evhttp
Nick Mathewson [Fri, 10 Feb 2012 21:32:32 +0000 (16:32 -0500)]
Save syscalls when constructing listener sockets for evhttp

12 years agoUse pipes for telling signals to main thread when possible
Nick Mathewson [Fri, 10 Feb 2012 21:25:53 +0000 (16:25 -0500)]
Use pipes for telling signals to main thread when possible

12 years agoUse a wrapper function to create the notification pipe/socketpair/eventfd
Nick Mathewson [Fri, 10 Feb 2012 21:15:10 +0000 (16:15 -0500)]
Use a wrapper function to create the notification pipe/socketpair/eventfd

12 years agoThe LEV_OPT_CLOSE_ON_EXEC flag now applies to accepted listener sockets too
Nick Mathewson [Fri, 10 Feb 2012 21:14:09 +0000 (16:14 -0500)]
The LEV_OPT_CLOSE_ON_EXEC flag now applies to accepted listener sockets too

12 years agoMinimize syscalls during socket creation in listener.c
Nick Mathewson [Fri, 10 Feb 2012 21:13:30 +0000 (16:13 -0500)]
Minimize syscalls during socket creation in listener.c

12 years agoInfrastructure for using faster/fewer syscalls when creating sockets
Nick Mathewson [Fri, 10 Feb 2012 20:55:15 +0000 (15:55 -0500)]
Infrastructure for using faster/fewer syscalls when creating sockets

Linux provides some features that allow avoiding extra calls to
fcntl when creating new nonblocking/close-on-exec sockets, so
we can add wrapper functions to emulate those when they are not
available.

Additionally, even when we are emulating those functions, we can
take a fast path that cuts our fcntl calls in half: we don't need to
look up the previous value of a file's flags when we have just
created it.

12 years agoMerge remote-tracking branch 'origin/patches-2.0'
Nick Mathewson [Fri, 10 Feb 2012 17:05:39 +0000 (12:05 -0500)]
Merge remote-tracking branch 'origin/patches-2.0'

12 years agoIn the kqueue backend, do not report EBADF as an EV_READ
Nick Mathewson [Fri, 10 Feb 2012 16:24:51 +0000 (11:24 -0500)]
In the kqueue backend, do not report EBADF as an EV_READ

We were doing this because of (correct) reports that NetBSD gives an
EBADF when you try to add the write side of a pipe for which the
read side has been closed.  But on most kqueue platforms, that
doesn't happen, and on *all* kqueue platforms, reporting a
nonexistent fd (which we usually have if we have seen EBADF) as
readable tends to give programs a case of the vapors.

Nicholas Marriott wrote the original patch here; I did the comment
fixes.

12 years agoMerge remote-tracking branch 'origin/patches-2.0'
Nick Mathewson [Thu, 9 Feb 2012 20:16:02 +0000 (15:16 -0500)]
Merge remote-tracking branch 'origin/patches-2.0'

12 years agoAvoid crash when freeing event_iocp and using event_set_mem_functions
Nick Mathewson [Thu, 9 Feb 2012 20:07:19 +0000 (15:07 -0500)]
Avoid crash when freeing event_iocp and using event_set_mem_functions

There was a calloc that needed to be an mm_calloc.

Reported by "fffvvvzz" on sourceforge.  Ticket 3486114

12 years agoPut #ifdef around some files to support alternate build systems.
Ross Lagerwall [Wed, 8 Feb 2012 16:46:00 +0000 (18:46 +0200)]
Put #ifdef around some files to support alternate build systems.

12 years agoBring the changelog up to date
Nick Mathewson [Tue, 7 Feb 2012 02:18:25 +0000 (21:18 -0500)]
Bring the changelog up to date

12 years agoMerge remote-tracking branch 'origin/patches-2.0'
Nick Mathewson [Mon, 6 Feb 2012 17:39:09 +0000 (12:39 -0500)]
Merge remote-tracking branch 'origin/patches-2.0'