aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkikht <kikht@yandex-team.ru>2022-02-10 16:45:14 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:14 +0300
commit194cae0e8855b11be2005e1eff12c660c3ee9774 (patch)
treeed29c437b616690880c017855ebe0be34fdf81a2
parent49116032d905455a7b1c994e4a696afc885c1e71 (diff)
downloadydb-194cae0e8855b11be2005e1eff12c660c3ee9774.tar.gz
Restoring authorship annotation for <kikht@yandex-team.ru>. Commit 1 of 2.
-rw-r--r--build/conf_fatal_error/ya.make12
-rw-r--r--build/plugins/pybuild.py2
-rw-r--r--build/plugins/swig.py2
-rw-r--r--build/rules/contrib_deprecated.policy4
-rw-r--r--build/rules/ya.make2
-rw-r--r--build/scripts/link_dyn_lib.py2
-rw-r--r--build/scripts/run_msvc_wine.py44
-rw-r--r--build/sysincl/android.yml2
-rw-r--r--build/sysincl/darwin.yml398
-rw-r--r--build/sysincl/ibdrv.yml8
-rw-r--r--build/sysincl/intrinsic.yml72
-rw-r--r--build/sysincl/libc-musl-libcxx.yml10
-rw-r--r--build/sysincl/libc-to-musl.yml152
-rw-r--r--build/sysincl/libc-to-nothing.yml306
-rw-r--r--build/sysincl/linux-musl.yml32
-rw-r--r--build/sysincl/linux.yml96
-rw-r--r--build/sysincl/misc-win.yml112
-rw-r--r--build/sysincl/misc.yml572
-rw-r--r--build/sysincl/python.yml206
-rw-r--r--build/sysincl/stl-to-libcxx.yml244
-rw-r--r--build/sysincl/stl-to-nothing.yml220
-rw-r--r--build/sysincl/unsorted.yml1898
-rw-r--r--build/sysincl/valgrind.yml8
-rw-r--r--build/sysincl/windows.yml602
-rw-r--r--build/ya.make2
-rw-r--r--build/ymake.core.conf74
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/sockaddr_windows.h8
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/socket_windows.cc8
-rwxr-xr-xcontrib/libs/libc_compat/update.sh4
-rw-r--r--contrib/libs/libc_compat/ya.make6
-rw-r--r--contrib/libs/libevent/ChangeLog3316
-rw-r--r--contrib/libs/libevent/ChangeLog-1.4462
-rw-r--r--contrib/libs/libevent/ChangeLog-2.02560
-rw-r--r--contrib/libs/libevent/LICENSE50
-rw-r--r--contrib/libs/libevent/README.md938
-rw-r--r--contrib/libs/libevent/arc4random.c50
-rw-r--r--contrib/libs/libevent/buffer.c1656
-rw-r--r--contrib/libs/libevent/buffer_iocp.c42
-rw-r--r--contrib/libs/libevent/bufferevent-internal.h306
-rw-r--r--contrib/libs/libevent/bufferevent.c598
-rw-r--r--contrib/libs/libevent/bufferevent_async.c218
-rw-r--r--contrib/libs/libevent/bufferevent_filter.c342
-rw-r--r--contrib/libs/libevent/bufferevent_openssl.c528
-rw-r--r--contrib/libs/libevent/bufferevent_pair.c124
-rw-r--r--contrib/libs/libevent/bufferevent_ratelim.c388
-rw-r--r--contrib/libs/libevent/bufferevent_sock.c300
-rw-r--r--contrib/libs/libevent/changelist-internal.h16
-rw-r--r--contrib/libs/libevent/config.h1052
-rw-r--r--contrib/libs/libevent/defer-internal.h48
-rw-r--r--contrib/libs/libevent/devpoll.c20
-rw-r--r--contrib/libs/libevent/epoll.c474
-rw-r--r--contrib/libs/libevent/epoll_sub.c2
-rw-r--r--contrib/libs/libevent/epolltable-internal.h2332
-rw-r--r--contrib/libs/libevent/evbuffer-internal.h188
-rw-r--r--contrib/libs/libevent/evconfig-private.h112
-rw-r--r--contrib/libs/libevent/evdns.c756
-rw-r--r--contrib/libs/libevent/event-internal.h342
-rw-r--r--contrib/libs/libevent/event.c3876
-rw-r--r--contrib/libs/libevent/event_core/ya.make138
-rw-r--r--contrib/libs/libevent/event_extra/ya.make64
-rw-r--r--contrib/libs/libevent/event_iocp.c28
-rw-r--r--contrib/libs/libevent/event_openssl/ya.make60
-rw-r--r--contrib/libs/libevent/event_tagging.c44
-rw-r--r--contrib/libs/libevent/event_thread/ya.make70
-rw-r--r--contrib/libs/libevent/evmap-internal.h86
-rw-r--r--contrib/libs/libevent/evmap.c852
-rw-r--r--contrib/libs/libevent/evport.c188
-rw-r--r--contrib/libs/libevent/evrpc-internal.h22
-rw-r--r--contrib/libs/libevent/evrpc.c64
-rw-r--r--contrib/libs/libevent/evsignal-internal.h16
-rw-r--r--contrib/libs/libevent/evthread-internal.h258
-rw-r--r--contrib/libs/libevent/evthread.c316
-rw-r--r--contrib/libs/libevent/evthread_pthread.c38
-rw-r--r--contrib/libs/libevent/evthread_win32.c50
-rw-r--r--contrib/libs/libevent/evutil.c1664
-rw-r--r--contrib/libs/libevent/evutil_rand.c92
-rw-r--r--contrib/libs/libevent/evutil_time.c1142
-rw-r--r--contrib/libs/libevent/ht-internal.h100
-rw-r--r--contrib/libs/libevent/http-internal.h88
-rw-r--r--contrib/libs/libevent/http.c1840
-rw-r--r--contrib/libs/libevent/include/evdns.h90
-rw-r--r--contrib/libs/libevent/include/event.h166
-rw-r--r--contrib/libs/libevent/include/event2/buffer.h500
-rw-r--r--contrib/libs/libevent/include/event2/buffer_compat.h20
-rw-r--r--contrib/libs/libevent/include/event2/bufferevent.h426
-rw-r--r--contrib/libs/libevent/include/event2/bufferevent_compat.h12
-rw-r--r--contrib/libs/libevent/include/event2/bufferevent_ssl.h64
-rw-r--r--contrib/libs/libevent/include/event2/bufferevent_struct.h10
-rw-r--r--contrib/libs/libevent/include/event2/dns.h236
-rw-r--r--contrib/libs/libevent/include/event2/dns_compat.h58
-rw-r--r--contrib/libs/libevent/include/event2/dns_struct.h10
-rw-r--r--contrib/libs/libevent/include/event2/event-config-linux.h488
-rw-r--r--contrib/libs/libevent/include/event2/event-config-musl.h6
-rw-r--r--contrib/libs/libevent/include/event2/event-config-osx.h284
-rw-r--r--contrib/libs/libevent/include/event2/event-config-win.h228
-rw-r--r--contrib/libs/libevent/include/event2/event-config.h6
-rw-r--r--contrib/libs/libevent/include/event2/event.h1046
-rw-r--r--contrib/libs/libevent/include/event2/event_compat.h30
-rw-r--r--contrib/libs/libevent/include/event2/event_struct.h136
-rw-r--r--contrib/libs/libevent/include/event2/http.h756
-rw-r--r--contrib/libs/libevent/include/event2/http_compat.h24
-rw-r--r--contrib/libs/libevent/include/event2/http_struct.h54
-rw-r--r--contrib/libs/libevent/include/event2/keyvalq_struct.h12
-rw-r--r--contrib/libs/libevent/include/event2/listener.h100
-rw-r--r--contrib/libs/libevent/include/event2/rpc.h94
-rw-r--r--contrib/libs/libevent/include/event2/rpc_compat.h6
-rw-r--r--contrib/libs/libevent/include/event2/rpc_struct.h34
-rw-r--r--contrib/libs/libevent/include/event2/tag.h54
-rw-r--r--contrib/libs/libevent/include/event2/tag_compat.h6
-rw-r--r--contrib/libs/libevent/include/event2/thread.h48
-rw-r--r--contrib/libs/libevent/include/event2/util.h496
-rw-r--r--contrib/libs/libevent/include/event2/visibility.h134
-rw-r--r--contrib/libs/libevent/include/evhttp.h90
-rw-r--r--contrib/libs/libevent/include/evrpc.h90
-rw-r--r--contrib/libs/libevent/include/evutil.h78
-rw-r--r--contrib/libs/libevent/iocp-internal.h84
-rw-r--r--contrib/libs/libevent/ipv6-internal.h18
-rw-r--r--contrib/libs/libevent/kqueue-internal.h78
-rw-r--r--contrib/libs/libevent/kqueue.c248
-rw-r--r--contrib/libs/libevent/listener.c176
-rw-r--r--contrib/libs/libevent/log-internal.h84
-rw-r--r--contrib/libs/libevent/log.c78
-rw-r--r--contrib/libs/libevent/minheap-internal.h128
-rw-r--r--contrib/libs/libevent/mm-internal.h70
-rw-r--r--contrib/libs/libevent/openssl-compat.h64
-rw-r--r--contrib/libs/libevent/poll.c46
-rw-r--r--contrib/libs/libevent/ratelim-internal.h12
-rw-r--r--contrib/libs/libevent/select.c42
-rw-r--r--contrib/libs/libevent/signal.c146
-rw-r--r--contrib/libs/libevent/strlcpy-internal.h16
-rw-r--r--contrib/libs/libevent/time-internal.h202
-rw-r--r--contrib/libs/libevent/util-internal.h560
-rw-r--r--contrib/libs/libevent/whatsnew-2.0.txt2
-rw-r--r--contrib/libs/libevent/win32select.c68
-rw-r--r--contrib/libs/libevent/ya.make40
-rw-r--r--contrib/libs/libiconv/ya.make10
-rw-r--r--contrib/libs/libxml/xmlIO.c2
-rw-r--r--contrib/libs/libxml/xzlib.c2
-rw-r--r--contrib/libs/xz/common/ya.make2
-rw-r--r--contrib/libs/xz/liblzma/ya.make2
-rw-r--r--contrib/libs/ya.make14
-rw-r--r--contrib/python/ya.make6
-rw-r--r--contrib/restricted/uriparser/config.h16
-rw-r--r--contrib/restricted/uriparser/include/uriparser/Uri.h2032
-rw-r--r--contrib/restricted/uriparser/include/uriparser/UriBase.h658
-rw-r--r--contrib/restricted/uriparser/include/uriparser/UriDefsAnsi.h124
-rw-r--r--contrib/restricted/uriparser/include/uriparser/UriDefsConfig.h154
-rw-r--r--contrib/restricted/uriparser/include/uriparser/UriDefsUnicode.h122
-rw-r--r--contrib/restricted/uriparser/include/uriparser/UriIp4.h142
-rw-r--r--contrib/restricted/uriparser/src/UriCommon.c1052
-rw-r--r--contrib/restricted/uriparser/src/UriCommon.h174
-rw-r--r--contrib/restricted/uriparser/src/UriCompare.c296
-rw-r--r--contrib/restricted/uriparser/src/UriEscape.c866
-rw-r--r--contrib/restricted/uriparser/src/UriFile.c434
-rw-r--r--contrib/restricted/uriparser/src/UriIp4.c618
-rw-r--r--contrib/restricted/uriparser/src/UriIp4Base.c152
-rw-r--r--contrib/restricted/uriparser/src/UriIp4Base.h78
-rw-r--r--contrib/restricted/uriparser/src/UriMemory.c890
-rw-r--r--contrib/restricted/uriparser/src/UriMemory.h76
-rw-r--r--contrib/restricted/uriparser/src/UriNormalize.c1450
-rw-r--r--contrib/restricted/uriparser/src/UriNormalizeBase.c198
-rw-r--r--contrib/restricted/uriparser/src/UriNormalizeBase.h66
-rw-r--r--contrib/restricted/uriparser/src/UriParse.c4764
-rw-r--r--contrib/restricted/uriparser/src/UriParseBase.c140
-rw-r--r--contrib/restricted/uriparser/src/UriParseBase.h70
-rw-r--r--contrib/restricted/uriparser/src/UriQuery.c960
-rw-r--r--contrib/restricted/uriparser/src/UriRecompose.c1114
-rw-r--r--contrib/restricted/uriparser/src/UriResolve.c618
-rw-r--r--contrib/restricted/uriparser/src/UriShorten.c608
-rw-r--r--contrib/restricted/uriparser/tool/uriparse.c232
-rw-r--r--contrib/restricted/uriparser/tool/ya.make38
-rw-r--r--contrib/restricted/uriparser/ya.make72
-rw-r--r--library/cpp/cache/cache.h102
-rw-r--r--library/cpp/cache/ut/cache_ut.cpp278
-rw-r--r--library/cpp/coroutine/engine/impl.cpp14
-rw-r--r--library/cpp/coroutine/engine/poller.cpp2
-rw-r--r--library/cpp/messagebus/acceptor.cpp12
-rw-r--r--library/cpp/messagebus/acceptor.h10
-rw-r--r--library/cpp/messagebus/acceptor_status.cpp6
-rw-r--r--library/cpp/messagebus/acceptor_status.h4
-rw-r--r--library/cpp/messagebus/actor/actor.h6
-rw-r--r--library/cpp/messagebus/actor/actor_ut.cpp8
-rw-r--r--library/cpp/messagebus/actor/executor.cpp12
-rw-r--r--library/cpp/messagebus/actor/executor.h8
-rw-r--r--library/cpp/messagebus/actor/queue_in_actor.h4
-rw-r--r--library/cpp/messagebus/actor/ring_buffer.h8
-rw-r--r--library/cpp/messagebus/actor/ring_buffer_ut.cpp4
-rw-r--r--library/cpp/messagebus/actor/ring_buffer_with_spin_lock.h4
-rw-r--r--library/cpp/messagebus/actor/tasks.h2
-rw-r--r--library/cpp/messagebus/actor/temp_tls_vector.h6
-rw-r--r--library/cpp/messagebus/actor/thread_extra.cpp8
-rw-r--r--library/cpp/messagebus/actor/what_thread_does.cpp6
-rw-r--r--library/cpp/messagebus/actor/what_thread_does_guard_ut.cpp4
-rw-r--r--library/cpp/messagebus/async_result.h6
-rw-r--r--library/cpp/messagebus/cc_semaphore_ut.cpp4
-rw-r--r--library/cpp/messagebus/config/defs.h10
-rw-r--r--library/cpp/messagebus/config/netaddr.cpp4
-rw-r--r--library/cpp/messagebus/config/netaddr.h2
-rw-r--r--library/cpp/messagebus/connection.cpp4
-rw-r--r--library/cpp/messagebus/connection.h4
-rw-r--r--library/cpp/messagebus/coreconn.cpp2
-rw-r--r--library/cpp/messagebus/coreconn.h2
-rw-r--r--library/cpp/messagebus/coreconn_ut.cpp2
-rw-r--r--library/cpp/messagebus/debug_receiver/debug_receiver_handler.cpp6
-rw-r--r--library/cpp/messagebus/duration_histogram.cpp6
-rw-r--r--library/cpp/messagebus/duration_histogram.h2
-rw-r--r--library/cpp/messagebus/event_loop.cpp10
-rw-r--r--library/cpp/messagebus/event_loop.h2
-rw-r--r--library/cpp/messagebus/futex_like.h4
-rw-r--r--library/cpp/messagebus/handler.cpp4
-rw-r--r--library/cpp/messagebus/handler.h6
-rw-r--r--library/cpp/messagebus/handler_impl.h4
-rw-r--r--library/cpp/messagebus/key_value_printer.cpp4
-rw-r--r--library/cpp/messagebus/key_value_printer.h4
-rw-r--r--library/cpp/messagebus/latch.h2
-rw-r--r--library/cpp/messagebus/left_right_buffer.h4
-rw-r--r--library/cpp/messagebus/lfqueue_batch.h2
-rw-r--r--library/cpp/messagebus/local_flags.cpp6
-rw-r--r--library/cpp/messagebus/local_flags.h2
-rw-r--r--library/cpp/messagebus/locator.cpp4
-rw-r--r--library/cpp/messagebus/locator.h12
-rw-r--r--library/cpp/messagebus/mb_lwtrace.cpp4
-rw-r--r--library/cpp/messagebus/mb_lwtrace.h4
-rw-r--r--library/cpp/messagebus/message.cpp10
-rw-r--r--library/cpp/messagebus/message.h18
-rw-r--r--library/cpp/messagebus/message_counter.cpp4
-rw-r--r--library/cpp/messagebus/message_counter.h8
-rw-r--r--library/cpp/messagebus/message_ptr_and_header.h6
-rw-r--r--library/cpp/messagebus/message_status.h6
-rw-r--r--library/cpp/messagebus/message_status_counter.cpp4
-rw-r--r--library/cpp/messagebus/message_status_counter.h4
-rw-r--r--library/cpp/messagebus/message_status_counter_ut.cpp4
-rw-r--r--library/cpp/messagebus/messqueue.cpp10
-rw-r--r--library/cpp/messagebus/misc/atomic_box.h4
-rw-r--r--library/cpp/messagebus/misc/granup.h4
-rw-r--r--library/cpp/messagebus/misc/test_sync.h2
-rw-r--r--library/cpp/messagebus/network.cpp6
-rw-r--r--library/cpp/messagebus/network.h6
-rw-r--r--library/cpp/messagebus/network_ut.cpp2
-rw-r--r--library/cpp/messagebus/oldmodule/module.cpp6
-rw-r--r--library/cpp/messagebus/oldmodule/module.h8
-rw-r--r--library/cpp/messagebus/oldmodule/startsession.cpp6
-rw-r--r--library/cpp/messagebus/oldmodule/startsession.h2
-rw-r--r--library/cpp/messagebus/protobuf/ybusbuf.cpp4
-rw-r--r--library/cpp/messagebus/protobuf/ybusbuf.h6
-rw-r--r--library/cpp/messagebus/rain_check/core/coro.cpp6
-rw-r--r--library/cpp/messagebus/rain_check/core/coro_stack.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/core/coro_ut.cpp2
-rw-r--r--library/cpp/messagebus/rain_check/core/env.h6
-rw-r--r--library/cpp/messagebus/rain_check/core/rain_check.h4
-rw-r--r--library/cpp/messagebus/rain_check/core/simple_ut.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/core/sleep.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/core/sleep.h4
-rw-r--r--library/cpp/messagebus/rain_check/core/sleep_ut.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/core/spawn.h2
-rw-r--r--library/cpp/messagebus/rain_check/core/spawn_ut.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/core/task.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/core/task.h8
-rw-r--r--library/cpp/messagebus/rain_check/core/track.h10
-rw-r--r--library/cpp/messagebus/rain_check/core/track_ut.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/http/client.cpp2
-rw-r--r--library/cpp/messagebus/rain_check/http/client.h2
-rw-r--r--library/cpp/messagebus/rain_check/http/client_ut.cpp12
-rw-r--r--library/cpp/messagebus/rain_check/http/http_code_extractor.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/http/http_code_extractor.h2
-rw-r--r--library/cpp/messagebus/rain_check/messagebus/messagebus_client.h2
-rw-r--r--library/cpp/messagebus/rain_check/messagebus/messagebus_client_ut.cpp8
-rw-r--r--library/cpp/messagebus/rain_check/messagebus/messagebus_server.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/messagebus/messagebus_server_ut.cpp2
-rw-r--r--library/cpp/messagebus/rain_check/test/helper/misc.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/test/perftest/perftest.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/test/ut/test.h2
-rw-r--r--library/cpp/messagebus/remote_client_connection.cpp8
-rw-r--r--library/cpp/messagebus/remote_client_connection.h8
-rw-r--r--library/cpp/messagebus/remote_client_session.cpp6
-rw-r--r--library/cpp/messagebus/remote_client_session.h6
-rw-r--r--library/cpp/messagebus/remote_client_session_semaphore.cpp6
-rw-r--r--library/cpp/messagebus/remote_client_session_semaphore.h8
-rw-r--r--library/cpp/messagebus/remote_connection.cpp16
-rw-r--r--library/cpp/messagebus/remote_connection.h22
-rw-r--r--library/cpp/messagebus/remote_connection_status.cpp10
-rw-r--r--library/cpp/messagebus/remote_connection_status.h8
-rw-r--r--library/cpp/messagebus/remote_server_connection.cpp4
-rw-r--r--library/cpp/messagebus/remote_server_connection.h4
-rw-r--r--library/cpp/messagebus/remote_server_session.cpp14
-rw-r--r--library/cpp/messagebus/remote_server_session_semaphore.cpp6
-rw-r--r--library/cpp/messagebus/remote_server_session_semaphore.h4
-rw-r--r--library/cpp/messagebus/scheduler/scheduler.h8
-rw-r--r--library/cpp/messagebus/scheduler_actor.h2
-rw-r--r--library/cpp/messagebus/scheduler_actor_ut.cpp2
-rw-r--r--library/cpp/messagebus/session.cpp4
-rw-r--r--library/cpp/messagebus/session.h14
-rw-r--r--library/cpp/messagebus/session_impl.cpp14
-rw-r--r--library/cpp/messagebus/session_impl.h18
-rw-r--r--library/cpp/messagebus/session_job_count.cpp4
-rw-r--r--library/cpp/messagebus/session_job_count.h2
-rw-r--r--library/cpp/messagebus/shutdown_state.cpp4
-rw-r--r--library/cpp/messagebus/shutdown_state.h4
-rw-r--r--library/cpp/messagebus/socket_addr.cpp8
-rw-r--r--library/cpp/messagebus/socket_addr.h8
-rw-r--r--library/cpp/messagebus/socket_addr_ut.cpp6
-rw-r--r--library/cpp/messagebus/storage.cpp4
-rw-r--r--library/cpp/messagebus/storage.h14
-rw-r--r--library/cpp/messagebus/synchandler.cpp2
-rw-r--r--library/cpp/messagebus/test/example/client/client.cpp2
-rw-r--r--library/cpp/messagebus/test/example/common/proto.h2
-rw-r--r--library/cpp/messagebus/test/helper/example.cpp4
-rw-r--r--library/cpp/messagebus/test/helper/example.h6
-rw-r--r--library/cpp/messagebus/test/helper/example_module.h2
-rw-r--r--library/cpp/messagebus/test/helper/fixed_port.cpp6
-rw-r--r--library/cpp/messagebus/test/helper/hanging_server.cpp4
-rw-r--r--library/cpp/messagebus/test/helper/hanging_server.h2
-rw-r--r--library/cpp/messagebus/test/helper/message_handler_error.cpp4
-rw-r--r--library/cpp/messagebus/test/helper/object_count_check.h6
-rw-r--r--library/cpp/messagebus/test/perftest/perftest.cpp2
-rw-r--r--library/cpp/messagebus/test/perftest/simple_proto.cpp4
-rw-r--r--library/cpp/messagebus/test/ut/locator_uniq_ut.cpp2
-rw-r--r--library/cpp/messagebus/test/ut/module_client_one_way_ut.cpp2
-rw-r--r--library/cpp/messagebus/test/ut/module_client_ut.cpp10
-rw-r--r--library/cpp/messagebus/test/ut/module_server_ut.cpp10
-rw-r--r--library/cpp/messagebus/use_after_free_checker.cpp4
-rw-r--r--library/cpp/messagebus/use_after_free_checker.h2
-rw-r--r--library/cpp/messagebus/use_count_checker.cpp6
-rw-r--r--library/cpp/messagebus/vector_swaps.h6
-rw-r--r--library/cpp/messagebus/www/html_output.h6
-rw-r--r--library/cpp/messagebus/www/www.cpp16
-rw-r--r--library/cpp/messagebus/www/www.h4
-rw-r--r--library/cpp/messagebus/ybus.h24
-rw-r--r--library/cpp/threading/future/core/future-inl.h62
-rw-r--r--library/cpp/threading/future/core/future.h4
-rw-r--r--library/cpp/threading/future/future_ut.cpp24
-rw-r--r--library/cpp/ya.make12
-rw-r--r--library/python/runtime_py3/main/get_py_main.cpp16
-rw-r--r--library/python/runtime_py3/main/main.c40
-rw-r--r--library/python/runtime_py3/main/ya.make4
-rw-r--r--library/python/symbols/ya.make2
-rw-r--r--tools/fix_elf/patch.h2
-rw-r--r--util/folder/path.cpp56
-rw-r--r--util/folder/path_ut.cpp590
-rw-r--r--util/system/fstat.cpp6
340 files changed, 30910 insertions, 30910 deletions
diff --git a/build/conf_fatal_error/ya.make b/build/conf_fatal_error/ya.make
index 40c85f1079..f2475a47ec 100644
--- a/build/conf_fatal_error/ya.make
+++ b/build/conf_fatal_error/ya.make
@@ -1,7 +1,7 @@
-OWNER(g:ymake kikht)
-RESOURCES_LIBRARY()
-SET(FATAL_ERROR_MODULE yes)
+OWNER(g:ymake kikht)
+RESOURCES_LIBRARY()
+SET(FATAL_ERROR_MODULE yes)
IF (FATAL_ERROR_MESSAGE != "")
- MESSAGE(FATAL_ERROR $FATAL_ERROR_MESSAGE)
-ENDIF()
-END()
+ MESSAGE(FATAL_ERROR $FATAL_ERROR_MESSAGE)
+ENDIF()
+END()
diff --git a/build/plugins/pybuild.py b/build/plugins/pybuild.py
index f32a2d39a0..709ed035eb 100644
--- a/build/plugins/pybuild.py
+++ b/build/plugins/pybuild.py
@@ -76,7 +76,7 @@ def parse_pyx_includes(filename, path, source_root, seen=None):
with open(abs_path, 'rb') as f:
# Don't parse cimports and etc - irrelevant for cython, it's linker work
- includes = ymake.parse_cython_includes(f.read())
+ includes = ymake.parse_cython_includes(f.read())
abs_dirname = os.path.dirname(abs_path)
# All includes are relative to the file which include
diff --git a/build/plugins/swig.py b/build/plugins/swig.py
index 32a37204a6..85aa40a50a 100644
--- a/build/plugins/swig.py
+++ b/build/plugins/swig.py
@@ -68,7 +68,7 @@ class Swig(iw.CustomCommand):
if self._swig_lang in ['jni_cpp', 'java']:
self._out_header = os.path.splitext(self._main_out)[0] + '.h'
if (not unit.get('USE_SYSTEM_JDK')) and (unit.get('OS_ANDROID') != "yes"):
- unit.onpeerdir(['contrib/libs/jdk'])
+ unit.onpeerdir(['contrib/libs/jdk'])
self._package = 'ru.yandex.' + os.path.dirname(self._path).replace('$S/', '').replace('$B/', '').replace('/', '.').replace('-', '_')
if self._swig_lang in ['jni_java', 'java']:
diff --git a/build/rules/contrib_deprecated.policy b/build/rules/contrib_deprecated.policy
index 5f6f93ac4f..48ba087e16 100644
--- a/build/rules/contrib_deprecated.policy
+++ b/build/rules/contrib_deprecated.policy
@@ -11,7 +11,7 @@ ALLOW mds -> contrib/deprecated/wangle
# Use newer version from contrib/libs/mongo-cxx-driver instead
ALLOW mds/mastermind/ -> contrib/deprecated/mongo-cxx-driver
-
+
# libpqtypes is not being developed since 2016 and is known to have bugs.
# Consider using libpqxx / maps/libs/sql_chemistry instread.
ALLOW mds/libs/postgres -> contrib/deprecated/libpqtypes
@@ -24,7 +24,7 @@ ALLOW quasar/backend/ -> contrib/deprecated/jsoncpp
ALLOW smart_devices/ -> contrib/deprecated/jsoncpp
ALLOW speechkit/ -> contrib/deprecated/jsoncpp
ALLOW yandex_io/ -> contrib/deprecated/jsoncpp
-
+
# mimepp is not being developed since 2012 and requires paid license
ALLOW mail/so/ -> contrib/deprecated/mimepp
ALLOW mail/so/spamstop/ -> contrib/deprecated/udns
diff --git a/build/rules/ya.make b/build/rules/ya.make
index cc926680e8..297f5252ad 100644
--- a/build/rules/ya.make
+++ b/build/rules/ya.make
@@ -1 +1 @@
-OWNER(g:ymake g:contrib)
+OWNER(g:ymake g:contrib)
diff --git a/build/scripts/link_dyn_lib.py b/build/scripts/link_dyn_lib.py
index 23487f5c1e..e1ebf5ede2 100644
--- a/build/scripts/link_dyn_lib.py
+++ b/build/scripts/link_dyn_lib.py
@@ -226,7 +226,7 @@ C++ geobase5::hardcoded_service
"""
filename = write_temp_file(export_file_content)
args = ['-Wl,--version-script={}'.format(filename)]
- assert fix_cmd('DARWIN', False, args) == [
+ assert fix_cmd('DARWIN', False, args) == [
'-Wl,-exported_symbol,__ZN8geobase57details11lookup_impl*',
'-Wl,-exported_symbol,__ZTIN8geobase57details11lookup_impl*',
'-Wl,-exported_symbol,__ZTSN8geobase57details11lookup_impl*',
diff --git a/build/scripts/run_msvc_wine.py b/build/scripts/run_msvc_wine.py
index 439d1f8831..c4c2b002a3 100644
--- a/build/scripts/run_msvc_wine.py
+++ b/build/scripts/run_msvc_wine.py
@@ -319,28 +319,28 @@ def colorize(out):
def trim_path(path, winepath):
- p1 = run_subprocess([winepath, '-w', path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- p1_stdout, p1_stderr = p1.communicate()
- win_path = p1_stdout.strip()
-
- if p1.returncode != 0 or not win_path:
- # Fall back to only winepath -s
- win_path = path
-
- p2 = run_subprocess([winepath, '-s', win_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- p2_stdout, p2_stderr = p2.communicate()
- short_path = p2_stdout.strip()
-
- check_path = short_path
- if check_path.startswith(('Z:', 'z:')):
- check_path = check_path[2:]
-
- if not check_path[1:].startswith((path[1:4], path[1:4].upper())):
- raise Exception('Cannot trim path {}; 1st winepath exit code: {}, stdout:\n{}\n stderr:\n{}\n 2nd winepath exit code: {}, stdout:\n{}\n stderr:\n{}'.format(path, p1.returncode, p1_stdout, p1_stderr, p2.returncode, p2_stdout, p2_stderr))
-
- return short_path
-
-
+ p1 = run_subprocess([winepath, '-w', path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ p1_stdout, p1_stderr = p1.communicate()
+ win_path = p1_stdout.strip()
+
+ if p1.returncode != 0 or not win_path:
+ # Fall back to only winepath -s
+ win_path = path
+
+ p2 = run_subprocess([winepath, '-s', win_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ p2_stdout, p2_stderr = p2.communicate()
+ short_path = p2_stdout.strip()
+
+ check_path = short_path
+ if check_path.startswith(('Z:', 'z:')):
+ check_path = check_path[2:]
+
+ if not check_path[1:].startswith((path[1:4], path[1:4].upper())):
+ raise Exception('Cannot trim path {}; 1st winepath exit code: {}, stdout:\n{}\n stderr:\n{}\n 2nd winepath exit code: {}, stdout:\n{}\n stderr:\n{}'.format(path, p1.returncode, p1_stdout, p1_stderr, p2.returncode, p2_stdout, p2_stderr))
+
+ return short_path
+
+
def downsize_path(path, short_names):
flag = ''
if path.startswith('/Fo'):
diff --git a/build/sysincl/android.yml b/build/sysincl/android.yml
index 97cfbf38d2..499df786ae 100644
--- a/build/sysincl/android.yml
+++ b/build/sysincl/android.yml
@@ -1,4 +1,4 @@
-- includes:
+- includes:
- android/asset_manager.h
- android/asset_manager_jni.h
- android/dlext.h
diff --git a/build/sysincl/darwin.yml b/build/sysincl/darwin.yml
index 582c7e1202..419d8170f6 100644
--- a/build/sysincl/darwin.yml
+++ b/build/sysincl/darwin.yml
@@ -1,235 +1,235 @@
-- includes:
+- includes:
# These headers actually exist in arcadia, so we either should use them and
# add proper PEERDIR, or should #error them if they are not really used:
- # - bzlib.h
- # - db.h
- # - expat.h
- # - expat_external.h
- # - libunwind.h
- # - libxslt/documents.h
- # - libxslt/extensions.h
- # - libxslt/transform.h
- # - libxslt/xsltutils.h
- # - pcap-bpf.h
- # - pcap-namedb.h
- # - pcap.h
- # - pcap/bpf.h
- # - pcap/namedb.h
- # - pcap/pcap.h
- # - sasl/sasl.h
- # - sasl/saslutil.h
- # - uuid/uuid.h
- # - zconf.h
-
- - Availability.h
- - AvailabilityMacros.h
- - Block.h
- - CommonCrypto/CommonCrypto.h
- - CommonCrypto/CommonCryptor.h
- - CommonCrypto/CommonDigest.h
- - CommonCrypto/CommonHMAC.h
+ # - bzlib.h
+ # - db.h
+ # - expat.h
+ # - expat_external.h
+ # - libunwind.h
+ # - libxslt/documents.h
+ # - libxslt/extensions.h
+ # - libxslt/transform.h
+ # - libxslt/xsltutils.h
+ # - pcap-bpf.h
+ # - pcap-namedb.h
+ # - pcap.h
+ # - pcap/bpf.h
+ # - pcap/namedb.h
+ # - pcap/pcap.h
+ # - sasl/sasl.h
+ # - sasl/saslutil.h
+ # - uuid/uuid.h
+ # - zconf.h
+
+ - Availability.h
+ - AvailabilityMacros.h
+ - Block.h
+ - CommonCrypto/CommonCrypto.h
+ - CommonCrypto/CommonCryptor.h
+ - CommonCrypto/CommonDigest.h
+ - CommonCrypto/CommonHMAC.h
- CommonCrypto/CommonKeyDerivation.h
- - ConditionalMacros.h
+ - ConditionalMacros.h
- DiskArbitration/DiskArbitration.h
- Endian.h
- - MacTypes.h
- - TargetConditionals.h
- - architecture/byte_order.h
- - asl.h
- - copyfile.h
- - crt_externs.h
- - curses.h
- - dispatch/dispatch.h
- - editline/readline.h
- - ffi/ffi.h
- - form.h
- - gssapi.h
- - gssapi/gssapi.h
- - gssapi/gssapi_generic.h
- - gssapi/gssapi_krb5.h
- - histedit.h
- - krb5.h
- - launch.h
- - libkern/OSAtomic.h
- - libkern/OSByteOrder.h
- - libkern/OSCacheControl.h
- - libproc.h
- - mach-o/dyld.h
- - mach-o/getsect.h
- - mach-o/loader.h
- - mach/clock.h
- - mach/clock_types.h
+ - MacTypes.h
+ - TargetConditionals.h
+ - architecture/byte_order.h
+ - asl.h
+ - copyfile.h
+ - crt_externs.h
+ - curses.h
+ - dispatch/dispatch.h
+ - editline/readline.h
+ - ffi/ffi.h
+ - form.h
+ - gssapi.h
+ - gssapi/gssapi.h
+ - gssapi/gssapi_generic.h
+ - gssapi/gssapi_krb5.h
+ - histedit.h
+ - krb5.h
+ - launch.h
+ - libkern/OSAtomic.h
+ - libkern/OSByteOrder.h
+ - libkern/OSCacheControl.h
+ - libproc.h
+ - mach-o/dyld.h
+ - mach-o/getsect.h
+ - mach-o/loader.h
+ - mach/clock.h
+ - mach/clock_types.h
- mach/error.h
- - mach/host_info.h
- - mach/kern_return.h
- - mach/mach.h
- - mach/mach_error.h
- - mach/mach_host.h
- - mach/mach_init.h
- - mach/mach_port.h
- - mach/mach_time.h
- - mach/mach_traps.h
- - mach/mach_types.h
- - mach/mach_vm.h
- - mach/machine.h
+ - mach/host_info.h
+ - mach/kern_return.h
+ - mach/mach.h
+ - mach/mach_error.h
+ - mach/mach_host.h
+ - mach/mach_init.h
+ - mach/mach_port.h
+ - mach/mach_time.h
+ - mach/mach_traps.h
+ - mach/mach_types.h
+ - mach/mach_vm.h
+ - mach/machine.h
- mach/machine/vm_param.h
- mach/processor_info.h
- - mach/semaphore.h
- - mach/shared_memory_server.h
- - mach/shared_region.h
- - mach/task.h
- - mach/thread_act.h
- - mach/thread_info.h
- - mach/thread_policy.h
- - mach/vm_map.h
- - mach/vm_param.h
- - mach/vm_statistics.h
- - machine/_limits.h
- - machine/_types.h
- - machine/byte_order.h
- - machine/endian.h
- - machine/limits.h
- - machine/param.h
- - machine/signal.h
- - machine/vmparam.h
- - malloc/malloc.h
- - menu.h
- - ndbm.h
- - net/bpf.h
- - net/if_dl.h
- - net/if_media.h
- - net/if_types.h
+ - mach/semaphore.h
+ - mach/shared_memory_server.h
+ - mach/shared_region.h
+ - mach/task.h
+ - mach/thread_act.h
+ - mach/thread_info.h
+ - mach/thread_policy.h
+ - mach/vm_map.h
+ - mach/vm_param.h
+ - mach/vm_statistics.h
+ - machine/_limits.h
+ - machine/_types.h
+ - machine/byte_order.h
+ - machine/endian.h
+ - machine/limits.h
+ - machine/param.h
+ - machine/signal.h
+ - machine/vmparam.h
+ - malloc/malloc.h
+ - menu.h
+ - ndbm.h
+ - net/bpf.h
+ - net/if_dl.h
+ - net/if_media.h
+ - net/if_types.h
- net/if_var.h
- - netinet/in_pcb.h
- - netinet/ip_var.h
- - netinet/tcp_fsm.h
- - netinet/tcp_timer.h
- - netinet/tcp_var.h
- - netinet/tcpip.h
- - netinet/udp_var.h
- - netinet6/in6.h
- - nlist.h
+ - netinet/in_pcb.h
+ - netinet/ip_var.h
+ - netinet/tcp_fsm.h
+ - netinet/tcp_timer.h
+ - netinet/tcp_var.h
+ - netinet/tcpip.h
+ - netinet/udp_var.h
+ - netinet6/in6.h
+ - nlist.h
- objc/objc-sync.h
- - objc/runtime.h
- - os/lock.h
+ - objc/runtime.h
+ - os/lock.h
- os/proc.h
- os/trace.h
- - panel.h
+ - panel.h
- pthread_spis.h
- - readline/history.h
- - readline/readline.h
+ - readline/history.h
+ - readline/readline.h
- readpassphrase.h
- - runetype.h
+ - runetype.h
- simd/simd.h
- - strhash.h
- - sys/_types.h
- - sys/acl.h
- - sys/aio.h
- - sys/attr.h
+ - strhash.h
+ - sys/_types.h
+ - sys/acl.h
+ - sys/aio.h
+ - sys/attr.h
- sys/clonefile.h
- - sys/dirent.h
- - sys/disk.h
- - sys/domain.h
- - sys/event.h
- - sys/filio.h
- - sys/ioccom.h
- - sys/kauth.h
- - sys/kern_control.h
- - sys/lock.h
- - sys/malloc.h
- - sys/mbuf.h
- - sys/msgbuf.h
- - sys/posix_shm.h
- - sys/proc.h
- - sys/proc_info.h
- - sys/protosw.h
- - sys/sdt.h
- - sys/sockio.h
- - sys/sys_domain.h
- - sys/syslimits.h
- - sys/ttycom.h
- - sys/ucred.h
- - sys/unpcb.h
- - sys/vmmeter.h
- - sys/vnode.h
- - tcl.h
- - term.h
- - termcap.h
- - timeconv.h
- - tzfile.h
- - util.h
- - vis.h
+ - sys/dirent.h
+ - sys/disk.h
+ - sys/domain.h
+ - sys/event.h
+ - sys/filio.h
+ - sys/ioccom.h
+ - sys/kauth.h
+ - sys/kern_control.h
+ - sys/lock.h
+ - sys/malloc.h
+ - sys/mbuf.h
+ - sys/msgbuf.h
+ - sys/posix_shm.h
+ - sys/proc.h
+ - sys/proc_info.h
+ - sys/protosw.h
+ - sys/sdt.h
+ - sys/sockio.h
+ - sys/sys_domain.h
+ - sys/syslimits.h
+ - sys/ttycom.h
+ - sys/ucred.h
+ - sys/unpcb.h
+ - sys/vmmeter.h
+ - sys/vnode.h
+ - tcl.h
+ - term.h
+ - termcap.h
+ - timeconv.h
+ - tzfile.h
+ - util.h
+ - vis.h
- xpc/xpc.h
-
- # OSX frameworks
- - Accelerate/Accelerate.h
+
+ # OSX frameworks
+ - Accelerate/Accelerate.h
- AppKit/AppKit.h
- AppKit/NSView.h
- - ApplicationServices/ApplicationServices.h
- - AudioToolbox/AudioToolbox.h
+ - ApplicationServices/ApplicationServices.h
+ - AudioToolbox/AudioToolbox.h
- AVFoundation/AVFoundation.h
- CFNetwork/CFNetwork.h
- - Cocoa/Cocoa.h
- - CoreFoundation/CFBase.h
+ - Cocoa/Cocoa.h
+ - CoreFoundation/CFBase.h
- CoreFoundation/CFBundle.h
- - CoreFoundation/CFData.h
- - CoreFoundation/CFDictionary.h
- - CoreFoundation/CFLocale.h
- - CoreFoundation/CFNumber.h
- - CoreFoundation/CFPreferences.h
- - CoreFoundation/CFRunLoop.h
- - CoreFoundation/CFString.h
+ - CoreFoundation/CFData.h
+ - CoreFoundation/CFDictionary.h
+ - CoreFoundation/CFLocale.h
+ - CoreFoundation/CFNumber.h
+ - CoreFoundation/CFPreferences.h
+ - CoreFoundation/CFRunLoop.h
+ - CoreFoundation/CFString.h
- CoreFoundation/CFTimeZone.h
- CoreFoundation/CFUUID.h
- - CoreFoundation/CoreFoundation.h
- - CoreGraphics/CoreGraphics.h
- - CoreLocation/CoreLocation.h
- - CoreMedia/CoreMedia.h
- - CoreMotion/CoreMotion.h
- - CoreServices/CoreServices.h
- - CoreTelephony/CTCarrier.h
- - CoreTelephony/CTTelephonyNetworkInfo.h
- - CoreText/CoreText.h
- - CoreVideo/CoreVideo.h
- - Foundation/Foundation.h
- - Foundation/NSException.h
- - Foundation/NSString.h
+ - CoreFoundation/CoreFoundation.h
+ - CoreGraphics/CoreGraphics.h
+ - CoreLocation/CoreLocation.h
+ - CoreMedia/CoreMedia.h
+ - CoreMotion/CoreMotion.h
+ - CoreServices/CoreServices.h
+ - CoreTelephony/CTCarrier.h
+ - CoreTelephony/CTTelephonyNetworkInfo.h
+ - CoreText/CoreText.h
+ - CoreVideo/CoreVideo.h
+ - Foundation/Foundation.h
+ - Foundation/NSException.h
+ - Foundation/NSString.h
- Foundation/NSKeyValueObserving.h
- Foundation/NSObject.h
- - GLKit/GLKit.h
- - IOKit/IOBSD.h
- - IOKit/IOKitLib.h
- - IOKit/kext/KextManager.h
- - IOKit/ps/IOPSKeys.h
- - IOKit/ps/IOPSKeys.h
- - IOKit/ps/IOPowerSources.h
- - IOKit/ps/IOPowerSources.h
- - IOKit/ps/IOPowerSources.h
- - IOKit/storage/IOBlockStorageDriver.h
- - IOKit/storage/IOMedia.h
+ - GLKit/GLKit.h
+ - IOKit/IOBSD.h
+ - IOKit/IOKitLib.h
+ - IOKit/kext/KextManager.h
+ - IOKit/ps/IOPSKeys.h
+ - IOKit/ps/IOPSKeys.h
+ - IOKit/ps/IOPowerSources.h
+ - IOKit/ps/IOPowerSources.h
+ - IOKit/ps/IOPowerSources.h
+ - IOKit/storage/IOBlockStorageDriver.h
+ - IOKit/storage/IOMedia.h
- IOSurface/IOSurfaceRef.h
- Metal/Metal.h
- metal_stdlib
- - OpenCL/cl.h
- - OpenCL/cl_gl.h
- - OpenCL/opencl.h
+ - OpenCL/cl.h
+ - OpenCL/cl_gl.h
+ - OpenCL/opencl.h
- OpenGLES/ES2/gl.h
- Speech/Speech.h
- - QuartzCore/QuartzCore.h
+ - QuartzCore/QuartzCore.h
- QuartzCore/CAEAGLLayer.h
- QuartzCore/CAMetalLayer.h
- - Security/SecCertificate.h
- - Security/SecKey.h
- - Security/SecRandom.h
- - Security/SecureTransport.h
- - Security/Security.h
- - SystemConfiguration/SystemConfiguration.h
- - UIKit/UIImage.h
- - UIKit/UIKit.h
+ - Security/SecCertificate.h
+ - Security/SecKey.h
+ - Security/SecRandom.h
+ - Security/SecureTransport.h
+ - Security/Security.h
+ - SystemConfiguration/SystemConfiguration.h
+ - UIKit/UIImage.h
+ - UIKit/UIKit.h
- UIKit/UIScreen.h
- - UIKit/UIWebView.h
+ - UIKit/UIWebView.h
- UIKit/UIView.h
- - VideoDecodeAcceleration/VDADecoder.h
- - VideoToolbox/VideoToolbox.h
- - XCTest/XCTest.h
+ - VideoDecodeAcceleration/VDADecoder.h
+ - VideoToolbox/VideoToolbox.h
+ - XCTest/XCTest.h
- CoreFoundation/CFByteOrder.h
diff --git a/build/sysincl/ibdrv.yml b/build/sysincl/ibdrv.yml
index 5cf2c36078..a8a59f6aa9 100644
--- a/build/sysincl/ibdrv.yml
+++ b/build/sysincl/ibdrv.yml
@@ -4,9 +4,9 @@
# (transitively from library/cpp/netliba). They are replaced by empty
# files in put_arcadia_to_git.sh.
-- source_filter: "^contrib/libs/ibdrv"
- includes:
+- source_filter: "^contrib/libs/ibdrv"
+ includes:
- infiniband/sa.h
- - infiniband/verbs.h
+ - infiniband/verbs.h
- infiniband/verbs_api.h
- - rdma/rdma_cma.h
+ - rdma/rdma_cma.h
diff --git a/build/sysincl/intrinsic.yml b/build/sysincl/intrinsic.yml
index 9355b61c13..b3a8e4fc9f 100644
--- a/build/sysincl/intrinsic.yml
+++ b/build/sysincl/intrinsic.yml
@@ -1,35 +1,35 @@
-- includes:
- - Intrin.h
- - ammintrin.h
- - arm_acle.h
- - arm_neon.h
- - arm64_neon.h
- - armintr.h
- - avx2intrin.h
- - avxintrin.h
- - bmi2intrin.h
- - bmiintrin.h
- - cmnintrin.h
+- includes:
+ - Intrin.h
+ - ammintrin.h
+ - arm_acle.h
+ - arm_neon.h
+ - arm64_neon.h
+ - armintr.h
+ - avx2intrin.h
+ - avxintrin.h
+ - bmi2intrin.h
+ - bmiintrin.h
+ - cmnintrin.h
- e2kbuiltin.h
- - emmintrin.h
- - f16cintrin.h
- - fma4intrin.h
- - fmaintrin.h
- - ia32intrin.h
- - ia64intrin.h
- - immintrin.h
- - intrin.h
+ - emmintrin.h
+ - f16cintrin.h
+ - fma4intrin.h
+ - fmaintrin.h
+ - ia32intrin.h
+ - ia64intrin.h
+ - immintrin.h
+ - intrin.h
- intrinsics.h
- - lzcntintrin.h
- - mm3dnow.h
- - mmintrin.h
+ - lzcntintrin.h
+ - mm3dnow.h
+ - mmintrin.h
- msa.h
- - nmmintrin.h
- - pmmintrin.h
- - popcntintrin.h
- - prfchwintrin.h
- - rdseedintrin.h
- - rtmintrin.h
+ - nmmintrin.h
+ - pmmintrin.h
+ - popcntintrin.h
+ - prfchwintrin.h
+ - rdseedintrin.h
+ - rtmintrin.h
- s390intrin.h
- sanitizer/asan_interface.h
- sanitizer/common_interface_defs.h
@@ -38,10 +38,10 @@
- sanitizer/msan_interface.h
- sanitizer/tsan_interface.h
- sanitizer/tsan_interface_atomic.h
- - smmintrin.h
- - tbmintrin.h
- - tmmintrin.h
- - wmmintrin.h
- - x86intrin.h
- - xmmintrin.h
- - xopintrin.h
+ - smmintrin.h
+ - tbmintrin.h
+ - tmmintrin.h
+ - wmmintrin.h
+ - x86intrin.h
+ - xmmintrin.h
+ - xopintrin.h
diff --git a/build/sysincl/libc-musl-libcxx.yml b/build/sysincl/libc-musl-libcxx.yml
index 539ce8e9aa..87772d2503 100644
--- a/build/sysincl/libc-musl-libcxx.yml
+++ b/build/sysincl/libc-musl-libcxx.yml
@@ -1,6 +1,6 @@
-- source_filter: "^contrib/libs/musl"
- includes:
- - inttypes.h: contrib/libs/cxxsupp/libcxx/include/inttypes.h
- - string.h: contrib/libs/cxxsupp/libcxx/include/string.h
+- source_filter: "^contrib/libs/musl"
+ includes:
+ - inttypes.h: contrib/libs/cxxsupp/libcxx/include/inttypes.h
+ - string.h: contrib/libs/cxxsupp/libcxx/include/string.h
- stddef.h: contrib/libs/cxxsupp/libcxx/include/stddef.h
- - stdint.h: contrib/libs/cxxsupp/libcxx/include/stdint.h
+ - stdint.h: contrib/libs/cxxsupp/libcxx/include/stdint.h
diff --git a/build/sysincl/libc-to-musl.yml b/build/sysincl/libc-to-musl.yml
index 810dd8d697..2d8051c80b 100644
--- a/build/sysincl/libc-to-musl.yml
+++ b/build/sysincl/libc-to-musl.yml
@@ -1,80 +1,80 @@
-# libc & stl common headers should be resolved to either
-# * system libc (e.g. nothing in our repo)
-# * system libc++ (e.g. nothing in our repo)
-# * libcxx
-# * musl
-# or some combination of them depending on the build flags.
-
-# Musl has some internal header replacements. We will just resolve to both.
+# libc & stl common headers should be resolved to either
+# * system libc (e.g. nothing in our repo)
+# * system libc++ (e.g. nothing in our repo)
+# * libcxx
+# * musl
+# or some combination of them depending on the build flags.
+
+# Musl has some internal header replacements. We will just resolve to both.
- source_filter: "^(contrib/libs/musl|contrib/libs/cxxsupp/libcxx/include/__config)"
- includes:
- - arpa/inet.h:
- - contrib/libs/musl/include/arpa/inet.h
- - contrib/libs/musl/src/include/arpa/inet.h
- - crypt.h:
- - contrib/libs/musl/include/crypt.h
- - contrib/libs/musl/src/include/crypt.h
- - errno.h:
- - contrib/libs/musl/include/errno.h
- - contrib/libs/musl/src/include/errno.h
- - features.h:
- - contrib/libs/musl/include/features.h
- - contrib/libs/musl/src/include/features.h
- - langinfo.h:
- - contrib/libs/musl/include/langinfo.h
- - contrib/libs/musl/src/include/langinfo.h
- - pthread.h:
- - contrib/libs/musl/include/pthread.h
- - contrib/libs/musl/src/include/pthread.h
- - resolv.h:
- - contrib/libs/musl/include/resolv.h
- - contrib/libs/musl/src/include/resolv.h
- - signal.h:
- - contrib/libs/musl/include/signal.h
- - contrib/libs/musl/src/include/signal.h
- - stdio.h:
- - contrib/libs/musl/include/stdio.h
- - contrib/libs/musl/src/include/stdio.h
- - stdlib.h:
- - contrib/libs/musl/include/stdlib.h
- - contrib/libs/musl/src/include/stdlib.h
- - string.h:
- - contrib/libs/musl/include/string.h
- - contrib/libs/musl/src/include/string.h
- - sys/auxv.h:
- - contrib/libs/musl/include/sys/auxv.h
- - contrib/libs/musl/src/include/sys/auxv.h
- - sys/membarrier.h:
- - contrib/libs/musl/include/sys/membarrier.h
- - contrib/libs/musl/src/include/sys/membarrier.h
- - sys/mman.h:
- - contrib/libs/musl/include/sys/mman.h
- - contrib/libs/musl/src/include/sys/mman.h
- - sys/sysinfo.h:
- - contrib/libs/musl/include/sys/sysinfo.h
- - contrib/libs/musl/src/include/sys/sysinfo.h
- - sys/time.h:
- - contrib/libs/musl/include/sys/time.h
- - contrib/libs/musl/src/include/sys/time.h
- - time.h:
- - contrib/libs/musl/include/time.h
- - contrib/libs/musl/src/include/time.h
- - unistd.h:
- - contrib/libs/musl/include/unistd.h
- - contrib/libs/musl/src/include/unistd.h
- - wchar.h:
- - contrib/libs/musl/include/wchar.h
- - contrib/libs/musl/src/include/wchar.h
-
- - inttypes.h: contrib/libs/musl/include/inttypes.h
+ includes:
+ - arpa/inet.h:
+ - contrib/libs/musl/include/arpa/inet.h
+ - contrib/libs/musl/src/include/arpa/inet.h
+ - crypt.h:
+ - contrib/libs/musl/include/crypt.h
+ - contrib/libs/musl/src/include/crypt.h
+ - errno.h:
+ - contrib/libs/musl/include/errno.h
+ - contrib/libs/musl/src/include/errno.h
+ - features.h:
+ - contrib/libs/musl/include/features.h
+ - contrib/libs/musl/src/include/features.h
+ - langinfo.h:
+ - contrib/libs/musl/include/langinfo.h
+ - contrib/libs/musl/src/include/langinfo.h
+ - pthread.h:
+ - contrib/libs/musl/include/pthread.h
+ - contrib/libs/musl/src/include/pthread.h
+ - resolv.h:
+ - contrib/libs/musl/include/resolv.h
+ - contrib/libs/musl/src/include/resolv.h
+ - signal.h:
+ - contrib/libs/musl/include/signal.h
+ - contrib/libs/musl/src/include/signal.h
+ - stdio.h:
+ - contrib/libs/musl/include/stdio.h
+ - contrib/libs/musl/src/include/stdio.h
+ - stdlib.h:
+ - contrib/libs/musl/include/stdlib.h
+ - contrib/libs/musl/src/include/stdlib.h
+ - string.h:
+ - contrib/libs/musl/include/string.h
+ - contrib/libs/musl/src/include/string.h
+ - sys/auxv.h:
+ - contrib/libs/musl/include/sys/auxv.h
+ - contrib/libs/musl/src/include/sys/auxv.h
+ - sys/membarrier.h:
+ - contrib/libs/musl/include/sys/membarrier.h
+ - contrib/libs/musl/src/include/sys/membarrier.h
+ - sys/mman.h:
+ - contrib/libs/musl/include/sys/mman.h
+ - contrib/libs/musl/src/include/sys/mman.h
+ - sys/sysinfo.h:
+ - contrib/libs/musl/include/sys/sysinfo.h
+ - contrib/libs/musl/src/include/sys/sysinfo.h
+ - sys/time.h:
+ - contrib/libs/musl/include/sys/time.h
+ - contrib/libs/musl/src/include/sys/time.h
+ - time.h:
+ - contrib/libs/musl/include/time.h
+ - contrib/libs/musl/src/include/time.h
+ - unistd.h:
+ - contrib/libs/musl/include/unistd.h
+ - contrib/libs/musl/src/include/unistd.h
+ - wchar.h:
+ - contrib/libs/musl/include/wchar.h
+ - contrib/libs/musl/src/include/wchar.h
+
+ - inttypes.h: contrib/libs/musl/include/inttypes.h
- stddef.h: contrib/libs/musl/include/stddef.h
- - stdint.h: contrib/libs/musl/include/stdint.h
-
-
-# We want musl to resolve itself without these sysincls, but its test must have them
+ - stdint.h: contrib/libs/musl/include/stdint.h
+
+
+# We want musl to resolve itself without these sysincls, but its test must have them
- source_filter: "^(?!contrib/libs/musl)|^contrib/libs/musl/tests"
- includes:
- # libc & stl common headers
+ includes:
+ # libc & stl common headers
- complex.h: contrib/libs/musl/include/complex.h
- ctype.h: contrib/libs/musl/include/ctype.h
- errno.h: contrib/libs/musl/include/errno.h
@@ -94,8 +94,8 @@
- threads.h: contrib/libs/musl/include/threads.h
- wchar.h: contrib/libs/musl/include/wchar.h
- wctype.h: contrib/libs/musl/include/wctype.h
-
- # Rest of libc headers
+
+ # Rest of libc headers
- aio.h: contrib/libs/musl/include/aio.h
- alloca.h: contrib/libs/musl/include/alloca.h
- ar.h: contrib/libs/musl/include/ar.h
diff --git a/build/sysincl/libc-to-nothing.yml b/build/sysincl/libc-to-nothing.yml
index 15a413cdbd..bf95e04b15 100644
--- a/build/sysincl/libc-to-nothing.yml
+++ b/build/sysincl/libc-to-nothing.yml
@@ -1,160 +1,160 @@
-# We want musl to resolve itself without these sysincls, but its test must have them
+# We want musl to resolve itself without these sysincls, but its test must have them
- source_filter: "^(?!contrib/libs/musl).*|^contrib/libs/musl/tests"
- includes:
- - aio.h
- - alloca.h
- - ar.h
- - arpa/inet.h
- - arpa/nameser_compat.h
- - arpa/nameser.h
- - arpa/telnet.h
- - arpa/tftp.h
- - assert.h
- - byteswap.h
- - cpio.h
- - crypt.h
- - dirent.h
- - dlfcn.h
- - elf.h
- - endian.h
- - err.h
- - fcntl.h
- - features.h
- - fenv.h
- - fmtmsg.h
- - fnmatch.h
- - ftw.h
- - getopt.h
- - glob.h
- - grp.h
- - iconv.h
- - ifaddrs.h
- - iso646.h
- - langinfo.h
- - lastlog.h
- - libgen.h
- - libintl.h
- - link.h
- - malloc.h
- - memory.h
- - mntent.h
- - monetary.h
- - mqueue.h
- - netdb.h
- - net/ethernet.h
- - net/if_arp.h
+ includes:
+ - aio.h
+ - alloca.h
+ - ar.h
+ - arpa/inet.h
+ - arpa/nameser_compat.h
+ - arpa/nameser.h
+ - arpa/telnet.h
+ - arpa/tftp.h
+ - assert.h
+ - byteswap.h
+ - cpio.h
+ - crypt.h
+ - dirent.h
+ - dlfcn.h
+ - elf.h
+ - endian.h
+ - err.h
+ - fcntl.h
+ - features.h
+ - fenv.h
+ - fmtmsg.h
+ - fnmatch.h
+ - ftw.h
+ - getopt.h
+ - glob.h
+ - grp.h
+ - iconv.h
+ - ifaddrs.h
+ - iso646.h
+ - langinfo.h
+ - lastlog.h
+ - libgen.h
+ - libintl.h
+ - link.h
+ - malloc.h
+ - memory.h
+ - mntent.h
+ - monetary.h
+ - mqueue.h
+ - netdb.h
+ - net/ethernet.h
+ - net/if_arp.h
- net/if_ppp.h
- - net/if.h
- - netinet/ether.h
- - netinet/icmp6.h
- - netinet/if_ether.h
- - netinet/igmp.h
- - netinet/in.h
- - netinet/in_systm.h
- - netinet/ip6.h
- - netinet/ip.h
- - netinet/ip_icmp.h
- - netinet/tcp.h
- - netinet/udp.h
- - netpacket/packet.h
+ - net/if.h
+ - netinet/ether.h
+ - netinet/icmp6.h
+ - netinet/if_ether.h
+ - netinet/igmp.h
+ - netinet/in.h
+ - netinet/in_systm.h
+ - netinet/ip6.h
+ - netinet/ip.h
+ - netinet/ip_icmp.h
+ - netinet/tcp.h
+ - netinet/udp.h
+ - netpacket/packet.h
- netrom/netrom.h
- - net/route.h
- - nl_types.h
- - paths.h
- - poll.h
- - pthread.h
- - pty.h
- - pwd.h
- - regex.h
- - resolv.h
- - sched.h
+ - net/route.h
+ - nl_types.h
+ - paths.h
+ - poll.h
+ - pthread.h
+ - pty.h
+ - pwd.h
+ - regex.h
+ - resolv.h
+ - sched.h
- scsi/scsi.h
- - search.h
- - semaphore.h
- - shadow.h
- - signal.h
- - spawn.h
- - stdalign.h
- - stdarg.h
- - stdio_ext.h
- - stdnoreturn.h
- - strings.h
- - stropts.h
- - sys/acct.h
- - sys/auxv.h
- - sys/cachectl.h
- - syscall.h
- - sys/dir.h
- - sys/epoll.h
- - sys/errno.h
- - sys/eventfd.h
- - sysexits.h
- - sys/fcntl.h
- - sys/file.h
- - sys/fsuid.h
- - sys/inotify.h
- - sys/ioctl.h
- - sys/io.h
- - sys/ipc.h
+ - search.h
+ - semaphore.h
+ - shadow.h
+ - signal.h
+ - spawn.h
+ - stdalign.h
+ - stdarg.h
+ - stdio_ext.h
+ - stdnoreturn.h
+ - strings.h
+ - stropts.h
+ - sys/acct.h
+ - sys/auxv.h
+ - sys/cachectl.h
+ - syscall.h
+ - sys/dir.h
+ - sys/epoll.h
+ - sys/errno.h
+ - sys/eventfd.h
+ - sysexits.h
+ - sys/fcntl.h
+ - sys/file.h
+ - sys/fsuid.h
+ - sys/inotify.h
+ - sys/ioctl.h
+ - sys/io.h
+ - sys/ipc.h
- sys/kd.h
- - syslog.h
- - sys/mman.h
- - sys/mount.h
- - sys/msg.h
- - sys/mtio.h
- - sys/param.h
- - sys/personality.h
- - sys/poll.h
- - sys/prctl.h
- - sys/procfs.h
- - sys/ptrace.h
- - sys/quota.h
- - sys/reboot.h
- - sys/resource.h
- - sys/select.h
- - sys/sem.h
- - sys/sendfile.h
- - sys/shm.h
- - sys/signalfd.h
- - sys/signal.h
- - sys/socket.h
- - sys/soundcard.h
- - sys/statfs.h
- - sys/stat.h
- - sys/statvfs.h
- - sys/stropts.h
- - sys/syscall.h
- - sys/sysinfo.h
- - sys/syslog.h
- - sys/sysmacros.h
- - sys/termios.h
- - sys/timeb.h
- - sys/time.h
- - sys/timerfd.h
- - sys/times.h
- - sys/timex.h
- - sys/ttydefaults.h
- - sys/types.h
- - sys/ucontext.h
- - sys/uio.h
- - sys/un.h
- - sys/user.h
- - sys/utsname.h
- - sys/vfs.h
+ - syslog.h
+ - sys/mman.h
+ - sys/mount.h
+ - sys/msg.h
+ - sys/mtio.h
+ - sys/param.h
+ - sys/personality.h
+ - sys/poll.h
+ - sys/prctl.h
+ - sys/procfs.h
+ - sys/ptrace.h
+ - sys/quota.h
+ - sys/reboot.h
+ - sys/resource.h
+ - sys/select.h
+ - sys/sem.h
+ - sys/sendfile.h
+ - sys/shm.h
+ - sys/signalfd.h
+ - sys/signal.h
+ - sys/socket.h
+ - sys/soundcard.h
+ - sys/statfs.h
+ - sys/stat.h
+ - sys/statvfs.h
+ - sys/stropts.h
+ - sys/syscall.h
+ - sys/sysinfo.h
+ - sys/syslog.h
+ - sys/sysmacros.h
+ - sys/termios.h
+ - sys/timeb.h
+ - sys/time.h
+ - sys/timerfd.h
+ - sys/times.h
+ - sys/timex.h
+ - sys/ttydefaults.h
+ - sys/types.h
+ - sys/ucontext.h
+ - sys/uio.h
+ - sys/un.h
+ - sys/user.h
+ - sys/utsname.h
+ - sys/vfs.h
- sys/vt.h
- - sys/wait.h
- - sys/xattr.h
- - tar.h
- - termios.h
+ - sys/wait.h
+ - sys/xattr.h
+ - tar.h
+ - termios.h
- threads.h
- - time.h
- - uchar.h
- - ucontext.h
- - ulimit.h
- - unistd.h
- - utime.h
- - utmp.h
- - utmpx.h
- - values.h
- - wait.h
- - wordexp.h
+ - time.h
+ - uchar.h
+ - ucontext.h
+ - ulimit.h
+ - unistd.h
+ - utime.h
+ - utmp.h
+ - utmpx.h
+ - values.h
+ - wait.h
+ - wordexp.h
diff --git a/build/sysincl/linux-musl.yml b/build/sysincl/linux-musl.yml
index 2c7a11bf06..77fc816d46 100644
--- a/build/sysincl/linux-musl.yml
+++ b/build/sysincl/linux-musl.yml
@@ -1,18 +1,18 @@
-- includes:
- - bits/alltypes.h: contrib/libs/musl/arch/x86_64/bits/alltypes.h
- - bits/errno.h: contrib/libs/musl/arch/generic/bits/errno.h
- - bits/fenv.h: contrib/libs/musl/arch/x86_64/bits/fenv.h
- - bits/limits.h:
- - contrib/libs/musl/arch/generic/bits/limits.h
- - contrib/libs/musl/arch/x86_64/bits/limits.h
- - bits/posix.h: contrib/libs/musl/arch/x86_64/bits/posix.h
- - bits/reg.h: contrib/libs/musl/arch/x86_64/bits/reg.h
- - bits/stat.h: contrib/libs/musl/arch/x86_64/bits/stat.h
- - bits/stdint.h: contrib/libs/musl/arch/x86_64/bits/stdint.h
- - sys/cdefs.h: contrib/libs/musl/extra/sys/cdefs.h
- - sys/sysctl.h: contrib/libs/musl/extra/sys/sysctl.h
- - xlocale.h: contrib/libs/musl/extra/xlocale.h
-
+- includes:
+ - bits/alltypes.h: contrib/libs/musl/arch/x86_64/bits/alltypes.h
+ - bits/errno.h: contrib/libs/musl/arch/generic/bits/errno.h
+ - bits/fenv.h: contrib/libs/musl/arch/x86_64/bits/fenv.h
+ - bits/limits.h:
+ - contrib/libs/musl/arch/generic/bits/limits.h
+ - contrib/libs/musl/arch/x86_64/bits/limits.h
+ - bits/posix.h: contrib/libs/musl/arch/x86_64/bits/posix.h
+ - bits/reg.h: contrib/libs/musl/arch/x86_64/bits/reg.h
+ - bits/stat.h: contrib/libs/musl/arch/x86_64/bits/stat.h
+ - bits/stdint.h: contrib/libs/musl/arch/x86_64/bits/stdint.h
+ - sys/cdefs.h: contrib/libs/musl/extra/sys/cdefs.h
+ - sys/sysctl.h: contrib/libs/musl/extra/sys/sysctl.h
+ - xlocale.h: contrib/libs/musl/extra/xlocale.h
+
- source_filter: "^contrib/restricted/boost"
- includes:
+ includes:
- ../include/fenv.h: contrib/libs/musl/include/fenv.h
diff --git a/build/sysincl/linux.yml b/build/sysincl/linux.yml
index a92a09bb9c..94b3de8f7c 100644
--- a/build/sysincl/linux.yml
+++ b/build/sysincl/linux.yml
@@ -1,54 +1,54 @@
-- includes:
- - _G_config.h
- - a.out.h
- - aliases.h
- - ansidecl.h
- - argp.h
- - argz.h
- - bfd.h
+- includes:
+ - _G_config.h
+ - a.out.h
+ - aliases.h
+ - ansidecl.h
+ - argp.h
+ - argz.h
+ - bfd.h
- bits/endian.h
- - bits/fenv.h
- - bits/libc-lock.h
+ - bits/fenv.h
+ - bits/libc-lock.h
- bits/reg.h
- bits/types.h
- bits/wordsize.h
- - error.h
- - execinfo.h
- - fpu_control.h
- - fstab.h
- - fts.h
- - gconv.h
- - gnu-versions.h
- - gnu/libc-version.h
- - gshadow.h
- - ieee754.h
- - libio.h
- - linux/compiler.h
- - linux/irda.h
- - linux/smb.h
- - mcheck.h
- - netash/ash.h
- - netatalk/at.h
- - netax25/ax25.h
- - neteconet/ec.h
- - netipx/ipx.h
- - netrose/rose.h
- - nss.h
- - obstack.h
- - printf.h
- - regexp.h
- - rpcsvc/yp_prot.h
- - rpcsvc/ypclnt.h
- - sgtty.h
- - sys/bitypes.h
- - sys/cdefs.h
+ - error.h
+ - execinfo.h
+ - fpu_control.h
+ - fstab.h
+ - fts.h
+ - gconv.h
+ - gnu-versions.h
+ - gnu/libc-version.h
+ - gshadow.h
+ - ieee754.h
+ - libio.h
+ - linux/compiler.h
+ - linux/irda.h
+ - linux/smb.h
+ - mcheck.h
+ - netash/ash.h
+ - netatalk/at.h
+ - netax25/ax25.h
+ - neteconet/ec.h
+ - netipx/ipx.h
+ - netrose/rose.h
+ - nss.h
+ - obstack.h
+ - printf.h
+ - regexp.h
+ - rpcsvc/yp_prot.h
+ - rpcsvc/ypclnt.h
+ - sgtty.h
+ - sys/bitypes.h
+ - sys/cdefs.h
- sys/memfd.h
- - sys/queue.h
+ - sys/queue.h
- sys/platform/ppc.h
- - sys/socketvar.h
- - sys/sysctl.h
- - sys/unistd.h
- - termio.h
- - ttyent.h
- - ustat.h
- - xlocale.h
+ - sys/socketvar.h
+ - sys/sysctl.h
+ - sys/unistd.h
+ - termio.h
+ - ttyent.h
+ - ustat.h
+ - xlocale.h
diff --git a/build/sysincl/misc-win.yml b/build/sysincl/misc-win.yml
index e53d4be782..4652084ed9 100644
--- a/build/sysincl/misc-win.yml
+++ b/build/sysincl/misc-win.yml
@@ -1,66 +1,66 @@
- source_filter: "^(contrib/libs/(ImageMagick|ffmpeg-3|libraw|pthreads_win32|zookeeper))|^contrib/restricted/boost"
- includes:
- - pthread.h: contrib/libs/pthreads_win32/include/pthread.h
- - sched.h: contrib/libs/pthreads_win32/include/sched.h
-
-- source_filter: "^contrib/libs/jemalloc"
- includes:
- - strings.h: contrib/libs/jemalloc/include/msvc_compat/strings.h
-
-- source_filter: "^contrib/libs/libgit2"
- includes:
- - regex.h: contrib/libs/libgit2/deps/regex/regex.h
-
-- source_filter: "^contrib/libs/libpq/src"
- includes:
- - arpa/inet.h: contrib/libs/libpq/src/include/port/win32/arpa/inet.h
- - sys/file.h: contrib/libs/libpq/src/include/port/win32_msvc/sys/file.h
- - sys/param.h: contrib/libs/libpq/src/include/port/win32_msvc/sys/param.h
- - sys/time.h: contrib/libs/libpq/src/include/port/win32_msvc/sys/time.h
- - unistd.h: contrib/libs/libpq/src/include/port/win32_msvc/unistd.h
- - netdb.h: contrib/libs/libpq/src/include/port/win32/netdb.h
- - netinet/in.h: contrib/libs/libpq/src/include/port/win32/netinet/in.h
- - pwd.h: contrib/libs/libpq/src/include/port/win32/pwd.h
- - sys/socket.h: contrib/libs/libpq/src/include/port/win32/sys/socket.h
-
-- source_filter: "^contrib/libs/libx264"
- includes:
- - inttypes.h: contrib/libs/libx264/extras/inttypes.h
- - stdint.h: contrib/libs/libx264/extras/stdint.h
-
-- source_filter: "^contrib/tools/bison"
- includes:
- - alloca.h: contrib/tools/bison/gnulib/platform/win64/alloca.h
- - getopt.h: contrib/tools/bison/gnulib/platform/win64/getopt.h
- - fcntl.h: contrib/tools/bison/gnulib/platform/win64/fcntl.h
- - langinfo.h: contrib/tools/bison/gnulib/platform/win64/langinfo.h
- - locale.h: contrib/tools/bison/gnulib/platform/win64/locale.h
- - math.h: contrib/tools/bison/gnulib/platform/win64/math.h
- - sched.h: contrib/tools/bison/gnulib/platform/win64/sched.h
- - signal.h: contrib/tools/bison/gnulib/platform/win64/signal.h
- - spawn.h: contrib/tools/bison/gnulib/platform/win64/spawn.h
- - stdbool.h: contrib/tools/bison/gnulib/platform/win64/stdbool.h
- - sys/stat.h: contrib/tools/bison/gnulib/platform/win64/sys/stat.h
- - sys/time.h: contrib/tools/bison/gnulib/platform/win64/sys/time.h
- - sys/wait.h: contrib/tools/bison/gnulib/platform/win64/sys/wait.h
- - unistd.h: contrib/tools/bison/gnulib/platform/win64/unistd.h
-
-- source_filter: "^contrib/tools/watchman"
- includes:
- - getopt.h: contrib/tools/watchman/winbuild/getopt.h
- - spawn.h: contrib/tools/watchman/winbuild/spawn.h
- - sys/time.h: contrib/tools/watchman/winbuild/sys/time.h
-
+ includes:
+ - pthread.h: contrib/libs/pthreads_win32/include/pthread.h
+ - sched.h: contrib/libs/pthreads_win32/include/sched.h
+
+- source_filter: "^contrib/libs/jemalloc"
+ includes:
+ - strings.h: contrib/libs/jemalloc/include/msvc_compat/strings.h
+
+- source_filter: "^contrib/libs/libgit2"
+ includes:
+ - regex.h: contrib/libs/libgit2/deps/regex/regex.h
+
+- source_filter: "^contrib/libs/libpq/src"
+ includes:
+ - arpa/inet.h: contrib/libs/libpq/src/include/port/win32/arpa/inet.h
+ - sys/file.h: contrib/libs/libpq/src/include/port/win32_msvc/sys/file.h
+ - sys/param.h: contrib/libs/libpq/src/include/port/win32_msvc/sys/param.h
+ - sys/time.h: contrib/libs/libpq/src/include/port/win32_msvc/sys/time.h
+ - unistd.h: contrib/libs/libpq/src/include/port/win32_msvc/unistd.h
+ - netdb.h: contrib/libs/libpq/src/include/port/win32/netdb.h
+ - netinet/in.h: contrib/libs/libpq/src/include/port/win32/netinet/in.h
+ - pwd.h: contrib/libs/libpq/src/include/port/win32/pwd.h
+ - sys/socket.h: contrib/libs/libpq/src/include/port/win32/sys/socket.h
+
+- source_filter: "^contrib/libs/libx264"
+ includes:
+ - inttypes.h: contrib/libs/libx264/extras/inttypes.h
+ - stdint.h: contrib/libs/libx264/extras/stdint.h
+
+- source_filter: "^contrib/tools/bison"
+ includes:
+ - alloca.h: contrib/tools/bison/gnulib/platform/win64/alloca.h
+ - getopt.h: contrib/tools/bison/gnulib/platform/win64/getopt.h
+ - fcntl.h: contrib/tools/bison/gnulib/platform/win64/fcntl.h
+ - langinfo.h: contrib/tools/bison/gnulib/platform/win64/langinfo.h
+ - locale.h: contrib/tools/bison/gnulib/platform/win64/locale.h
+ - math.h: contrib/tools/bison/gnulib/platform/win64/math.h
+ - sched.h: contrib/tools/bison/gnulib/platform/win64/sched.h
+ - signal.h: contrib/tools/bison/gnulib/platform/win64/signal.h
+ - spawn.h: contrib/tools/bison/gnulib/platform/win64/spawn.h
+ - stdbool.h: contrib/tools/bison/gnulib/platform/win64/stdbool.h
+ - sys/stat.h: contrib/tools/bison/gnulib/platform/win64/sys/stat.h
+ - sys/time.h: contrib/tools/bison/gnulib/platform/win64/sys/time.h
+ - sys/wait.h: contrib/tools/bison/gnulib/platform/win64/sys/wait.h
+ - unistd.h: contrib/tools/bison/gnulib/platform/win64/unistd.h
+
+- source_filter: "^contrib/tools/watchman"
+ includes:
+ - getopt.h: contrib/tools/watchman/winbuild/getopt.h
+ - spawn.h: contrib/tools/watchman/winbuild/spawn.h
+ - sys/time.h: contrib/tools/watchman/winbuild/sys/time.h
+
- source_filter: "^contrib/libs/libpq"
includes:
- dirent.h: contrib/libs/libpq/src/include/port/win32_msvc/dirent.h
- sys/wait.h: contrib/libs/libpq/src/include/port/win32/sys/wait.h
- win32.h: contrib/libs/libpq/src/include/port/win32.h
-- source_filter: "^contrib/libs/curl"
+- source_filter: "^contrib/libs/curl"
includes:
- nghttp2/nghttp2.h
-
-- includes:
- - sys/queue.h: contrib/libs/libc_compat/include/windows/sys/queue.h
+
+- includes:
+ - sys/queue.h: contrib/libs/libc_compat/include/windows/sys/queue.h
- sys/uio.h: contrib/libs/libc_compat/include/windows/sys/uio.h
diff --git a/build/sysincl/misc.yml b/build/sysincl/misc.yml
index e9e6095888..9ce99384fa 100644
--- a/build/sysincl/misc.yml
+++ b/build/sysincl/misc.yml
@@ -14,18 +14,18 @@
- libelf/libelf.h: contrib/restricted/libelf/include/libelf/libelf.h
- libelf/sys_elf.h: contrib/restricted/libelf/include/libelf/sys_elf.h
-# We have lots of ADDINCLs to contrib/libs/libiconv all around the repo
-# so we need to add it to sysincl for consistent resolving.
-# We can go the other way here and remove iconv.h from all sysincl configs
-# and try to fix all places where we really need iconv.h from libc
-# Btw: seems that this ADDINCL should be made global and removed from projects
-# that use this header
-- includes:
+# We have lots of ADDINCLs to contrib/libs/libiconv all around the repo
+# so we need to add it to sysincl for consistent resolving.
+# We can go the other way here and remove iconv.h from all sysincl configs
+# and try to fix all places where we really need iconv.h from libc
+# Btw: seems that this ADDINCL should be made global and removed from projects
+# that use this header
+- includes:
- iconv.h: contrib/libs/libiconv/include/iconv.h
-- includes:
- - cudnn.h: contrib/libs/nvidia/cudnn/cudnn.h
-
+- includes:
+ - cudnn.h: contrib/libs/nvidia/cudnn/cudnn.h
+
# _cgo_export.h is generated into build dir of go package which uses cgo
# and we are unable to resolve it correctly to whcih build dir to resolve
# in the case when tests are also built for this package
@@ -47,74 +47,74 @@
- contrib/libs/jdk/include/linux/jni_md.h
- contrib/libs/jdk/include/win32/jni_md.h
-# libunistring has its own libc header wrappers that are added to ADDINCL and
-# need to be added here for consistensy between ADDINCL and sysincl resolving.
-# Btw: we don't parse include_next, so we might lose real dependency to musl,
-# but sysincl resolving will save us here, as it will resolve to both of them.
-- source_filter: "^contrib/libs/libunistring"
- includes:
- - alloca.h: contrib/libs/libunistring/alloca.h
- - langinfo.h: contrib/libs/libunistring/langinfo.h
- - limits.h: contrib/libs/libunistring/limits.h
- - math.h: contrib/libs/libunistring/math.h
- - minmax.h: contrib/libs/libunistring/minmax.h
- - stdlib.h: contrib/libs/libunistring/stdlib.h
- - string.h: contrib/libs/libunistring/string.h
- - sys/types.h: contrib/libs/libunistring/sys/types.h
- - unistd.h: contrib/libs/libunistring/unistd.h
- - wchar.h: contrib/libs/libunistring/wchar.h
- - wctype.h: contrib/libs/libunistring/wctype.h
-
+# libunistring has its own libc header wrappers that are added to ADDINCL and
+# need to be added here for consistensy between ADDINCL and sysincl resolving.
+# Btw: we don't parse include_next, so we might lose real dependency to musl,
+# but sysincl resolving will save us here, as it will resolve to both of them.
+- source_filter: "^contrib/libs/libunistring"
+ includes:
+ - alloca.h: contrib/libs/libunistring/alloca.h
+ - langinfo.h: contrib/libs/libunistring/langinfo.h
+ - limits.h: contrib/libs/libunistring/limits.h
+ - math.h: contrib/libs/libunistring/math.h
+ - minmax.h: contrib/libs/libunistring/minmax.h
+ - stdlib.h: contrib/libs/libunistring/stdlib.h
+ - string.h: contrib/libs/libunistring/string.h
+ - sys/types.h: contrib/libs/libunistring/sys/types.h
+ - unistd.h: contrib/libs/libunistring/unistd.h
+ - wchar.h: contrib/libs/libunistring/wchar.h
+ - wctype.h: contrib/libs/libunistring/wctype.h
+
- source_filter: "^contrib/libs/libidn2/"
includes:
- error.h: contrib/libs/libidn2/gl/error.h
- unistd.h: contrib/libs/libunistring/include/unistd.h
-# Same as libunistring - lftp has own libc header wrappers/replacements.
-# However here we have GLOBAL ADDINCL to contrib/libs/lftp{,/trio,/lib}
-# that can poison resolving in PEERDIRing projects.
-# Fortunately lftp is used only in contrib/tools/lftp.
-# Probably we should add PEERDIR restriction rule to it.
-- source_filter: "^contrib/libs/lftp"
- includes:
- - alloca.h: contrib/libs/lftp/alloca.h
- - error.h: contrib/libs/lftp/lib/error.h
- - fnmatch.h: contrib/libs/lftp/lib/fnmatch.h
- - regex.h: contrib/libs/lftp/lib/regex.h
- - sys/socket.h: contrib/libs/lftp/lib/sys/socket.h
- - sys/stat.h: contrib/libs/lftp/lib/sys/stat.h
- - sys/time.h: contrib/libs/lftp/lib/sys/time.h
-
-# Another sysincl/addincl clash. Here we also have GLOBAL ADDINCL that will
-# produce sysincl/addincl mismatch configure errors when someone writes
-# #include <math.h> and enables USE_ARCADIA_LIBM. Now we have no instances of this.
-- source_filter: "^contrib/libs/libm/.*\\.c"
- includes:
- - complex.h: contrib/libs/libm/include/complex.h
- - math.h: contrib/libs/libm/include/math.h
-
-# Some more sysincl/addincl clashes.
-- source_filter: "^contrib/tools/bison/(bison|gnulib|m4)/src"
- includes:
- - error.h: contrib/tools/bison/gnulib/src/error.h
- - fcntl.h: contrib/tools/bison/gnulib/platform/posix/fcntl.h
- - getopt.h: contrib/tools/bison/gnulib/platform/posix/getopt.h
- - obstack.h: contrib/tools/bison/gnulib/src/obstack.h
- - regex.h: contrib/tools/bison/gnulib/src/regex.h
- - system.h
- - unlocked-io.h: contrib/tools/bison/gnulib/src/unlocked-io.h
-- source_filter: "^contrib/tools/make"
- includes:
- - fnmatch.h: contrib/tools/make/glob/fnmatch.h
- - glob.h: contrib/tools/make/glob/glob.h
-- source_filter: "^contrib/tools/tre"
- includes:
- - regex.h: contrib/tools/tre/lib/regex.h
-
+# Same as libunistring - lftp has own libc header wrappers/replacements.
+# However here we have GLOBAL ADDINCL to contrib/libs/lftp{,/trio,/lib}
+# that can poison resolving in PEERDIRing projects.
+# Fortunately lftp is used only in contrib/tools/lftp.
+# Probably we should add PEERDIR restriction rule to it.
+- source_filter: "^contrib/libs/lftp"
+ includes:
+ - alloca.h: contrib/libs/lftp/alloca.h
+ - error.h: contrib/libs/lftp/lib/error.h
+ - fnmatch.h: contrib/libs/lftp/lib/fnmatch.h
+ - regex.h: contrib/libs/lftp/lib/regex.h
+ - sys/socket.h: contrib/libs/lftp/lib/sys/socket.h
+ - sys/stat.h: contrib/libs/lftp/lib/sys/stat.h
+ - sys/time.h: contrib/libs/lftp/lib/sys/time.h
+
+# Another sysincl/addincl clash. Here we also have GLOBAL ADDINCL that will
+# produce sysincl/addincl mismatch configure errors when someone writes
+# #include <math.h> and enables USE_ARCADIA_LIBM. Now we have no instances of this.
+- source_filter: "^contrib/libs/libm/.*\\.c"
+ includes:
+ - complex.h: contrib/libs/libm/include/complex.h
+ - math.h: contrib/libs/libm/include/math.h
+
+# Some more sysincl/addincl clashes.
+- source_filter: "^contrib/tools/bison/(bison|gnulib|m4)/src"
+ includes:
+ - error.h: contrib/tools/bison/gnulib/src/error.h
+ - fcntl.h: contrib/tools/bison/gnulib/platform/posix/fcntl.h
+ - getopt.h: contrib/tools/bison/gnulib/platform/posix/getopt.h
+ - obstack.h: contrib/tools/bison/gnulib/src/obstack.h
+ - regex.h: contrib/tools/bison/gnulib/src/regex.h
+ - system.h
+ - unlocked-io.h: contrib/tools/bison/gnulib/src/unlocked-io.h
+- source_filter: "^contrib/tools/make"
+ includes:
+ - fnmatch.h: contrib/tools/make/glob/fnmatch.h
+ - glob.h: contrib/tools/make/glob/glob.h
+- source_filter: "^contrib/tools/tre"
+ includes:
+ - regex.h: contrib/tools/tre/lib/regex.h
+
- source_filter: "^contrib/libs/cppkafka"
- includes:
+ includes:
- error.h: contrib/libs/cppkafka/include/cppkafka/error.h
-
+
- source_filter: "^contrib/libs/clang11-rt"
includes:
- xray/xray_interface.h: contrib/libs/clang11-rt/include/xray/xray_interface.h
@@ -128,39 +128,39 @@
- plugin-api.h # GNU linker plugin API.
- source_filter: "^contrib/libs/musl"
- includes:
+ includes:
- atomic.h: contrib/libs/musl/src/internal/atomic.h
- bits/fenv.h: contrib/libs/musl/arch/x86_64/bits/fenv.h
-
-- source_filter: "^contrib/libs/zbar"
- includes:
- - error.h: contrib/libs/zbar/zbar/error.h
-
-- source_filter: "^contrib/libs/curl"
- includes:
+
+- source_filter: "^contrib/libs/zbar"
+ includes:
+ - error.h: contrib/libs/zbar/zbar/error.h
+
+- source_filter: "^contrib/libs/curl"
+ includes:
- http.h: contrib/libs/curl/lib/http.h
- inet_ntop.h: contrib/libs/curl/lib/inet_ntop.h
- - share.h: contrib/libs/curl/lib/share.h
-
-- source_filter: "^contrib/libs/zeromq"
- includes:
- - atomic.h: contrib/libs/zeromq/missing_includes/atomic.h
- - Mstcpip.h: contrib/libs/zeromq/missing_includes/Mstcpip.h
-
+ - share.h: contrib/libs/curl/lib/share.h
+
+- source_filter: "^contrib/libs/zeromq"
+ includes:
+ - atomic.h: contrib/libs/zeromq/missing_includes/atomic.h
+ - Mstcpip.h: contrib/libs/zeromq/missing_includes/Mstcpip.h
+
- source_filter: "^contrib/restricted/openal-soft"
includes:
- atomic.h: contrib/restricted/openal-soft/common/atomic.h
-- source_filter: "^contrib/libs/ffmpeg-3"
- includes:
+- source_filter: "^contrib/libs/ffmpeg-3"
+ includes:
- fontconfig/fontconfig.h
- - fribidi.h
- - stdatomic.h: contrib/libs/ffmpeg-3.4.1/compat/atomics/win32/stdatomic.h
-
-- source_filter: "^contrib/libs/glog"
- includes:
- - port.h: contrib/libs/glog/missing_includes/port.h
-
+ - fribidi.h
+ - stdatomic.h: contrib/libs/ffmpeg-3.4.1/compat/atomics/win32/stdatomic.h
+
+- source_filter: "^contrib/libs/glog"
+ includes:
+ - port.h: contrib/libs/glog/missing_includes/port.h
+
- source_filter: "^contrib/(deprecated/onednn|libs/intel/onednn)"
includes:
- mkl_cblas.h: contrib/libs/intel/mkl/include/mkl_cblas.h
@@ -168,54 +168,54 @@
- mkl_vml_defines.h: contrib/libs/intel/mkl/include/mkl_vml_defines.h
- mkl_vml_functions.h: contrib/libs/intel/mkl/include/mkl_vml_functions.h
-- source_filter: "^contrib/libs/nsync"
- includes:
- - atomic.h: contrib/libs/nsync/platform/c++11/atomic.h
-
+- source_filter: "^contrib/libs/nsync"
+ includes:
+ - atomic.h: contrib/libs/nsync/platform/c++11/atomic.h
+
- source_filter: "^contrib/python/numpy/py3"
includes:
- numpy/random.pxd
-- source_filter: "^contrib/tools/python/src/Objects/exceptions.c"
- includes:
- - errmap.h: contrib/tools/python/src/PC/errmap.h
-
-- source_filter: "^contrib/libs/(speex|tf)"
- includes:
- - mkl.h: contrib/libs/intel/mkl/include/mkl.h
-
-# deprecated contrib with ADDINCL to libintl
+- source_filter: "^contrib/tools/python/src/Objects/exceptions.c"
+ includes:
+ - errmap.h: contrib/tools/python/src/PC/errmap.h
+
+- source_filter: "^contrib/libs/(speex|tf)"
+ includes:
+ - mkl.h: contrib/libs/intel/mkl/include/mkl.h
+
+# deprecated contrib with ADDINCL to libintl
- source_filter: "^contrib/(deprecated/glib/glib|libs/gdk-pixbuf)"
- includes:
- - libintl.h: contrib/deprecated/libintl/libintl.h
-
-- source_filter: "^contrib/libs/poco/Data/ODBC"
- includes:
- - sql.h: contrib/libs/unixodbc/include/sql.h
- - sqlext.h: contrib/libs/unixodbc/include/sqlext.h
- - sqltypes.h: contrib/libs/unixodbc/include/sqltypes.h
- - sqlucode.h: contrib/libs/unixodbc/include/sqlucode.h
-
-- source_filter: "^contrib/libs/icu"
- includes:
- - util.h: contrib/libs/icu/common/util.h
-
-- source_filter: "^contrib/tools/yasm"
- includes:
- - util.h: contrib/tools/yasm/util.h
-
-- source_filter: "^contrib/libs/libgit2"
- includes:
- - util.h: contrib/libs/libgit2/src/util.h
-
+ includes:
+ - libintl.h: contrib/deprecated/libintl/libintl.h
+
+- source_filter: "^contrib/libs/poco/Data/ODBC"
+ includes:
+ - sql.h: contrib/libs/unixodbc/include/sql.h
+ - sqlext.h: contrib/libs/unixodbc/include/sqlext.h
+ - sqltypes.h: contrib/libs/unixodbc/include/sqltypes.h
+ - sqlucode.h: contrib/libs/unixodbc/include/sqlucode.h
+
+- source_filter: "^contrib/libs/icu"
+ includes:
+ - util.h: contrib/libs/icu/common/util.h
+
+- source_filter: "^contrib/tools/yasm"
+ includes:
+ - util.h: contrib/tools/yasm/util.h
+
+- source_filter: "^contrib/libs/libgit2"
+ includes:
+ - util.h: contrib/libs/libgit2/src/util.h
+
- source_filter: "^contrib/libs/nodejs_12"
includes:
- util.h: contrib/libs/nodejs_12/src/util.h
-- source_filter: "^contrib/libs/numa"
- includes:
- - util.h: contrib/libs/numa/internal/util.h
-
+- source_filter: "^contrib/libs/numa"
+ includes:
+ - util.h: contrib/libs/numa/internal/util.h
+
- source_filter: "^contrib/libs/systemd"
includes:
- util.h: contrib/libs/systemd/src/basic/util.h
@@ -224,175 +224,175 @@
includes:
- socket.h: contrib/libs/nvidia/nccl/src/include/socket.h
-- source_filter: "^contrib/libs/tf/tensorflow"
- includes:
- - cuda.h: contrib/libs/tf/tensorflow/core/platform/cuda.h
-
-# unused legacy include in boost
+- source_filter: "^contrib/libs/tf/tensorflow"
+ includes:
+ - cuda.h: contrib/libs/tf/tensorflow/core/platform/cuda.h
+
+# unused legacy include in boost
- source_filter: "^contrib/restricted/boost"
- includes:
+ includes:
- atomic.h
- - fstream.h
+ - fstream.h
- ../include/fenv.h
-
+
- source_filter: "^contrib/restricted/boost/boost/stacktrace/detail"
includes:
- backtrace.h: contrib/libs/backtrace/backtrace.h
-# windows sdk includes that we do not want to apply for whole arcadia
-- source_filter: "^contrib"
- includes:
- - process.h
-- source_filter: "^contrib/tools/tpce-benchmark"
- includes:
- - sql.h
- - sqlext.h
- - sqltypes.h
- - sqlucode.h
-
-- source_filter: "^contrib/libs/libmemcached"
- includes:
- - sasl/sasl.h
- - sasl/saslutil.h
-
+# windows sdk includes that we do not want to apply for whole arcadia
+- source_filter: "^contrib"
+ includes:
+ - process.h
+- source_filter: "^contrib/tools/tpce-benchmark"
+ includes:
+ - sql.h
+ - sqlext.h
+ - sqltypes.h
+ - sqlucode.h
+
+- source_filter: "^contrib/libs/libmemcached"
+ includes:
+ - sasl/sasl.h
+ - sasl/saslutil.h
+
- source_filter: "^contrib/libs/apr"
includes:
- atomic.h
-- source_filter: "^contrib/libs/(apr|httpd|llvm)"
- includes:
- - uuid.h
- - uuid/uuid.h
-
-- source_filter: "^contrib/libs/(kenlm|libxml|re2|sqlite3)"
- includes:
- - unicode/ucnv.h
- - unicode/ucol.h
- - unicode/uniset.h
- - unicode/unistr.h
- - unicode/ustring.h
- - unicode/utf16.h
- - unicode/utypes.h
- - unicode/uversion.h
-
-- source_filter: "^contrib/deprecated/glib"
- includes:
- - configmake.h
-
-- source_filter: "^contrib/libs/ImageMagick"
- includes:
- - ltdl.h
-
-- source_filter: "^contrib/libs/authparser"
- includes:
- - settings.h
-
-- source_filter: "^contrib/libs/ceres-solver"
- includes:
- - tbb/tbb_stddef.h
-
-- source_filter: "^contrib/libs/deprecated"
- includes:
- - hdf5.h
-
-- source_filter: "^contrib/libs/freetype"
- includes:
+- source_filter: "^contrib/libs/(apr|httpd|llvm)"
+ includes:
+ - uuid.h
+ - uuid/uuid.h
+
+- source_filter: "^contrib/libs/(kenlm|libxml|re2|sqlite3)"
+ includes:
+ - unicode/ucnv.h
+ - unicode/ucol.h
+ - unicode/uniset.h
+ - unicode/unistr.h
+ - unicode/ustring.h
+ - unicode/utf16.h
+ - unicode/utypes.h
+ - unicode/uversion.h
+
+- source_filter: "^contrib/deprecated/glib"
+ includes:
+ - configmake.h
+
+- source_filter: "^contrib/libs/ImageMagick"
+ includes:
+ - ltdl.h
+
+- source_filter: "^contrib/libs/authparser"
+ includes:
+ - settings.h
+
+- source_filter: "^contrib/libs/ceres-solver"
+ includes:
+ - tbb/tbb_stddef.h
+
+- source_filter: "^contrib/libs/deprecated"
+ includes:
+ - hdf5.h
+
+- source_filter: "^contrib/libs/freetype"
+ includes:
- hb-ot.h
- - hb-ft.h
- - hb.h
-
-- source_filter: "^contrib/libs/httpd"
- includes:
- - nginx.h
- - ngx_config.h
- - ngx_core.h
- - ngx_http.h
- - ngx_log.h
-
-- source_filter: "^contrib/libs/leptonica-1.70"
- includes:
- - gif_lib.h
- - webp/decode.h
- - webp/encode.h
-
-- source_filter: "^contrib/libs/libpcap"
- includes:
- - strerror.h
-
-- source_filter: "^contrib/libs/libxml"
- includes:
- - lzma.h
- - win32config.h
-
-- source_filter: "^contrib/libs/mod_perl2"
- includes:
- - config.h
-
-- source_filter: "^contrib/libs/(apr|httpd|openssl)"
- includes:
- - netinet/sctp.h
-
-- source_filter: "^contrib/libs/subversion"
- includes:
- - magic.h
- - xmlparse.h
-
-- source_filter: "^contrib/python/scipy"
- includes:
- - matrix.h
-
-- source_filter: "^contrib/python/uwsgi"
- includes:
- - libxml/parser.h
- - libxml/tree.h
- - uuid/uuid.h
-
-- source_filter: "^contrib/tools/python"
- includes:
- - ioctl.h
- - utils.h
-
-- source_filter: "^(contrib/libs/cxxsupp/openmp|catboost/cuda/cuda_lib)"
- includes:
- - hwloc.h
- - hwloc/cudart.h
-
+ - hb-ft.h
+ - hb.h
+
+- source_filter: "^contrib/libs/httpd"
+ includes:
+ - nginx.h
+ - ngx_config.h
+ - ngx_core.h
+ - ngx_http.h
+ - ngx_log.h
+
+- source_filter: "^contrib/libs/leptonica-1.70"
+ includes:
+ - gif_lib.h
+ - webp/decode.h
+ - webp/encode.h
+
+- source_filter: "^contrib/libs/libpcap"
+ includes:
+ - strerror.h
+
+- source_filter: "^contrib/libs/libxml"
+ includes:
+ - lzma.h
+ - win32config.h
+
+- source_filter: "^contrib/libs/mod_perl2"
+ includes:
+ - config.h
+
+- source_filter: "^contrib/libs/(apr|httpd|openssl)"
+ includes:
+ - netinet/sctp.h
+
+- source_filter: "^contrib/libs/subversion"
+ includes:
+ - magic.h
+ - xmlparse.h
+
+- source_filter: "^contrib/python/scipy"
+ includes:
+ - matrix.h
+
+- source_filter: "^contrib/python/uwsgi"
+ includes:
+ - libxml/parser.h
+ - libxml/tree.h
+ - uuid/uuid.h
+
+- source_filter: "^contrib/tools/python"
+ includes:
+ - ioctl.h
+ - utils.h
+
+- source_filter: "^(contrib/libs/cxxsupp/openmp|catboost/cuda/cuda_lib)"
+ includes:
+ - hwloc.h
+ - hwloc/cudart.h
+
- source_filter: "^contrib/libs/(deprecated|tf)"
- includes:
- - cblas.h
-
-- source_filter: "^contrib/libs/(aws-sdk-cpp|c-ares|proj)"
- includes:
- - jni.h
-
+ includes:
+ - cblas.h
+
+- source_filter: "^contrib/libs/(aws-sdk-cpp|c-ares|proj)"
+ includes:
+ - jni.h
+
- source_filter: "^contrib/(libs/(ffmpeg-3|kenlm|kyotocabinet)|tools/ag)"
- includes:
- - lzma.h
-
+ includes:
+ - lzma.h
+
- source_filter: "^contrib/libs/(kyotocabinet|minilzo)"
- includes:
- - lzo/lzo1x.h
-
+ includes:
+ - lzo/lzo1x.h
+
- source_filter: "^contrib/libs/(gtest|libpng|opencv)"
- includes:
- - mem.h
-
+ includes:
+ - mem.h
+
- source_filter: "^contrib/libs/(authparser|libcoro-perl|libev-perl|libevent-perl|uatraits)"
- includes:
- - patchlevel.h
-
+ includes:
+ - patchlevel.h
+
- source_filter: "^contrib/tools/watchman"
- includes:
- - pcre.h
-
+ includes:
+ - pcre.h
+
- source_filter: "^contrib/libs/(freetype|leptonica-1.70|libtheora|zbar)"
- includes:
- - png.h
-
+ includes:
+ - png.h
+
- source_filter: "^(contrib/restricted/boost/boost/mpi|catboost/cuda/cuda_lib/mpi)"
- includes:
- - mpi.h
-
+ includes:
+ - mpi.h
+
- source_filter: "^contrib/libs/libf2c"
includes:
- local.h
@@ -404,9 +404,9 @@
- source_filter: "^contrib/libs/breakpad"
includes:
- stab.h
-
-- source_filter: "^contrib/tools/fluent-bit"
- includes:
+
+- source_filter: "^contrib/tools/fluent-bit"
+ includes:
- backtrace.h: contrib/libs/backtrace/backtrace.h
- source_filter: "^contrib/restricted/libelf"
diff --git a/build/sysincl/python.yml b/build/sysincl/python.yml
index 32e8d7ff76..f1e28023be 100644
--- a/build/sysincl/python.yml
+++ b/build/sysincl/python.yml
@@ -1,104 +1,104 @@
- source_filter: "^(?!(contrib/tools/python|library/python/runtime|library/python/symbols))"
- includes:
- - Python-ast.h
- - Python.h
- - abstract.h
- - accu.h
- - asdl.h
- - bltinmodule.h
- - boolobject.h
- - bufferobject.h
- - bytearrayobject.h
- - bytes_methods.h
- - bytesobject.h
- - cStringIO.h
- - cellobject.h
- - ceval.h
- - classobject.h
- - cobject.h
- - codecs.h
- - compile.h
- - complexobject.h
- - config_platform.h
- - datetime.h
- - descrobject.h
- - dictobject.h
- - dtoa.h
- - dynamic_annotations.h
- - enumobject.h
- - errcode.h
- - fileobject.h
- - floatobject.h
- - frameobject.h
- - funcobject.h
- - genobject.h
- - graminit.h
- - grammar.h
- - import.h
- - intobject.h
- - intrcheck.h
- - iterobject.h
- - listobject.h
- - longintrepr.h
- - longobject.h
- - marshal.h
- - memoryobject.h
- - metagrammar.h
- - methodobject.h
- - modsupport.h
- - moduleobject.h
- - namespaceobject.h
- - object.h
- - objimpl.h
- - odictobject.h
- - opcode.h
- - osdefs.h
- - osmodule.h
- - parsetok.h
- - patchlevel.h
- - pgen.h
- - pgenheaders.h
- - py_curses.h
- - pyarena.h
- - pyatomic.h
- - pycapsule.h
- - pyconfig.h
- - pyctype.h
- - pydebug.h
- - pydtrace.h
- - pyerrors.h
- - pyexpat.h
- - pyfpe.h
- - pygetopt.h
- - pyhash.h
- - pylifecycle.h
- - pymacconfig.h
- - pymacro.h
- - pymactoolbox.h
- - pymath.h
- - pymem.h
- - pyport.h
- - pystate.h
- - pystrcmp.h
- - pystrhex.h
- - pystrtod.h
- - pythonrun.h
- - pythread.h
- - pytime.h
- - rangeobject.h
- - setobject.h
- - sliceobject.h
- - stringobject.h
- - structmember.h
- - structseq.h
- - symtable.h
- - sysmodule.h
- - timefuncs.h
- - token.h
- - traceback.h
- - tupleobject.h
- - typeslots.h
- - ucnhash.h
- - unicodeobject.h
- - warnings.h
- - weakrefobject.h
+ includes:
+ - Python-ast.h
+ - Python.h
+ - abstract.h
+ - accu.h
+ - asdl.h
+ - bltinmodule.h
+ - boolobject.h
+ - bufferobject.h
+ - bytearrayobject.h
+ - bytes_methods.h
+ - bytesobject.h
+ - cStringIO.h
+ - cellobject.h
+ - ceval.h
+ - classobject.h
+ - cobject.h
+ - codecs.h
+ - compile.h
+ - complexobject.h
+ - config_platform.h
+ - datetime.h
+ - descrobject.h
+ - dictobject.h
+ - dtoa.h
+ - dynamic_annotations.h
+ - enumobject.h
+ - errcode.h
+ - fileobject.h
+ - floatobject.h
+ - frameobject.h
+ - funcobject.h
+ - genobject.h
+ - graminit.h
+ - grammar.h
+ - import.h
+ - intobject.h
+ - intrcheck.h
+ - iterobject.h
+ - listobject.h
+ - longintrepr.h
+ - longobject.h
+ - marshal.h
+ - memoryobject.h
+ - metagrammar.h
+ - methodobject.h
+ - modsupport.h
+ - moduleobject.h
+ - namespaceobject.h
+ - object.h
+ - objimpl.h
+ - odictobject.h
+ - opcode.h
+ - osdefs.h
+ - osmodule.h
+ - parsetok.h
+ - patchlevel.h
+ - pgen.h
+ - pgenheaders.h
+ - py_curses.h
+ - pyarena.h
+ - pyatomic.h
+ - pycapsule.h
+ - pyconfig.h
+ - pyctype.h
+ - pydebug.h
+ - pydtrace.h
+ - pyerrors.h
+ - pyexpat.h
+ - pyfpe.h
+ - pygetopt.h
+ - pyhash.h
+ - pylifecycle.h
+ - pymacconfig.h
+ - pymacro.h
+ - pymactoolbox.h
+ - pymath.h
+ - pymem.h
+ - pyport.h
+ - pystate.h
+ - pystrcmp.h
+ - pystrhex.h
+ - pystrtod.h
+ - pythonrun.h
+ - pythread.h
+ - pytime.h
+ - rangeobject.h
+ - setobject.h
+ - sliceobject.h
+ - stringobject.h
+ - structmember.h
+ - structseq.h
+ - symtable.h
+ - sysmodule.h
+ - timefuncs.h
+ - token.h
+ - traceback.h
+ - tupleobject.h
+ - typeslots.h
+ - ucnhash.h
+ - unicodeobject.h
+ - warnings.h
+ - weakrefobject.h
diff --git a/build/sysincl/stl-to-libcxx.yml b/build/sysincl/stl-to-libcxx.yml
index 7d9600f345..cc3fb5b138 100644
--- a/build/sysincl/stl-to-libcxx.yml
+++ b/build/sysincl/stl-to-libcxx.yml
@@ -1,141 +1,141 @@
-# libc & stl common headers should be resolved to either
-# * system libc (e.g. nothing in our repo)
-# * system libc++ (e.g. nothing in our repo)
-# * libcxx
-# * musl
-# or some combination of them depending on the build flags.
-
-# We want musl to resolve itself without these sysincls, but its test must have them
-- source_filter: "^(?!(contrib/libs/libunistring|contrib/libs/musl|contrib/tools/yasm)).*|^contrib/libs/musl/tests"
- includes:
- - complex.h: contrib/libs/cxxsupp/libcxx/include/complex.h
- - ctype.h: contrib/libs/cxxsupp/libcxx/include/ctype.h
- - errno.h: contrib/libs/cxxsupp/libcxx/include/errno.h
- - float.h: contrib/libs/cxxsupp/libcxx/include/float.h
- - inttypes.h: contrib/libs/cxxsupp/libcxx/include/inttypes.h
- - limits.h: contrib/libs/cxxsupp/libcxx/include/limits.h
- - locale.h: contrib/libs/cxxsupp/libcxx/include/locale.h
- - math.h: contrib/libs/cxxsupp/libcxx/include/math.h
- - setjmp.h: contrib/libs/cxxsupp/libcxx/include/setjmp.h
- - stdbool.h: contrib/libs/cxxsupp/libcxx/include/stdbool.h
- - stddef.h: contrib/libs/cxxsupp/libcxx/include/stddef.h
- - stdint.h: contrib/libs/cxxsupp/libcxx/include/stdint.h
- - stdio.h: contrib/libs/cxxsupp/libcxx/include/stdio.h
- - stdlib.h: contrib/libs/cxxsupp/libcxx/include/stdlib.h
- - string.h: contrib/libs/cxxsupp/libcxx/include/string.h
- - tgmath.h: contrib/libs/cxxsupp/libcxx/include/tgmath.h
- - wchar.h: contrib/libs/cxxsupp/libcxx/include/wchar.h
- - wctype.h: contrib/libs/cxxsupp/libcxx/include/wctype.h
-
-- includes:
- - atomic.h:
- - contrib/libs/cxxsupp/libcxxrt/atomic.h
- - cxxabi.h:
- - contrib/libs/cxxsupp/libcxx/include/cxxabi.h
- - contrib/libs/cxxsupp/libcxxrt/cxxabi.h
- - omp.h:
- - contrib/libs/cxxsupp/openmp/omp.h
- - unwind.h:
- - contrib/libs/cxxsupp/libcxx/include/unwind.h
- - contrib/libs/cxxsupp/libcxxrt/unwind.h
+# libc & stl common headers should be resolved to either
+# * system libc (e.g. nothing in our repo)
+# * system libc++ (e.g. nothing in our repo)
+# * libcxx
+# * musl
+# or some combination of them depending on the build flags.
+
+# We want musl to resolve itself without these sysincls, but its test must have them
+- source_filter: "^(?!(contrib/libs/libunistring|contrib/libs/musl|contrib/tools/yasm)).*|^contrib/libs/musl/tests"
+ includes:
+ - complex.h: contrib/libs/cxxsupp/libcxx/include/complex.h
+ - ctype.h: contrib/libs/cxxsupp/libcxx/include/ctype.h
+ - errno.h: contrib/libs/cxxsupp/libcxx/include/errno.h
+ - float.h: contrib/libs/cxxsupp/libcxx/include/float.h
+ - inttypes.h: contrib/libs/cxxsupp/libcxx/include/inttypes.h
+ - limits.h: contrib/libs/cxxsupp/libcxx/include/limits.h
+ - locale.h: contrib/libs/cxxsupp/libcxx/include/locale.h
+ - math.h: contrib/libs/cxxsupp/libcxx/include/math.h
+ - setjmp.h: contrib/libs/cxxsupp/libcxx/include/setjmp.h
+ - stdbool.h: contrib/libs/cxxsupp/libcxx/include/stdbool.h
+ - stddef.h: contrib/libs/cxxsupp/libcxx/include/stddef.h
+ - stdint.h: contrib/libs/cxxsupp/libcxx/include/stdint.h
+ - stdio.h: contrib/libs/cxxsupp/libcxx/include/stdio.h
+ - stdlib.h: contrib/libs/cxxsupp/libcxx/include/stdlib.h
+ - string.h: contrib/libs/cxxsupp/libcxx/include/string.h
+ - tgmath.h: contrib/libs/cxxsupp/libcxx/include/tgmath.h
+ - wchar.h: contrib/libs/cxxsupp/libcxx/include/wchar.h
+ - wctype.h: contrib/libs/cxxsupp/libcxx/include/wctype.h
+
+- includes:
+ - atomic.h:
+ - contrib/libs/cxxsupp/libcxxrt/atomic.h
+ - cxxabi.h:
+ - contrib/libs/cxxsupp/libcxx/include/cxxabi.h
+ - contrib/libs/cxxsupp/libcxxrt/cxxabi.h
+ - omp.h:
+ - contrib/libs/cxxsupp/openmp/omp.h
+ - unwind.h:
+ - contrib/libs/cxxsupp/libcxx/include/unwind.h
+ - contrib/libs/cxxsupp/libcxxrt/unwind.h
- contrib/libs/libunwind/include/unwind.h
-
+
- source_filter: "^contrib/libs/cxxsupp/libcxxabi/"
includes:
- cxxabi.h: contrib/libs/cxxsupp/libcxxabi/include/cxxabi.h
-- includes:
+- includes:
- __config: contrib/libs/cxxsupp/libcxx/include/__config
- __undef_macros: contrib/libs/cxxsupp/libcxx/include/__undef_macros
- - algorithm: contrib/libs/cxxsupp/libcxx/include/algorithm
+ - algorithm: contrib/libs/cxxsupp/libcxx/include/algorithm
- any: contrib/libs/cxxsupp/libcxx/include/any
- - array: contrib/libs/cxxsupp/libcxx/include/array
- - atomic: contrib/libs/cxxsupp/libcxx/include/atomic
+ - array: contrib/libs/cxxsupp/libcxx/include/array
+ - atomic: contrib/libs/cxxsupp/libcxx/include/atomic
- bit: contrib/libs/cxxsupp/libcxx/include/bit
- - bitset: contrib/libs/cxxsupp/libcxx/include/bitset
- - cassert: contrib/libs/cxxsupp/libcxx/include/cassert
- - ccomplex: contrib/libs/cxxsupp/libcxx/include/ccomplex
- - cctype: contrib/libs/cxxsupp/libcxx/include/cctype
- - cerrno: contrib/libs/cxxsupp/libcxx/include/cerrno
- - cfenv: contrib/libs/cxxsupp/libcxx/include/cfenv
- - cfloat: contrib/libs/cxxsupp/libcxx/include/cfloat
+ - bitset: contrib/libs/cxxsupp/libcxx/include/bitset
+ - cassert: contrib/libs/cxxsupp/libcxx/include/cassert
+ - ccomplex: contrib/libs/cxxsupp/libcxx/include/ccomplex
+ - cctype: contrib/libs/cxxsupp/libcxx/include/cctype
+ - cerrno: contrib/libs/cxxsupp/libcxx/include/cerrno
+ - cfenv: contrib/libs/cxxsupp/libcxx/include/cfenv
+ - cfloat: contrib/libs/cxxsupp/libcxx/include/cfloat
- charconv: contrib/libs/cxxsupp/libcxx/include/charconv
- - chrono: contrib/libs/cxxsupp/libcxx/include/chrono
- - cinttypes: contrib/libs/cxxsupp/libcxx/include/cinttypes
- - ciso646: contrib/libs/cxxsupp/libcxx/include/ciso646
- - climits: contrib/libs/cxxsupp/libcxx/include/climits
- - clocale: contrib/libs/cxxsupp/libcxx/include/clocale
- - cmath: contrib/libs/cxxsupp/libcxx/include/cmath
- - codecvt: contrib/libs/cxxsupp/libcxx/include/codecvt
+ - chrono: contrib/libs/cxxsupp/libcxx/include/chrono
+ - cinttypes: contrib/libs/cxxsupp/libcxx/include/cinttypes
+ - ciso646: contrib/libs/cxxsupp/libcxx/include/ciso646
+ - climits: contrib/libs/cxxsupp/libcxx/include/climits
+ - clocale: contrib/libs/cxxsupp/libcxx/include/clocale
+ - cmath: contrib/libs/cxxsupp/libcxx/include/cmath
+ - codecvt: contrib/libs/cxxsupp/libcxx/include/codecvt
- compare: contrib/libs/cxxsupp/libcxx/include/compare
- - complex: contrib/libs/cxxsupp/libcxx/include/complex
+ - complex: contrib/libs/cxxsupp/libcxx/include/complex
- concepts: contrib/libs/cxxsupp/libcxx/include/concepts
- - condition_variable: contrib/libs/cxxsupp/libcxx/include/condition_variable
- - csetjmp: contrib/libs/cxxsupp/libcxx/include/csetjmp
- - csignal: contrib/libs/cxxsupp/libcxx/include/csignal
- - cstdarg: contrib/libs/cxxsupp/libcxx/include/cstdarg
- - cstdbool: contrib/libs/cxxsupp/libcxx/include/cstdbool
- - cstddef: contrib/libs/cxxsupp/libcxx/include/cstddef
- - cstdint: contrib/libs/cxxsupp/libcxx/include/cstdint
- - cstdio: contrib/libs/cxxsupp/libcxx/include/cstdio
- - cstdlib: contrib/libs/cxxsupp/libcxx/include/cstdlib
- - cstring: contrib/libs/cxxsupp/libcxx/include/cstring
- - ctgmath: contrib/libs/cxxsupp/libcxx/include/ctgmath
- - ctime: contrib/libs/cxxsupp/libcxx/include/ctime
- - cwchar: contrib/libs/cxxsupp/libcxx/include/cwchar
- - cwctype: contrib/libs/cxxsupp/libcxx/include/cwctype
- - deque: contrib/libs/cxxsupp/libcxx/include/deque
- - exception: contrib/libs/cxxsupp/libcxx/include/exception
- - filesystem: contrib/libs/cxxsupp/libcxx/include/filesystem
- - forward_list: contrib/libs/cxxsupp/libcxx/include/forward_list
- - fstream: contrib/libs/cxxsupp/libcxx/include/fstream
- - functional: contrib/libs/cxxsupp/libcxx/include/functional
- - future: contrib/libs/cxxsupp/libcxx/include/future
- - initializer_list: contrib/libs/cxxsupp/libcxx/include/initializer_list
- - iomanip: contrib/libs/cxxsupp/libcxx/include/iomanip
- - ios: contrib/libs/cxxsupp/libcxx/include/ios
- - iosfwd: contrib/libs/cxxsupp/libcxx/include/iosfwd
- - iostream: contrib/libs/cxxsupp/libcxx/include/iostream
- - istream: contrib/libs/cxxsupp/libcxx/include/istream
- - iterator: contrib/libs/cxxsupp/libcxx/include/iterator
- - limits: contrib/libs/cxxsupp/libcxx/include/limits
- - list: contrib/libs/cxxsupp/libcxx/include/list
- - locale: contrib/libs/cxxsupp/libcxx/include/locale
- - map: contrib/libs/cxxsupp/libcxx/include/map
- - memory: contrib/libs/cxxsupp/libcxx/include/memory
- - mutex: contrib/libs/cxxsupp/libcxx/include/mutex
- - new: contrib/libs/cxxsupp/libcxx/include/new
- - numeric: contrib/libs/cxxsupp/libcxx/include/numeric
+ - condition_variable: contrib/libs/cxxsupp/libcxx/include/condition_variable
+ - csetjmp: contrib/libs/cxxsupp/libcxx/include/csetjmp
+ - csignal: contrib/libs/cxxsupp/libcxx/include/csignal
+ - cstdarg: contrib/libs/cxxsupp/libcxx/include/cstdarg
+ - cstdbool: contrib/libs/cxxsupp/libcxx/include/cstdbool
+ - cstddef: contrib/libs/cxxsupp/libcxx/include/cstddef
+ - cstdint: contrib/libs/cxxsupp/libcxx/include/cstdint
+ - cstdio: contrib/libs/cxxsupp/libcxx/include/cstdio
+ - cstdlib: contrib/libs/cxxsupp/libcxx/include/cstdlib
+ - cstring: contrib/libs/cxxsupp/libcxx/include/cstring
+ - ctgmath: contrib/libs/cxxsupp/libcxx/include/ctgmath
+ - ctime: contrib/libs/cxxsupp/libcxx/include/ctime
+ - cwchar: contrib/libs/cxxsupp/libcxx/include/cwchar
+ - cwctype: contrib/libs/cxxsupp/libcxx/include/cwctype
+ - deque: contrib/libs/cxxsupp/libcxx/include/deque
+ - exception: contrib/libs/cxxsupp/libcxx/include/exception
+ - filesystem: contrib/libs/cxxsupp/libcxx/include/filesystem
+ - forward_list: contrib/libs/cxxsupp/libcxx/include/forward_list
+ - fstream: contrib/libs/cxxsupp/libcxx/include/fstream
+ - functional: contrib/libs/cxxsupp/libcxx/include/functional
+ - future: contrib/libs/cxxsupp/libcxx/include/future
+ - initializer_list: contrib/libs/cxxsupp/libcxx/include/initializer_list
+ - iomanip: contrib/libs/cxxsupp/libcxx/include/iomanip
+ - ios: contrib/libs/cxxsupp/libcxx/include/ios
+ - iosfwd: contrib/libs/cxxsupp/libcxx/include/iosfwd
+ - iostream: contrib/libs/cxxsupp/libcxx/include/iostream
+ - istream: contrib/libs/cxxsupp/libcxx/include/istream
+ - iterator: contrib/libs/cxxsupp/libcxx/include/iterator
+ - limits: contrib/libs/cxxsupp/libcxx/include/limits
+ - list: contrib/libs/cxxsupp/libcxx/include/list
+ - locale: contrib/libs/cxxsupp/libcxx/include/locale
+ - map: contrib/libs/cxxsupp/libcxx/include/map
+ - memory: contrib/libs/cxxsupp/libcxx/include/memory
+ - mutex: contrib/libs/cxxsupp/libcxx/include/mutex
+ - new: contrib/libs/cxxsupp/libcxx/include/new
+ - numeric: contrib/libs/cxxsupp/libcxx/include/numeric
- optional: contrib/libs/cxxsupp/libcxx/include/optional
- - ostream: contrib/libs/cxxsupp/libcxx/include/ostream
- - queue: contrib/libs/cxxsupp/libcxx/include/queue
- - random: contrib/libs/cxxsupp/libcxx/include/random
- - ratio: contrib/libs/cxxsupp/libcxx/include/ratio
- - regex: contrib/libs/cxxsupp/libcxx/include/regex
- - scoped_allocator: contrib/libs/cxxsupp/libcxx/include/scoped_allocator
- - set: contrib/libs/cxxsupp/libcxx/include/set
+ - ostream: contrib/libs/cxxsupp/libcxx/include/ostream
+ - queue: contrib/libs/cxxsupp/libcxx/include/queue
+ - random: contrib/libs/cxxsupp/libcxx/include/random
+ - ratio: contrib/libs/cxxsupp/libcxx/include/ratio
+ - regex: contrib/libs/cxxsupp/libcxx/include/regex
+ - scoped_allocator: contrib/libs/cxxsupp/libcxx/include/scoped_allocator
+ - set: contrib/libs/cxxsupp/libcxx/include/set
- shared_mutex: contrib/libs/cxxsupp/libcxx/include/shared_mutex
- span: contrib/libs/cxxsupp/libcxx/include/span
- - sstream: contrib/libs/cxxsupp/libcxx/include/sstream
- - stack: contrib/libs/cxxsupp/libcxx/include/stack
- - stdexcept: contrib/libs/cxxsupp/libcxx/include/stdexcept
- - streambuf: contrib/libs/cxxsupp/libcxx/include/streambuf
- - string: contrib/libs/cxxsupp/libcxx/include/string
- - string_view: contrib/libs/cxxsupp/libcxx/include/string_view
- - strstream: contrib/libs/cxxsupp/libcxx/include/strstream
- - system_error: contrib/libs/cxxsupp/libcxx/include/system_error
- - thread: contrib/libs/cxxsupp/libcxx/include/thread
- - tuple: contrib/libs/cxxsupp/libcxx/include/tuple
- - typeindex: contrib/libs/cxxsupp/libcxx/include/typeindex
- - typeinfo: contrib/libs/cxxsupp/libcxx/include/typeinfo
- - type_traits: contrib/libs/cxxsupp/libcxx/include/type_traits
- - unordered_map: contrib/libs/cxxsupp/libcxx/include/unordered_map
- - unordered_set: contrib/libs/cxxsupp/libcxx/include/unordered_set
- - use_ansi.h: contrib/libs/cxxsupp/libcxx/include/use_ansi.h
- - utility: contrib/libs/cxxsupp/libcxx/include/utility
- - valarray: contrib/libs/cxxsupp/libcxx/include/valarray
+ - sstream: contrib/libs/cxxsupp/libcxx/include/sstream
+ - stack: contrib/libs/cxxsupp/libcxx/include/stack
+ - stdexcept: contrib/libs/cxxsupp/libcxx/include/stdexcept
+ - streambuf: contrib/libs/cxxsupp/libcxx/include/streambuf
+ - string: contrib/libs/cxxsupp/libcxx/include/string
+ - string_view: contrib/libs/cxxsupp/libcxx/include/string_view
+ - strstream: contrib/libs/cxxsupp/libcxx/include/strstream
+ - system_error: contrib/libs/cxxsupp/libcxx/include/system_error
+ - thread: contrib/libs/cxxsupp/libcxx/include/thread
+ - tuple: contrib/libs/cxxsupp/libcxx/include/tuple
+ - typeindex: contrib/libs/cxxsupp/libcxx/include/typeindex
+ - typeinfo: contrib/libs/cxxsupp/libcxx/include/typeinfo
+ - type_traits: contrib/libs/cxxsupp/libcxx/include/type_traits
+ - unordered_map: contrib/libs/cxxsupp/libcxx/include/unordered_map
+ - unordered_set: contrib/libs/cxxsupp/libcxx/include/unordered_set
+ - use_ansi.h: contrib/libs/cxxsupp/libcxx/include/use_ansi.h
+ - utility: contrib/libs/cxxsupp/libcxx/include/utility
+ - valarray: contrib/libs/cxxsupp/libcxx/include/valarray
- variant: contrib/libs/cxxsupp/libcxx/include/variant
- - vector: contrib/libs/cxxsupp/libcxx/include/vector
+ - vector: contrib/libs/cxxsupp/libcxx/include/vector
# Though these are headers provided by libcxx, we do not want to allow them to be included.
diff --git a/build/sysincl/stl-to-nothing.yml b/build/sysincl/stl-to-nothing.yml
index c7e27d1411..0cdf2be924 100644
--- a/build/sysincl/stl-to-nothing.yml
+++ b/build/sysincl/stl-to-nothing.yml
@@ -1,125 +1,125 @@
-# libc & stl common headers should be resolved to either
-# * system libc (e.g. nothing in our repo)
-# * system libc++ (e.g. nothing in our repo)
-# * libcxx
-# * musl
-# or some combination of them depending on the build flags.
-
-# We want musl to resolve itself without these sysincls, but its test must have them
+# libc & stl common headers should be resolved to either
+# * system libc (e.g. nothing in our repo)
+# * system libc++ (e.g. nothing in our repo)
+# * libcxx
+# * musl
+# or some combination of them depending on the build flags.
+
+# We want musl to resolve itself without these sysincls, but its test must have them
- source_filter: "^(?!contrib/libs/musl).*|^contrib/libs/musl/tests"
- includes:
- - complex.h
- - ctype.h
- - errno.h
- - float.h
- - inttypes.h
- - limits.h
- - locale.h
- - math.h
- - setjmp.h
- - stdbool.h
- - stddef.h
- - stdint.h
- - stdio.h
- - stdlib.h
- - string.h
- - tgmath.h
- - wchar.h
- - wctype.h
-
-- includes:
+ includes:
+ - complex.h
+ - ctype.h
+ - errno.h
+ - float.h
+ - inttypes.h
+ - limits.h
+ - locale.h
+ - math.h
+ - setjmp.h
+ - stdbool.h
+ - stddef.h
+ - stdint.h
+ - stdio.h
+ - stdlib.h
+ - string.h
+ - tgmath.h
+ - wchar.h
+ - wctype.h
+
+- includes:
- __config
- __undef_macros
- - algorithm
+ - algorithm
- any
- - array
- - atomic
+ - array
+ - atomic
- bit
- - bitset
- - cassert
- - ccomplex
- - cctype
- - cerrno
- - cfenv
- - cfloat
+ - bitset
+ - cassert
+ - ccomplex
+ - cctype
+ - cerrno
+ - cfenv
+ - cfloat
- charconv
- - chrono
- - cinttypes
- - ciso646
- - climits
- - clocale
- - cmath
- - codecvt
+ - chrono
+ - cinttypes
+ - ciso646
+ - climits
+ - clocale
+ - cmath
+ - codecvt
- compare
- - complex
+ - complex
- concepts
- - condition_variable
- - csetjmp
- - csignal
- - cstdarg
- - cstdbool
- - cstddef
- - cstdint
- - cstdio
- - cstdlib
- - cstring
- - ctgmath
- - ctime
- - cwchar
- - cwctype
- - cxxabi.h
- - deque
- - exception
- - filesystem
- - forward_list
- - fstream
- - functional
- - future
- - initializer_list
- - iomanip
- - ios
- - iosfwd
- - iostream
- - istream
- - iterator
- - limits
- - list
- - locale
- - map
- - memory
- - mutex
- - new
- - numeric
+ - condition_variable
+ - csetjmp
+ - csignal
+ - cstdarg
+ - cstdbool
+ - cstddef
+ - cstdint
+ - cstdio
+ - cstdlib
+ - cstring
+ - ctgmath
+ - ctime
+ - cwchar
+ - cwctype
+ - cxxabi.h
+ - deque
+ - exception
+ - filesystem
+ - forward_list
+ - fstream
+ - functional
+ - future
+ - initializer_list
+ - iomanip
+ - ios
+ - iosfwd
+ - iostream
+ - istream
+ - iterator
+ - limits
+ - list
+ - locale
+ - map
+ - memory
+ - mutex
+ - new
+ - numeric
- optional
- - ostream
- - queue
- - random
- - ratio
- - regex
- - scoped_allocator
- - set
+ - ostream
+ - queue
+ - random
+ - ratio
+ - regex
+ - scoped_allocator
+ - set
- shared_mutex
- span
- - sstream
- - stack
- - stdexcept
- - streambuf
- - string
- - string_view
- - strstream
- - system_error
- - thread
- - tuple
- - typeindex
- - typeinfo
- - type_traits
- - unordered_map
- - unordered_set
- - use_ansi.h
- - utility
- - valarray
+ - sstream
+ - stack
+ - stdexcept
+ - streambuf
+ - string
+ - string_view
+ - strstream
+ - system_error
+ - thread
+ - tuple
+ - typeindex
+ - typeinfo
+ - type_traits
+ - unordered_map
+ - unordered_set
+ - use_ansi.h
+ - utility
+ - valarray
- variant
- - vector
+ - vector
- unwind.h:
- contrib/libs/libunwind/include/unwind.h
diff --git a/build/sysincl/unsorted.yml b/build/sysincl/unsorted.yml
index a889b923a0..dd57e63a3f 100644
--- a/build/sysincl/unsorted.yml
+++ b/build/sysincl/unsorted.yml
@@ -1,294 +1,294 @@
- source_filter: "^contrib(?!/restricted/gstreamer/gst/parse)"
- includes:
- - port.h
- - types.h
- - stat.h
-
-- source_filter: ".*contrib.*"
- includes:
- - stat.h
- - libutf8.h
- #if defined(_OS_QNX) && CONTRIB
- - devctl.h
- #endif
- - CrashReporterClient.h
- - Eigen/Array
- - Errors.h
- - ICSupport.h
- - LPdir.h
- - LzFindMt.h
- - MD5.h
- - SIOUX.h
- - TFileSpec.h
- - TLS.h
- - XMP.incl_cpp
- - XMPSDK.hpp
- - _mingw.h
- - abi_mutex.h
- - afxcmn.h
- - afxdao.h
- - afxdb.h
- - afxdisp.h
- - afxext.h
- - afxodlgs.h
- - afxole.h
- - afxwin.h
- - alpha/builtins.h
- - apr_iconv.h
- - atheos/atomic.h
- - atheos/semaphore.h
- - atheos/threads.h
- - atomic_ops.h
- - auth-client-parser/parser.h
- - bluetooth/bluetooth.h
- - bluetooth/hci.h
- - bluetooth/l2cap.h
- - bluetooth/rfcomm.h
- - bluetooth/sco.h
- - bstring.h
- - builtins.h
- - c_asm.h
- - config-mac.h
- - console.h
- - could_not_find_Perl_patchlevel.h
- - cpml.h
- - crtl.h
- - cthreads.h
- - ctime.h
- - db_provider.h
- - dbmalloc.h
- - dir.h
- - dither.h
- - dl.h
- - doc/doc_dynamic.h
- - doc/doc_nan.h
- - doc/doc_printf.h
- - doc/doc_register.h
- - doc/doc_scanf.h
- - doc/doc_static.h
- - dvidef.h
- - fastmath.h
- - fcntl--.h
- - fftw3.h
- - file.h
- - flags.h
- - floatingpoint.h
- - fp.h
- - fp_class.h
- - fsio.h
- - fwriteerror.h
- - gdbm.h
- - ghostscript/iapi.h
- - ghostscript/ierrors.h
- - glibtop.h
- - glibtop/close.h
- - glibtop/open.h
- - glibtop/parameter.h
- - glibtop/sysdeps.h
- - glibtop/union.h
- - glibtop/xmalloc.h
- - gmp.h
- - gnutls/x509.h
- - hp-timing.h
- - httpd_wrap.h
- - i86.h
- - ieeedef.h
- - in.h
- - inet.h
- - intl.h
- - iperlsys.h
- - ipl.h
- - ipl/ipl.h
- - ipp.h
- - ippcp.h
- - kfuncs.h
- - l12_integer_tables.h
- - l3_integer_tables.h
- - lcms.h
- - libavcodec/aacps_tables.h
- - libavcodec/cbrt_tables.h
- - libavcodec/dv_tables.h
- - libavcodec/motionpixels_tables.h
- - libavcodec/mpegaudio_tables.h
- - libavcodec/pcm_tables.h
- - libavcodec/qdm2_tables.h
- - libavcodec/sinewin_tables.h
- - libio/iolibio.h
- - libio/libioP.h
- - libs/regex/test/config_info/regex_config_info.cpp
- - locale/coll-lookup.h
- - locale/elem-hash.h
- - locale/localeinfo.h
- - locale/weight.h
- - locale/weightwc.h
- - lqr.h
- - lwp/lwp.h
- - lwp/stackdep.h
- - m68881.h
- - mach/cthreads.h
- - mathimf.h
- - matrixos.h
- - mfx/mfxvideo.h
- - mingw.h
- - mips64/sysarch.h
- - ms/uplink.h
- - msl_utility
- - namdef.h
- - ncurses/curses.h
- - ncurses/term.h
- - ndir.h
- - net/netdb.h
- - net/socket.h
- - net/uio.h
- - nks/dirio.h
- - nks/plat.h
- - nks/thread.h
- - nonblocking.h
- - note.h
- - opcdef.h
- - openssl/applink.c
- - os2def.h
- - oslib/osfscontrol.h
- - paper.h
- - pcre_printint.src
- - pire/config.h
- - pngusr.h
- - probes_mysql_dtrace.h
- - pth.h
- - relocatable.h
- - rtl.h
- - semLib.h
- - shlib-compat.h
- - sigsegv.h
- - sockLib.h
- - socket.h
- - socketshr.h
- - socklib.h
- - socks.h
- - strdef.h
- - streams/un.h
- - stropts
- - swill.h
- - sysLib.h
- - taskLib.h
- - tcp.h
- - tdep-ia64/dwarf-config.h
- - thread.h
- - thread_plan9.h
- - tickLib.h
- - ttdef.h
- - type_traits.h
- - udplite.h
- - ulocks.h
- - unchecked.h
- - unixlib.h
- - unixstuff.h
- - validator/validator.h
- - vasnwprintf.h
- - vld.h
- - win32lib.h
- - wincecompat.h
- - wprintf-parse.h
- - wsockcompat.h
- - xdelta3-python.h
- - xml/xmlparse.h
- - xmlparse/xmlparse.h
- - xmltok/xmlparse.h
- - yca/yca.h
- - zzip-1.h
- - zzip-2.h
- - zzip-3.h
- - zzip-4.h
- - zzip-5.h
- #if CONTRIB && defined(_HAVE_LIBIDSA)
- - idsa.h
- #endif
- - ../lib/memdebug.h
- - ../../VC/include/math.h
- - ../../VC/include/cfloat
- - ../extra/yassl/taocrypt/include/sha.hpp
- - prof.h
- - ll_alloc_hook.c
- - cpptl/config.h
- - cpptl/conststring.h
- - cpptl/forwards.h
- - cpptl/smallmap.h
- - forwards.h
- - json_valueiterator.inl
- - value.h
- - pthread/mit/sys/timers.h
- - sljit/sljitLir.c
- - pcre_printint.c
- #ifdef defined(emacs) && CONTRIB && TRASH
- - blockinput.h
- #endif
- #if defined(__atmos__) && CONTRIB
- - kernel.h
- #endif
- #if defined(_LIBC) && CONTRIB && TRASH
- - not-cancel.h
- - local-setxid.h
- - vasprintf.h
- #endif
-
-- case_sensitive: false
- includes:
- #if defined(WINDOWS) && CONTRIB && TRASH
- - ../include/locale.h
- - ../include/signal.h
- - ../include/sys/stat.h
- - ../include/fcntl.h
- - ../include/math.h
- - vcruntime_exception.h
- - vcruntime_new.h
- - vcruntime_typeinfo.h
- #endif
- - PowrProf.h
- - BaseTsd.h
- - iphlpapi.h
-
+ includes:
+ - port.h
+ - types.h
+ - stat.h
+
+- source_filter: ".*contrib.*"
+ includes:
+ - stat.h
+ - libutf8.h
+ #if defined(_OS_QNX) && CONTRIB
+ - devctl.h
+ #endif
+ - CrashReporterClient.h
+ - Eigen/Array
+ - Errors.h
+ - ICSupport.h
+ - LPdir.h
+ - LzFindMt.h
+ - MD5.h
+ - SIOUX.h
+ - TFileSpec.h
+ - TLS.h
+ - XMP.incl_cpp
+ - XMPSDK.hpp
+ - _mingw.h
+ - abi_mutex.h
+ - afxcmn.h
+ - afxdao.h
+ - afxdb.h
+ - afxdisp.h
+ - afxext.h
+ - afxodlgs.h
+ - afxole.h
+ - afxwin.h
+ - alpha/builtins.h
+ - apr_iconv.h
+ - atheos/atomic.h
+ - atheos/semaphore.h
+ - atheos/threads.h
+ - atomic_ops.h
+ - auth-client-parser/parser.h
+ - bluetooth/bluetooth.h
+ - bluetooth/hci.h
+ - bluetooth/l2cap.h
+ - bluetooth/rfcomm.h
+ - bluetooth/sco.h
+ - bstring.h
+ - builtins.h
+ - c_asm.h
+ - config-mac.h
+ - console.h
+ - could_not_find_Perl_patchlevel.h
+ - cpml.h
+ - crtl.h
+ - cthreads.h
+ - ctime.h
+ - db_provider.h
+ - dbmalloc.h
+ - dir.h
+ - dither.h
+ - dl.h
+ - doc/doc_dynamic.h
+ - doc/doc_nan.h
+ - doc/doc_printf.h
+ - doc/doc_register.h
+ - doc/doc_scanf.h
+ - doc/doc_static.h
+ - dvidef.h
+ - fastmath.h
+ - fcntl--.h
+ - fftw3.h
+ - file.h
+ - flags.h
+ - floatingpoint.h
+ - fp.h
+ - fp_class.h
+ - fsio.h
+ - fwriteerror.h
+ - gdbm.h
+ - ghostscript/iapi.h
+ - ghostscript/ierrors.h
+ - glibtop.h
+ - glibtop/close.h
+ - glibtop/open.h
+ - glibtop/parameter.h
+ - glibtop/sysdeps.h
+ - glibtop/union.h
+ - glibtop/xmalloc.h
+ - gmp.h
+ - gnutls/x509.h
+ - hp-timing.h
+ - httpd_wrap.h
+ - i86.h
+ - ieeedef.h
+ - in.h
+ - inet.h
+ - intl.h
+ - iperlsys.h
+ - ipl.h
+ - ipl/ipl.h
+ - ipp.h
+ - ippcp.h
+ - kfuncs.h
+ - l12_integer_tables.h
+ - l3_integer_tables.h
+ - lcms.h
+ - libavcodec/aacps_tables.h
+ - libavcodec/cbrt_tables.h
+ - libavcodec/dv_tables.h
+ - libavcodec/motionpixels_tables.h
+ - libavcodec/mpegaudio_tables.h
+ - libavcodec/pcm_tables.h
+ - libavcodec/qdm2_tables.h
+ - libavcodec/sinewin_tables.h
+ - libio/iolibio.h
+ - libio/libioP.h
+ - libs/regex/test/config_info/regex_config_info.cpp
+ - locale/coll-lookup.h
+ - locale/elem-hash.h
+ - locale/localeinfo.h
+ - locale/weight.h
+ - locale/weightwc.h
+ - lqr.h
+ - lwp/lwp.h
+ - lwp/stackdep.h
+ - m68881.h
+ - mach/cthreads.h
+ - mathimf.h
+ - matrixos.h
+ - mfx/mfxvideo.h
+ - mingw.h
+ - mips64/sysarch.h
+ - ms/uplink.h
+ - msl_utility
+ - namdef.h
+ - ncurses/curses.h
+ - ncurses/term.h
+ - ndir.h
+ - net/netdb.h
+ - net/socket.h
+ - net/uio.h
+ - nks/dirio.h
+ - nks/plat.h
+ - nks/thread.h
+ - nonblocking.h
+ - note.h
+ - opcdef.h
+ - openssl/applink.c
+ - os2def.h
+ - oslib/osfscontrol.h
+ - paper.h
+ - pcre_printint.src
+ - pire/config.h
+ - pngusr.h
+ - probes_mysql_dtrace.h
+ - pth.h
+ - relocatable.h
+ - rtl.h
+ - semLib.h
+ - shlib-compat.h
+ - sigsegv.h
+ - sockLib.h
+ - socket.h
+ - socketshr.h
+ - socklib.h
+ - socks.h
+ - strdef.h
+ - streams/un.h
+ - stropts
+ - swill.h
+ - sysLib.h
+ - taskLib.h
+ - tcp.h
+ - tdep-ia64/dwarf-config.h
+ - thread.h
+ - thread_plan9.h
+ - tickLib.h
+ - ttdef.h
+ - type_traits.h
+ - udplite.h
+ - ulocks.h
+ - unchecked.h
+ - unixlib.h
+ - unixstuff.h
+ - validator/validator.h
+ - vasnwprintf.h
+ - vld.h
+ - win32lib.h
+ - wincecompat.h
+ - wprintf-parse.h
+ - wsockcompat.h
+ - xdelta3-python.h
+ - xml/xmlparse.h
+ - xmlparse/xmlparse.h
+ - xmltok/xmlparse.h
+ - yca/yca.h
+ - zzip-1.h
+ - zzip-2.h
+ - zzip-3.h
+ - zzip-4.h
+ - zzip-5.h
+ #if CONTRIB && defined(_HAVE_LIBIDSA)
+ - idsa.h
+ #endif
+ - ../lib/memdebug.h
+ - ../../VC/include/math.h
+ - ../../VC/include/cfloat
+ - ../extra/yassl/taocrypt/include/sha.hpp
+ - prof.h
+ - ll_alloc_hook.c
+ - cpptl/config.h
+ - cpptl/conststring.h
+ - cpptl/forwards.h
+ - cpptl/smallmap.h
+ - forwards.h
+ - json_valueiterator.inl
+ - value.h
+ - pthread/mit/sys/timers.h
+ - sljit/sljitLir.c
+ - pcre_printint.c
+ #ifdef defined(emacs) && CONTRIB && TRASH
+ - blockinput.h
+ #endif
+ #if defined(__atmos__) && CONTRIB
+ - kernel.h
+ #endif
+ #if defined(_LIBC) && CONTRIB && TRASH
+ - not-cancel.h
+ - local-setxid.h
+ - vasprintf.h
+ #endif
+
+- case_sensitive: false
+ includes:
+ #if defined(WINDOWS) && CONTRIB && TRASH
+ - ../include/locale.h
+ - ../include/signal.h
+ - ../include/sys/stat.h
+ - ../include/fcntl.h
+ - ../include/math.h
+ - vcruntime_exception.h
+ - vcruntime_new.h
+ - vcruntime_typeinfo.h
+ #endif
+ - PowrProf.h
+ - BaseTsd.h
+ - iphlpapi.h
+
- source_filter: "^(?!contrib/python/line_profiler/)"
includes:
- timers.h
-- includes:
- - cpu-features.h
- - cuda/include/cuComplex.h
- - cuda/include/cublas_v2.h
- - cuda/include/cuda.h
- - cuda/include/cudnn.h
- - cuda/include/cufft.h
- - cuda/include/curand.h
- - cpuid.h
- - nan.h
- - omp.h
- - stdatomic.h
- - unlocked-io.h
- - cygwin/version.h
- - zircon/syscalls.h
+- includes:
+ - cpu-features.h
+ - cuda/include/cuComplex.h
+ - cuda/include/cublas_v2.h
+ - cuda/include/cuda.h
+ - cuda/include/cudnn.h
+ - cuda/include/cufft.h
+ - cuda/include/curand.h
+ - cpuid.h
+ - nan.h
+ - omp.h
+ - stdatomic.h
+ - unlocked-io.h
+ - cygwin/version.h
+ - zircon/syscalls.h
- zircon/types.h
- zircon/process.h
- - sys/linux-syscalls.h
- - tr1/memory
- - android/log.h
- - ompt.h
- # vvvvv ____ because in [geobase/perl/dynamic] does not work ignoring via "// Y_IGNORE"
- - geobase6/service_getter.hpp
- - geobase6/timezone_getter.hpp
- # ^^^^^ ----
- #if defined(__FreeBSD__)
- - bluetooth.h
- - bsdxml.h
- - devstat.h
- - ieeefp.h
- - jail.h
- - kvm.h
- - libutil.h
- - machine/atomic.h
- - machine/cpu.h
- - machine/fpu.h
- - malloc_np.h
- - netinet/sctp_uio.h
+ - sys/linux-syscalls.h
+ - tr1/memory
+ - android/log.h
+ - ompt.h
+ # vvvvv ____ because in [geobase/perl/dynamic] does not work ignoring via "// Y_IGNORE"
+ - geobase6/service_getter.hpp
+ - geobase6/timezone_getter.hpp
+ # ^^^^^ ----
+ #if defined(__FreeBSD__)
+ - bluetooth.h
+ - bsdxml.h
+ - devstat.h
+ - ieeefp.h
+ - jail.h
+ - kvm.h
+ - libutil.h
+ - machine/atomic.h
+ - machine/cpu.h
+ - machine/fpu.h
+ - malloc_np.h
+ - netinet/sctp_uio.h
- netinet/ip_options.h
- netinet/sctp_kdtrace.h
- netinet/sctp_lock_bsd.h
@@ -301,686 +301,686 @@
- netipsec/ipsec.h
- netipsec/ipsec6.h
- netipsec/key.h
- - opie.h
- - osreldate.h
+ - opie.h
+ - osreldate.h
- opt_sctp.h
- - pthread_np.h
- - ripemd.h
- - sha.h
- - sha256.h
- - sha512.h
- - sys/cpuctl.h
- - sys/cpuset.h
- - sys/disklabel.h
- - sys/endian.h
+ - pthread_np.h
+ - ripemd.h
+ - sha.h
+ - sha256.h
+ - sha512.h
+ - sys/cpuctl.h
+ - sys/cpuset.h
+ - sys/disklabel.h
+ - sys/endian.h
- sys/eventhandler.h
- - sys/exec.h
- - sys/extattr.h
+ - sys/exec.h
+ - sys/extattr.h
- sys/filedesc.h
- sys/gsb_crc32.h
- - sys/jail.h
- - sys/ktrace.h
- - sys/machine.h
- - sys/module.h
- - sys/mpctl.h
- - sys/mutex.h
+ - sys/jail.h
+ - sys/ktrace.h
+ - sys/machine.h
+ - sys/module.h
+ - sys/mpctl.h
+ - sys/mutex.h
- sys/rwlock.h
- sys/semaphore.h
- sys/smp.h
- - sys/stdint.h
+ - sys/stdint.h
- sys/systm.h
- - sys/thr.h
- - sys/timespec.h
- - sys/umtx.h
- - sys/uuid.h
- - ucred.h
- - varargs.h
- - vm/vm_param.h
- #endif
- #if defined(__GNUC__)
- - varargs.h
- - stdfix.h
- - mm_malloc.h
- - quadmath.h
- #endif
- #if defined(_MSC_VER)
- - comdef.h
- - comutil.h
- - concrt.h
- - crtdefs.h
- - crtversion.h
- - eh.h
- - excpt.h
- - hash_map
- - hash_set
- - ppl.h
- - ppltasks.h
- - rtcapi.h
- - vadefs.h
- - varargs.h
- - xlocinfo.h
- - xstddef
- - xutility
- - ymath.h
- - crtassem.h
- #endif
- #if defined(_unix_) && TODO
+ - sys/thr.h
+ - sys/timespec.h
+ - sys/umtx.h
+ - sys/uuid.h
+ - ucred.h
+ - varargs.h
+ - vm/vm_param.h
+ #endif
+ #if defined(__GNUC__)
+ - varargs.h
+ - stdfix.h
+ - mm_malloc.h
+ - quadmath.h
+ #endif
+ #if defined(_MSC_VER)
+ - comdef.h
+ - comutil.h
+ - concrt.h
+ - crtdefs.h
+ - crtversion.h
+ - eh.h
+ - excpt.h
+ - hash_map
+ - hash_set
+ - ppl.h
+ - ppltasks.h
+ - rtcapi.h
+ - vadefs.h
+ - varargs.h
+ - xlocinfo.h
+ - xstddef
+ - xutility
+ - ymath.h
+ - crtassem.h
+ #endif
+ #if defined(_unix_) && TODO
- bits/types/mbstate_t.h
- - sys/atomic.h
- - sys/atomic_op.h
- - sys/bsdskt.h
- - sys/bsdtty.h
- - sys/builtin.h
- - sys/cygwin.h
- - sys/dcmd_blk.h
- - sys/devpoll.h
- - sys/fmutex.h
- - sys/int_types.h
- - sys/loadavg.h
+ - sys/atomic.h
+ - sys/atomic_op.h
+ - sys/bsdskt.h
+ - sys/bsdtty.h
+ - sys/builtin.h
+ - sys/cygwin.h
+ - sys/dcmd_blk.h
+ - sys/devpoll.h
+ - sys/fmutex.h
+ - sys/int_types.h
+ - sys/loadavg.h
- sys/localedef.h
- - sys/machlock.h
- - sys/mkdev.h
- - sys/modem.h
- - sys/ndir.h
- - sys/port_impl.h
- - sys/processor.h
- - sys/pstat.h
- - sys/system_properties.h
- - sys/termio.h
- - sys/timeval.h
- - machine/bswap.h
- - machine/sys/inline.h
- #endif
- #if defined(_PERL_)
- - EXTERN.h
- - perl.h
- - XSUB.h
- #endif
- #if defined(_darwin_)
- - AEObjects.h
- - AEPackObject.h
- - AERegistry.h
- - AppleEvents.h
- - Files.h
- - Gestalt.h
- - ImageCompression.h
- - Palettes.h
- - PictUtils.h
- - Processes.h
- - QDOffscreen.h
- - QuickDraw.h
- - TextUtils.h
- - Types.h
+ - sys/machlock.h
+ - sys/mkdev.h
+ - sys/modem.h
+ - sys/ndir.h
+ - sys/port_impl.h
+ - sys/processor.h
+ - sys/pstat.h
+ - sys/system_properties.h
+ - sys/termio.h
+ - sys/timeval.h
+ - machine/bswap.h
+ - machine/sys/inline.h
+ #endif
+ #if defined(_PERL_)
+ - EXTERN.h
+ - perl.h
+ - XSUB.h
+ #endif
+ #if defined(_darwin_)
+ - AEObjects.h
+ - AEPackObject.h
+ - AERegistry.h
+ - AppleEvents.h
+ - Files.h
+ - Gestalt.h
+ - ImageCompression.h
+ - Palettes.h
+ - PictUtils.h
+ - Processes.h
+ - QDOffscreen.h
+ - QuickDraw.h
+ - TextUtils.h
+ - Types.h
- sys/_types/_mbstate_t.h
- #endif
- #if defined(_OS2_)
- - os2.h
- #endif
- #if defined(_arm_)
- - arm/limits.h
- #endif
- #if defined(_VMS_) && TODO
- - atrdef.h
- - dcdef.h
- - descrip.h
- - dvsdef.h
- - fab.h
- - fibdef.h
- - gen64def.h
- - iledef.h
- - iodef.h
- - lib$routines.h
- - libfildef.h
- - libfisdef.h
- - lnmdef.h
- - nam.h
- - rms.h
- - rmsdef.h
- - ssdef.h
- - starlet.h
- - str$routines.h
- - stsdef.h
- - syidef.h
- - times.h
- - unixio.h
- - tcpSocketVaxRoutines.h
- #endif
- #if defined(_SOLARIS_) && TODO
- - synch.h
- - sys/byteorder.h
- #endif
- #if defined(__MSL__) && TODO && WTF
- - unix.h
- #endif
- #if defined(__sgi)
- - sgidefs.h
- #endif
- #if defined(__BEOS__)
- - ByteOrder.h
- - OS.h
- - support/SupportDefs.h
- - kernel/OS.h
- - kernel/image.h
- #endif
- #if defined(_sun_)
- - procfs.h
- #endif
- #if defined(__sun)
- - sys/port.h
- #endif
- #if defined(__sun__)
- - sys/isa_defs.h
- #endif
- #if defined(__X11__)
- - X11/XKBlib.h
- - X11/keysym.h
- - X11/extensions/shape.h
- - X11/extensions/XShm.h
- - X11/cursorfont.h
- - X11/Xutil.h
- - X11/Xresource.h
- - X11/Xproto.h
- - X11/Xos.h
- - X11/Xlocale.h
- - X11/Xlib.h
- - X11/Xatom.h
- - X11/Intrinsic.h
- #endif
- #if defined(HAVE_DMALLOC)
- - dmalloc.h
- #endif
- #if defined(HAVE_ALTIVEC)
- - altivec.h
- #endif
- #if defined(__vxWorks__)
+ #endif
+ #if defined(_OS2_)
+ - os2.h
+ #endif
+ #if defined(_arm_)
+ - arm/limits.h
+ #endif
+ #if defined(_VMS_) && TODO
+ - atrdef.h
+ - dcdef.h
+ - descrip.h
+ - dvsdef.h
+ - fab.h
+ - fibdef.h
+ - gen64def.h
+ - iledef.h
+ - iodef.h
+ - lib$routines.h
+ - libfildef.h
+ - libfisdef.h
+ - lnmdef.h
+ - nam.h
+ - rms.h
+ - rmsdef.h
+ - ssdef.h
+ - starlet.h
+ - str$routines.h
+ - stsdef.h
+ - syidef.h
+ - times.h
+ - unixio.h
+ - tcpSocketVaxRoutines.h
+ #endif
+ #if defined(_SOLARIS_) && TODO
+ - synch.h
+ - sys/byteorder.h
+ #endif
+ #if defined(__MSL__) && TODO && WTF
+ - unix.h
+ #endif
+ #if defined(__sgi)
+ - sgidefs.h
+ #endif
+ #if defined(__BEOS__)
+ - ByteOrder.h
+ - OS.h
+ - support/SupportDefs.h
+ - kernel/OS.h
+ - kernel/image.h
+ #endif
+ #if defined(_sun_)
+ - procfs.h
+ #endif
+ #if defined(__sun)
+ - sys/port.h
+ #endif
+ #if defined(__sun__)
+ - sys/isa_defs.h
+ #endif
+ #if defined(__X11__)
+ - X11/XKBlib.h
+ - X11/keysym.h
+ - X11/extensions/shape.h
+ - X11/extensions/XShm.h
+ - X11/cursorfont.h
+ - X11/Xutil.h
+ - X11/Xresource.h
+ - X11/Xproto.h
+ - X11/Xos.h
+ - X11/Xlocale.h
+ - X11/Xlib.h
+ - X11/Xatom.h
+ - X11/Intrinsic.h
+ #endif
+ #if defined(HAVE_DMALLOC)
+ - dmalloc.h
+ #endif
+ #if defined(HAVE_ALTIVEC)
+ - altivec.h
+ #endif
+ #if defined(__vxWorks__)
- vxCpuLib.h
- - vxWorks.h
- - sockLib.h
- - hostLib.h
- - ioLib.h
- - iosLib.h
- - resolvLib.h
+ - vxWorks.h
+ - sockLib.h
+ - hostLib.h
+ - ioLib.h
+ - iosLib.h
+ - resolvLib.h
- rtpLib.h
- - pipeDrv.h
- - selectLib.h
- #endif
- #if defined(_LIBC) && TRASH
- - ../locale/localeinfo.h
- - ../locale/elem-hash.h
- - ../locale/coll-lookup.h
- #endif
- #if defined(_LINUX_ANDROID)
- - android/api-level.h
- - android/ndk-version.h
- #endif
- #if defined(__HP_aCC)
- - acxx_demangle.h
- #endif
- #if defined(HAVE_CONFIG_H) && TODO
- - config_auto.h
- #endif
- #if defined(_TRASH_) && TODO
- - openssl/fips.h
- - tr1/unordered_map
- - tr1/unordered_set
- - tr1/type_traits
- - ext/atomicity.h
- - bits/c++config.h
- - bits/atomicity.h
- - gcrypt.h
- - gnutls/gnutls.h
- - gdwmfapi.h
- - winmmap.h
- - sf_unistd.h
- #endif
- #if defined(__TURBOC__) || defined(__BORLANDC__)
- - alloc.h
- #endif
- #if defined (__DECC) || defined (__DECCXX)
- - machine/builtins.h
- #endif
- #if defined(USE_PERL) && TODO
- - perliol.h
- #endif
- #if defined(__NetBSD__)
+ - pipeDrv.h
+ - selectLib.h
+ #endif
+ #if defined(_LIBC) && TRASH
+ - ../locale/localeinfo.h
+ - ../locale/elem-hash.h
+ - ../locale/coll-lookup.h
+ #endif
+ #if defined(_LINUX_ANDROID)
+ - android/api-level.h
+ - android/ndk-version.h
+ #endif
+ #if defined(__HP_aCC)
+ - acxx_demangle.h
+ #endif
+ #if defined(HAVE_CONFIG_H) && TODO
+ - config_auto.h
+ #endif
+ #if defined(_TRASH_) && TODO
+ - openssl/fips.h
+ - tr1/unordered_map
+ - tr1/unordered_set
+ - tr1/type_traits
+ - ext/atomicity.h
+ - bits/c++config.h
+ - bits/atomicity.h
+ - gcrypt.h
+ - gnutls/gnutls.h
+ - gdwmfapi.h
+ - winmmap.h
+ - sf_unistd.h
+ #endif
+ #if defined(__TURBOC__) || defined(__BORLANDC__)
+ - alloc.h
+ #endif
+ #if defined (__DECC) || defined (__DECCXX)
+ - machine/builtins.h
+ #endif
+ #if defined(USE_PERL) && TODO
+ - perliol.h
+ #endif
+ #if defined(__NetBSD__)
- lwp.h
- - perfuse.h
- #endif
- #if V8_OS_QNX
- - sys/syspage.h
- #endif
- #if V8_OS_AIX
- - sys/systemcfg.h
+ - perfuse.h
+ #endif
+ #if V8_OS_QNX
+ - sys/syspage.h
+ #endif
+ #if V8_OS_AIX
+ - sys/systemcfg.h
- sys/thread.h
- #endif
- - mbarrier.h
- - iostream.h
- - streambuf.h
- - ostream.h
- - slist
- - nacl/nacl_random.h
- - jemalloc/jemalloc.h
- - tr1/tuple
- - sys/inttypes.h
- - lockdep.h
- - memfault.h
- - memcheck.h
- - msvc.h
- - sqlite3userauth.h
- - linenoise.h
- - sunmath.h
- - sys/fpu.h
- - win32.h
- - bsd/stdlib.h
- - bsd/unistd.h
- - sys/videoio.h
- - libv4l2.h
- - soundcard.h
- - ../ucrt/fcntl.h
- - ../ucrt/locale.h
- - ../ucrt/math.h
- - ../ucrt/signal.h
- - ../ucrt/sys/stat.h
- #if defined (CUDA)
- - math_constants.h
- #endif
- #if defined(BUILDING_LIBCURL)
- - amitcp/socketbasetags.h
- - clib.h
- - exec/execbase.h
- - exec/types.h
- - extra/strdup.h
- - extra/stricmp.h
- - fabdef.h
- - floss.h
- - gnutls/crypto.h
- - gskssl.h
- - gss.h
- - hasht.h
- - ldap_ssl.h
- - librtmp/rtmp.h
- - lwip/init.h
- - lwip/netdb.h
- - lwip/sockets.h
- - nettle/des.h
- - nettle/md4.h
- - nettle/md5.h
- - pk11pub.h
- - proto/dos.h
- - proto/exec.h
- - qsoasync.h
- - stabs.h
- - tpf/sysapi.h
- #endif
- - asm/page.h
+ #endif
+ - mbarrier.h
+ - iostream.h
+ - streambuf.h
+ - ostream.h
+ - slist
+ - nacl/nacl_random.h
+ - jemalloc/jemalloc.h
+ - tr1/tuple
+ - sys/inttypes.h
+ - lockdep.h
+ - memfault.h
+ - memcheck.h
+ - msvc.h
+ - sqlite3userauth.h
+ - linenoise.h
+ - sunmath.h
+ - sys/fpu.h
+ - win32.h
+ - bsd/stdlib.h
+ - bsd/unistd.h
+ - sys/videoio.h
+ - libv4l2.h
+ - soundcard.h
+ - ../ucrt/fcntl.h
+ - ../ucrt/locale.h
+ - ../ucrt/math.h
+ - ../ucrt/signal.h
+ - ../ucrt/sys/stat.h
+ #if defined (CUDA)
+ - math_constants.h
+ #endif
+ #if defined(BUILDING_LIBCURL)
+ - amitcp/socketbasetags.h
+ - clib.h
+ - exec/execbase.h
+ - exec/types.h
+ - extra/strdup.h
+ - extra/stricmp.h
+ - fabdef.h
+ - floss.h
+ - gnutls/crypto.h
+ - gskssl.h
+ - gss.h
+ - hasht.h
+ - ldap_ssl.h
+ - librtmp/rtmp.h
+ - lwip/init.h
+ - lwip/netdb.h
+ - lwip/sockets.h
+ - nettle/des.h
+ - nettle/md4.h
+ - nettle/md5.h
+ - pk11pub.h
+ - proto/dos.h
+ - proto/exec.h
+ - qsoasync.h
+ - stabs.h
+ - tpf/sysapi.h
+ #endif
+ - asm/page.h
- asm/sgidefs.h
- - wrl\client.h
- - wrl\event.h
- - wrl\wrappers\corewrappers.h
- - wrl\ftm.h
- - bits/char_traits.h
- - bits/stl_algobase.h
- - bits/stl_move.h
- - bits/stl_pair.h
- - bits/stl_function.h
- - bits/move.h
- - ndir.h
- - ext/rope
- - sunmedia_types.h
- - clidef.h
- - credef.h
- - dos/dos.h
- - lbrdef.h
- - lbr$routines.h
- - libclidef.h
- - libguile.h
- - mhddef.h
- - pathstuff.h
- - perror.h
- - processes.h
- - sub_proc.h
- - w32err.h
- - procinfo.h
- #if defined(__HAIKU__)
- - FindDirectory.h
- - StorageDefs.h
- #endif
- - fpxcp.h
- - fptrap.h
- - fortran.h
- - agg_allocator.h
- - SIOUX.h
- - sys/siginfo.h
- #ifdef HAVE_LIBGIMLI_H
- - libgimli.h
- #endif
- #if MATLAB_MEX_FILE
- - mex.h
- #else
- - lzmalib.h
- # ICU
- - uconfig_local.h
- - ucln_local_hook.c
- - unistrm.h
- - udbgutil.h
- - dll.h
- - ascii_a.h
- - qusec.h
- - qusrjobi.h
- - qliept.h
- - mih/testptr.h
- - sys/neutrino.h
- - cics.h
- - tr1/cmath
- - tr1/complex
- - tbb/scalable_allocator.h
- - libmemcached/dtrace_probes.h
+ - wrl\client.h
+ - wrl\event.h
+ - wrl\wrappers\corewrappers.h
+ - wrl\ftm.h
+ - bits/char_traits.h
+ - bits/stl_algobase.h
+ - bits/stl_move.h
+ - bits/stl_pair.h
+ - bits/stl_function.h
+ - bits/move.h
+ - ndir.h
+ - ext/rope
+ - sunmedia_types.h
+ - clidef.h
+ - credef.h
+ - dos/dos.h
+ - lbrdef.h
+ - lbr$routines.h
+ - libclidef.h
+ - libguile.h
+ - mhddef.h
+ - pathstuff.h
+ - perror.h
+ - processes.h
+ - sub_proc.h
+ - w32err.h
+ - procinfo.h
+ #if defined(__HAIKU__)
+ - FindDirectory.h
+ - StorageDefs.h
+ #endif
+ - fpxcp.h
+ - fptrap.h
+ - fortran.h
+ - agg_allocator.h
+ - SIOUX.h
+ - sys/siginfo.h
+ #ifdef HAVE_LIBGIMLI_H
+ - libgimli.h
+ #endif
+ #if MATLAB_MEX_FILE
+ - mex.h
+ #else
+ - lzmalib.h
+ # ICU
+ - uconfig_local.h
+ - ucln_local_hook.c
+ - unistrm.h
+ - udbgutil.h
+ - dll.h
+ - ascii_a.h
+ - qusec.h
+ - qusrjobi.h
+ - qliept.h
+ - mih/testptr.h
+ - sys/neutrino.h
+ - cics.h
+ - tr1/cmath
+ - tr1/complex
+ - tbb/scalable_allocator.h
+ - libmemcached/dtrace_probes.h
# unknown
- - win_stdint.h
- - probes.h
- - thread.h
- # mongoc-driver unused includes
- - tls.h
- #if metrika then skip bad includes from metrika
- - boost/thread/detail/lock.hpp
- #endif metrika
- - xti.h
- # libgit2 unused includes
- - proto/timer.h
- - mbsupport.h
- # end of libgit2 unused includes
- # xray includes
- - xray/xray_interface.h
- - attr/xattr.h
- - fshelp.h
- - mlib_image.h
- - selinux/selinux.h
- - sys/mntctl.h
- - sys/mnttab.h
- - sys/systeminfo.h
- - sys/vfstab.h
- - sys/vmount.h
- - CL/sycl.hpp
- # libpcap files
- - os-proto.h
- - pc.h
- - pharlap.h
- - msdos/pm_drvr/lock.h
- - TcApi.h
- - net/pfvar.h
- - net/if_pflog.h
- - netdnet/dnetdb.h
- - sys/ethernet.h
- - sys/stream.h
- - netlink/genl/genl.h
- - netlink/genl/family.h
- - netlink/genl/ctrl.h
- - netlink/msg.h
- - netlink/attr.h
- # end libpcap files
-
-# These includes are not used in autocheck builds, but might be necessary for
-# some external builds with exotic settings
-
-- case_sensitive: false
- includes:
- - bemapiset.h
- - cor.h
- - fusion.h
- - IPHlpApi.h
- - metahost.h
- #if defined(WINDOWS) && defined (_USE_MFC_)
- - afx.h
- #endif
- #if defined(WINDOWS) && CONTRIB && TRASH
- - ../include/stdint.h
- #endif
-
-- source_filter: ".*contrib.*"
- includes:
- #if defined (__OpenBSD__) && CONTRIB
- - spinlock.h
- #endif
- #if CONTRIB && TODO
- - MSTcpIP.h
- - MacSocket.h
- - WinIoCtl.h
- - WinPDFCore.h
- - Winsock2.h
- - Xm/XmAll.h
- - aep.h
- - atalla.h
- - crypto/cryptodev.h
- - cswift.h
- - cxcore.h
- - efndef
- - exiv2/types.hpp
- - hw_4758_cca.h
- - hw_ubsec.h
- - hwcryptohook.h
- - jpidef.h
- - lckdef.h
- - libdtdef.h
- - novsock2.h
- - openssl/fips_rand.h
- - openssl/fipssyms.h
- - openssl/jpake.h
- - rld_interface.h
- - screen.h
- - sureware.h
- - t_ctype.h
- - tr1/unordered_map.hpp
- - typedefs.h
- - winmain.h
- - wintext.h
- - yandex/http/curl_wrapper.hpp
- - yandex/threads/boost_threaded.hpp
- - yasm-plugin.h
- #endif
- #if CONTRIB && TRASH
- - macconfig.h
- - amigaconfig.h
- - json_batchallocator.h
- - json_internalarray.inl
- - json_internalmap.inl
- - mysql/mysql_version.h
- - libiberty.h
- #endif
-
-- includes:
- - Aclapi.h
- - tr1/functional
- - time64.h
- - extern.h
- #if defined(__FreeBSD__)
- - _ctype.h
- - alias.h
- - calendar.h
- - fetch.h
- - gelf.h
- - gnuregex.h
- - kafs.h
- - login_cap.h
- - machine/_inttypes.h
- - machine/_stdint.h
- - machine/asm.h
- - machine/in_cksum.h
- - machine/sigframe.h
- - machine/sysarch.h
- - machine/trap.h
- - md2.h
- - md4.h
- - mp.h
- - pcap-int.h
- - sys/_iovec.h
- - sys/_null.h
- - sys/_pthreadtypes.h
- - sys/_sigset.h
- - sys/_timeval.h
- - sys/devicestat.h
- - sys/fnv_hash.h
- - sys/limits.h
- - sys/priv.h
- - sys/sched.h
- - sys/sema.h
- - sys/stack.h
- - sys/timers.h
- - sys/tree.h
- - tcpd.h
- - ypclnt.h
- #endif
- #if defined (__linux__)
- - asm/fpu.h
- - i386/fpu_control.h
- - zlibdefs.h
- #endif
- #if defined(_MSC_VER)
- - agents.h
- - allocators
- - amp.h
- - collection.h
- - ConcurrencySal.h
- - concurrent_priority_queue.h
- - concurrent_queue.h
- - concurrent_unordered_map.h
- - concurrent_unordered_set.h
- - concurrent_vector.h
- - vcruntime_new_debug.h
- - dvec.h
- - setjmpex.h
- - srv.h
- - typeinfo.h
- - xcomplex
- - xdebug
- - xhash
- - xiosbase
- - xkeycheck.h
- - xlocale
- - xlocinfo
- - xlocnum
- - xmemory
- - xmemory0
- - xstring
- - xtr1common
- - xtree
- - yvals.h
- #endif
- #if defined(_unix_) && TODO
- - sys/feature_tests.h
- #endif
- #if defined(_darwin_)
- - libkern/version.h
- - System/pthread_machdep.h
- #endif
- #if defined(_VMS_) && TODO
- - chfdef.h
- - libdef.h
- #endif
- #if defined(__sgi)
- - sigfpe.h
- #endif
- #if defined(__MWERKS__)
- - nwfileio.h
- - nwthread.h
- #endif
- #if defined(_TRASH_) && TODO
- - ext/slist
- - google/profiler.h
- #endif
- #if defined(__QNXNTO__)
- - sys/cpuinline.h
- #endif
- #if V8_OS_QNX
- - backtrace.h
- #endif
- - yabs_mx_calc_table.h
- - net/errno.h
- - sys/mode.h
- - nwstdio.h
- - os2ish.h
- - vmsish.h
- - ./plan9/plan9ish.h
- - ./vos/vosish.h
- - vos/vosish.h
- - symbian/symbianish.h
- - haiku/haikuish.h
- - nw5thread.h
- - os2thread.h
- - netware.h
- - perldtrace.h
- - win32thread.h
- - wince.h
- - symbian/symbian_proto.h
- - xconfig.h
- - bsd/ctypes.h
- - objc/NXCType.h
- - appkit/NXCType.h
- - sfio.h
- - vmesa/vmesaish.h
- - sys\stat.h
- - mpeix/mpeixish.h
- - epocish.h
- - beos/beosish.h
- - WinNT.h
- - ../../VC/include/stdio.h
- - ../ucrt/stdio.h
- #if defined(BUILDING_LIBCURL)
- - axTLS/ssl.h
- - certdb.h
- - cert.h
- - cyassl/error.h
- - cyassl/openssl/ssl.h
- - cyassl/ssl.h
- - nspr.h
- - polarssl/certs.h
- - polarssl/ctr_drbg.h
- - polarssl/entropy.h
- - polarssl/error.h
- - polarssl/havege.h
- - polarssl/net.h
- - polarssl/ssl.h
- - polarssl/version.h
- - polarssl/x509.h
- - prerror.h
- - prio.h
- - prtypes.h
- - qsossl.h
- - secerr.h
- - secitem.h
- - secmod.h
- - secport.h
- - spnegohelp.h
- - sslerr.h
- - sslproto.h
- #endif
- - Activation.h
- - android/native_window.h
- - Windows.System.Threading.h
- #if defined(__MINGW32__) || defined(_MSC_VER)
- - inet_net_pton.h
- - inet_ntop.h
- #endif
- #if EV_USE_IOCP
- - ev_iocp.c
- #endif
- - zend_exceptions.h
- #if MATLAB_MEX_FILE
+ - win_stdint.h
+ - probes.h
+ - thread.h
+ # mongoc-driver unused includes
+ - tls.h
+ #if metrika then skip bad includes from metrika
+ - boost/thread/detail/lock.hpp
+ #endif metrika
+ - xti.h
+ # libgit2 unused includes
+ - proto/timer.h
+ - mbsupport.h
+ # end of libgit2 unused includes
+ # xray includes
+ - xray/xray_interface.h
+ - attr/xattr.h
+ - fshelp.h
+ - mlib_image.h
+ - selinux/selinux.h
+ - sys/mntctl.h
+ - sys/mnttab.h
+ - sys/systeminfo.h
+ - sys/vfstab.h
+ - sys/vmount.h
+ - CL/sycl.hpp
+ # libpcap files
+ - os-proto.h
+ - pc.h
+ - pharlap.h
+ - msdos/pm_drvr/lock.h
+ - TcApi.h
+ - net/pfvar.h
+ - net/if_pflog.h
+ - netdnet/dnetdb.h
+ - sys/ethernet.h
+ - sys/stream.h
+ - netlink/genl/genl.h
+ - netlink/genl/family.h
+ - netlink/genl/ctrl.h
+ - netlink/msg.h
+ - netlink/attr.h
+ # end libpcap files
+
+# These includes are not used in autocheck builds, but might be necessary for
+# some external builds with exotic settings
+
+- case_sensitive: false
+ includes:
+ - bemapiset.h
+ - cor.h
+ - fusion.h
+ - IPHlpApi.h
+ - metahost.h
+ #if defined(WINDOWS) && defined (_USE_MFC_)
+ - afx.h
+ #endif
+ #if defined(WINDOWS) && CONTRIB && TRASH
+ - ../include/stdint.h
+ #endif
+
+- source_filter: ".*contrib.*"
+ includes:
+ #if defined (__OpenBSD__) && CONTRIB
+ - spinlock.h
+ #endif
+ #if CONTRIB && TODO
+ - MSTcpIP.h
+ - MacSocket.h
+ - WinIoCtl.h
+ - WinPDFCore.h
+ - Winsock2.h
+ - Xm/XmAll.h
+ - aep.h
+ - atalla.h
+ - crypto/cryptodev.h
+ - cswift.h
+ - cxcore.h
+ - efndef
+ - exiv2/types.hpp
+ - hw_4758_cca.h
+ - hw_ubsec.h
+ - hwcryptohook.h
+ - jpidef.h
+ - lckdef.h
+ - libdtdef.h
+ - novsock2.h
+ - openssl/fips_rand.h
+ - openssl/fipssyms.h
+ - openssl/jpake.h
+ - rld_interface.h
+ - screen.h
+ - sureware.h
+ - t_ctype.h
+ - tr1/unordered_map.hpp
+ - typedefs.h
+ - winmain.h
+ - wintext.h
+ - yandex/http/curl_wrapper.hpp
+ - yandex/threads/boost_threaded.hpp
+ - yasm-plugin.h
+ #endif
+ #if CONTRIB && TRASH
+ - macconfig.h
+ - amigaconfig.h
+ - json_batchallocator.h
+ - json_internalarray.inl
+ - json_internalmap.inl
+ - mysql/mysql_version.h
+ - libiberty.h
+ #endif
+
+- includes:
+ - Aclapi.h
+ - tr1/functional
+ - time64.h
+ - extern.h
+ #if defined(__FreeBSD__)
+ - _ctype.h
+ - alias.h
+ - calendar.h
+ - fetch.h
+ - gelf.h
+ - gnuregex.h
+ - kafs.h
+ - login_cap.h
+ - machine/_inttypes.h
+ - machine/_stdint.h
+ - machine/asm.h
+ - machine/in_cksum.h
+ - machine/sigframe.h
+ - machine/sysarch.h
+ - machine/trap.h
+ - md2.h
+ - md4.h
+ - mp.h
+ - pcap-int.h
+ - sys/_iovec.h
+ - sys/_null.h
+ - sys/_pthreadtypes.h
+ - sys/_sigset.h
+ - sys/_timeval.h
+ - sys/devicestat.h
+ - sys/fnv_hash.h
+ - sys/limits.h
+ - sys/priv.h
+ - sys/sched.h
+ - sys/sema.h
+ - sys/stack.h
+ - sys/timers.h
+ - sys/tree.h
+ - tcpd.h
+ - ypclnt.h
+ #endif
+ #if defined (__linux__)
+ - asm/fpu.h
+ - i386/fpu_control.h
+ - zlibdefs.h
+ #endif
+ #if defined(_MSC_VER)
+ - agents.h
+ - allocators
+ - amp.h
+ - collection.h
+ - ConcurrencySal.h
+ - concurrent_priority_queue.h
+ - concurrent_queue.h
+ - concurrent_unordered_map.h
+ - concurrent_unordered_set.h
+ - concurrent_vector.h
+ - vcruntime_new_debug.h
+ - dvec.h
+ - setjmpex.h
+ - srv.h
+ - typeinfo.h
+ - xcomplex
+ - xdebug
+ - xhash
+ - xiosbase
+ - xkeycheck.h
+ - xlocale
+ - xlocinfo
+ - xlocnum
+ - xmemory
+ - xmemory0
+ - xstring
+ - xtr1common
+ - xtree
+ - yvals.h
+ #endif
+ #if defined(_unix_) && TODO
+ - sys/feature_tests.h
+ #endif
+ #if defined(_darwin_)
+ - libkern/version.h
+ - System/pthread_machdep.h
+ #endif
+ #if defined(_VMS_) && TODO
+ - chfdef.h
+ - libdef.h
+ #endif
+ #if defined(__sgi)
+ - sigfpe.h
+ #endif
+ #if defined(__MWERKS__)
+ - nwfileio.h
+ - nwthread.h
+ #endif
+ #if defined(_TRASH_) && TODO
+ - ext/slist
+ - google/profiler.h
+ #endif
+ #if defined(__QNXNTO__)
+ - sys/cpuinline.h
+ #endif
+ #if V8_OS_QNX
+ - backtrace.h
+ #endif
+ - yabs_mx_calc_table.h
+ - net/errno.h
+ - sys/mode.h
+ - nwstdio.h
+ - os2ish.h
+ - vmsish.h
+ - ./plan9/plan9ish.h
+ - ./vos/vosish.h
+ - vos/vosish.h
+ - symbian/symbianish.h
+ - haiku/haikuish.h
+ - nw5thread.h
+ - os2thread.h
+ - netware.h
+ - perldtrace.h
+ - win32thread.h
+ - wince.h
+ - symbian/symbian_proto.h
+ - xconfig.h
+ - bsd/ctypes.h
+ - objc/NXCType.h
+ - appkit/NXCType.h
+ - sfio.h
+ - vmesa/vmesaish.h
+ - sys\stat.h
+ - mpeix/mpeixish.h
+ - epocish.h
+ - beos/beosish.h
+ - WinNT.h
+ - ../../VC/include/stdio.h
+ - ../ucrt/stdio.h
+ #if defined(BUILDING_LIBCURL)
+ - axTLS/ssl.h
+ - certdb.h
+ - cert.h
+ - cyassl/error.h
+ - cyassl/openssl/ssl.h
+ - cyassl/ssl.h
+ - nspr.h
+ - polarssl/certs.h
+ - polarssl/ctr_drbg.h
+ - polarssl/entropy.h
+ - polarssl/error.h
+ - polarssl/havege.h
+ - polarssl/net.h
+ - polarssl/ssl.h
+ - polarssl/version.h
+ - polarssl/x509.h
+ - prerror.h
+ - prio.h
+ - prtypes.h
+ - qsossl.h
+ - secerr.h
+ - secitem.h
+ - secmod.h
+ - secport.h
+ - spnegohelp.h
+ - sslerr.h
+ - sslproto.h
+ #endif
+ - Activation.h
+ - android/native_window.h
+ - Windows.System.Threading.h
+ #if defined(__MINGW32__) || defined(_MSC_VER)
+ - inet_net_pton.h
+ - inet_ntop.h
+ #endif
+ #if EV_USE_IOCP
+ - ev_iocp.c
+ #endif
+ - zend_exceptions.h
+ #if MATLAB_MEX_FILE
# unknown
- - GL/glx.h
- - CL/va_ext.h
- - sys/sysconf.h
- - ivx.hpp
- - clAmdBlas.h
- - clAmdFft.h
- - va/va.h
- #if metrika then skip bad includes from metrika
- - yandex/lbs/LBSLocator.hpp
- #endif metrika
- # libpcap files
- - sys/sysconfig.h
- - sys/device.h
- - sys/cfgodm.h
- - cf.h
- - zone.h
- - netpacket/if_packet.h
- # end libpcap files
+ - GL/glx.h
+ - CL/va_ext.h
+ - sys/sysconf.h
+ - ivx.hpp
+ - clAmdBlas.h
+ - clAmdFft.h
+ - va/va.h
+ #if metrika then skip bad includes from metrika
+ - yandex/lbs/LBSLocator.hpp
+ #endif metrika
+ # libpcap files
+ - sys/sysconfig.h
+ - sys/device.h
+ - sys/cfgodm.h
+ - cf.h
+ - zone.h
+ - netpacket/if_packet.h
+ # end libpcap files
diff --git a/build/sysincl/valgrind.yml b/build/sysincl/valgrind.yml
index de9c6b9f5d..d18404d505 100644
--- a/build/sysincl/valgrind.yml
+++ b/build/sysincl/valgrind.yml
@@ -1,4 +1,4 @@
-- includes:
- - valgrind/callgrind.h: contrib/libs/valgrind/valgrind/callgrind.h
- - valgrind/memcheck.h: contrib/libs/valgrind/valgrind/memcheck.h
- - valgrind/valgrind.h: contrib/libs/valgrind/valgrind/valgrind.h
+- includes:
+ - valgrind/callgrind.h: contrib/libs/valgrind/valgrind/callgrind.h
+ - valgrind/memcheck.h: contrib/libs/valgrind/valgrind/memcheck.h
+ - valgrind/valgrind.h: contrib/libs/valgrind/valgrind/valgrind.h
diff --git a/build/sysincl/windows.yml b/build/sysincl/windows.yml
index 26ae7b5bfa..3ebbb5616c 100644
--- a/build/sysincl/windows.yml
+++ b/build/sysincl/windows.yml
@@ -1,316 +1,316 @@
-- case_sensitive: false
- includes:
- - accctrl.h
- - aclapi.h
- - activation.h
- - activscp.h
- - adhoc.h
- - apiset.h
- - apisetcconv.h
+- case_sensitive: false
+ includes:
+ - accctrl.h
+ - aclapi.h
+ - activation.h
+ - activscp.h
+ - adhoc.h
+ - apiset.h
+ - apisetcconv.h
- atltime.h
- audioclient.h
- - authz.h
- - basetyps.h
- - bcrypt.h
- - bits.h
- - capi.h
+ - authz.h
+ - basetyps.h
+ - bcrypt.h
+ - bits.h
+ - capi.h
- cet.h
- - cfg.h
+ - cfg.h
- comdef.h
- - commctrl.h
- - commdlg.h
- - common.ver
- - compressapi.h
- - concurrencysal.h
- - conio.h
- - consoleapi.h
- - corecrt.h
- - corecrt_terminate.h
- - cpl.h
- - crtdbg.h
- - cryptuiapi.h
- - d2d1.h
- - d2d1_2.h
- - d3d10.h
- - d3d10_1.h
- - d3d11.h
- - d3d11_1.h
- - d3d9.h
- - d3dcompiler.h
- - datetimeapi.h
- - dbgeng.h
- - dbghelp.h
- - dbt.h
- - dcomp.h
- - debugapi.h
- - devguid.h
- - direct.h
- - dispex.h
- - dos.h
- - downloadmgr.h
- - driverspecs.h
- - dshow.h
+ - commctrl.h
+ - commdlg.h
+ - common.ver
+ - compressapi.h
+ - concurrencysal.h
+ - conio.h
+ - consoleapi.h
+ - corecrt.h
+ - corecrt_terminate.h
+ - cpl.h
+ - crtdbg.h
+ - cryptuiapi.h
+ - d2d1.h
+ - d2d1_2.h
+ - d3d10.h
+ - d3d10_1.h
+ - d3d11.h
+ - d3d11_1.h
+ - d3d9.h
+ - d3dcompiler.h
+ - datetimeapi.h
+ - dbgeng.h
+ - dbghelp.h
+ - dbt.h
+ - dcomp.h
+ - debugapi.h
+ - devguid.h
+ - direct.h
+ - dispex.h
+ - dos.h
+ - downloadmgr.h
+ - driverspecs.h
+ - dshow.h
- dsound.h
- - dsparse.h
- - dv.h
- - dvdmedia.h
- - dwrite.h
- - dxgi.h
- - dxgi1_2.h
- - dxgi1_3.h
- - dxgidebug.h
- - dxprogrammablecapture.h
- - dxva.h
- - dxva2api.h
- - effects.h
- - encdec.h
- - errhandlingapi.h
- - eventtoken.h
- - evntprov.h
- - evntrace.h
- - exdisp.h
- - exdispid.h
- - fci.h
- - fibersapi.h
- - fileapi.h
- - filter.h
- - fltuser.h
- - fltuserstructures.h
- - fttypes.h
- - fwpmu.h
- - gb18030.h
- - gdiplus.h
- - gdiplusimagecodec.h
- - gl/gl.h
- - gl/glu.h
- - guiddef.h
- - handleapi.h
- - heapapi.h
- - htmlhelp.h
- - http.h
- - imagehlp.h
- - ime_cmodes.h
- - imm.h
- - in6addr.h
- - inaddr.h
- - initguid.h
- - inspectable.h
- - instance.h
- - interlockedapi.h
- - intsafe.h
- - io.h
- - ioapiset.h
- - ipexport.h
- - ipifcons.h
- - iptypes.h
- - iwscapi.h
- - jobapi.h
- - journal.h
- - kbd.h
- - kernelspecs.h
- - ksmedia.h
- - ktmtypes.h
- - libloaderapi.h
- - lm.h
- - lmcons.h
- - lmerr.h
- - lmstats.h
- - mbctype.h
- - mbstring.h
- - mcx.h
- - memoryapi.h
- - mfapi.h
- - mi.h
- - minmax.h
- - minwinbase.h
- - minwindef.h
- - mlang.h
+ - dsparse.h
+ - dv.h
+ - dvdmedia.h
+ - dwrite.h
+ - dxgi.h
+ - dxgi1_2.h
+ - dxgi1_3.h
+ - dxgidebug.h
+ - dxprogrammablecapture.h
+ - dxva.h
+ - dxva2api.h
+ - effects.h
+ - encdec.h
+ - errhandlingapi.h
+ - eventtoken.h
+ - evntprov.h
+ - evntrace.h
+ - exdisp.h
+ - exdispid.h
+ - fci.h
+ - fibersapi.h
+ - fileapi.h
+ - filter.h
+ - fltuser.h
+ - fltuserstructures.h
+ - fttypes.h
+ - fwpmu.h
+ - gb18030.h
+ - gdiplus.h
+ - gdiplusimagecodec.h
+ - gl/gl.h
+ - gl/glu.h
+ - guiddef.h
+ - handleapi.h
+ - heapapi.h
+ - htmlhelp.h
+ - http.h
+ - imagehlp.h
+ - ime_cmodes.h
+ - imm.h
+ - in6addr.h
+ - inaddr.h
+ - initguid.h
+ - inspectable.h
+ - instance.h
+ - interlockedapi.h
+ - intsafe.h
+ - io.h
+ - ioapiset.h
+ - ipexport.h
+ - ipifcons.h
+ - iptypes.h
+ - iwscapi.h
+ - jobapi.h
+ - journal.h
+ - kbd.h
+ - kernelspecs.h
+ - ksmedia.h
+ - ktmtypes.h
+ - libloaderapi.h
+ - lm.h
+ - lmcons.h
+ - lmerr.h
+ - lmstats.h
+ - mbctype.h
+ - mbstring.h
+ - mcx.h
+ - memoryapi.h
+ - mfapi.h
+ - mi.h
+ - minmax.h
+ - minwinbase.h
+ - minwindef.h
+ - mlang.h
- mmdeviceapi.h
- - mmsystem.h
- - mq.h
- - mshtmdid.h
- - mshtmhst.h
- - mshtml.h
- - msi.h
- - msidefs.h
- - msiquery.h
- - msp.h
- - msputils.h
- - mstcpip.h
- - mswsock.h
- - mtx.h
- - namedpipeapi.h
- - namespaceapi.h
- - netioapi.h
- - new.h
- - npapi.h
- - ntdddisk.h
+ - mmsystem.h
+ - mq.h
+ - mshtmdid.h
+ - mshtmhst.h
+ - mshtml.h
+ - msi.h
+ - msidefs.h
+ - msiquery.h
+ - msp.h
+ - msputils.h
+ - mstcpip.h
+ - mswsock.h
+ - mtx.h
+ - namedpipeapi.h
+ - namespaceapi.h
+ - netioapi.h
+ - new.h
+ - npapi.h
+ - ntdddisk.h
- ntddk.h
- - ntddndis.h
- - ntdef.h
- - ntsecapi.h
- - ntstatus.h
- - ntverp.h
- - oaidl.idl
- - objbase.h
- - objectarray.h
- - objidl.h
- - objsafe.h
- - ocidl.h
- - ocidl.idl
- - odbcss.h
- - ole.h
- - ole2.h
- - oleacc.h
- - oleauto.h
- - olectl.h
+ - ntddndis.h
+ - ntdef.h
+ - ntsecapi.h
+ - ntstatus.h
+ - ntverp.h
+ - oaidl.idl
+ - objbase.h
+ - objectarray.h
+ - objidl.h
+ - objsafe.h
+ - ocidl.h
+ - ocidl.idl
+ - odbcss.h
+ - ole.h
+ - ole2.h
+ - oleacc.h
+ - oleauto.h
+ - olectl.h
- packon.h
- packoff.h
- pathcch.h
- - p2p.h
- - pdh.h
- - pdhmsg.h
- - perflib.h
- - persist.h
- - poppack.h
- - powerbase.h
- - process.h
- - processenv.h
- - processthreadsapi.h
- - processtopologyapi.h
- - profileapi.h
- - provider.h
- - psapi.h
- - pshpack1.h
- - pshpack2.h
- - pshpack4.h
- - pshpack8.h
- - qos.h
- - ratings.h
- - realtimeapiset.h
- - reason.h
- - richedit.h
+ - p2p.h
+ - pdh.h
+ - pdhmsg.h
+ - perflib.h
+ - persist.h
+ - poppack.h
+ - powerbase.h
+ - process.h
+ - processenv.h
+ - processthreadsapi.h
+ - processtopologyapi.h
+ - profileapi.h
+ - provider.h
+ - psapi.h
+ - pshpack1.h
+ - pshpack2.h
+ - pshpack4.h
+ - pshpack8.h
+ - qos.h
+ - ratings.h
+ - realtimeapiset.h
+ - reason.h
+ - richedit.h
- roapi.h
- - robuffer.h
- - rpc.h
- - rpcdce.h
- - rpcndr.h
- - safeint.h
- - sal.h
- - sapi.h
- - schannel.h
- - schedule.h
- - schnlsp.h
- - scsi.h
- - sddl.h
- - sdkddkver.h
- - sdv_driverspecs.h
- - security.h
- - securityappcontainer.h
- - securitybaseapi.h
- - sensors.h
- - sfc.h
- - share.h
- - shellapi.h
- - shlguid.h
- - shlobj.h
- - shlwapi.h
- - specstrings.h
- - specstrings_strict.h
- - specstrings_undef.h
- - spellcheck.h
- - sperror.h
- - sspi.h
- - stralign.h
- - stringapiset.h
- - strsafe.h
- - suppress.h
- - synchapi.h
- - sys/locking.h
- - sys/utime.h
- - sysinfoapi.h
- - systemtopologyapi.h
- - tbs.h
- - tchar.h
- - tdi.h
- - threadpoolapiset.h
- - threadpoollegacyapiset.h
- - timezoneapi.h
- - tlhelp32.h
- - traffic.h
- - tune.h
- - tvout.h
- - unknwn.h
- - unknwn.idl
- - upnp.h
- - urlmon.h
- - urlmon.idl
- - usb.h
- - userenv.h
- - usp10.h
- - utilapiset.h
- - uxtheme.h
- - verrsrc.h
- - versionhelpers.h
- - vfw.h
- - wbemidl.h
- - websocket.h
- - winapifamily.h
- - winbase.h
- - winber.h
- - wincon.h
- - wincrypt.h
- - windef.h
- - windns.h
- - windows.applicationmodel.core.h
- - windows.graphics.display.h
- - windows.h
- - windows.storage.h
- - windows.storage.streams.h
- - windows.system.threading.h
- - windows.ui.xaml.h
- - windows.ui.xaml.media.dxinterop.h
- - windowsx.h
- - winerror.h
- - wingdi.h
- - winhttp.h
- - wininet.h
- - winioctl.h
- - winldap.h
- - winnetwk.h
- - winnls.h
- - winnt.h
- - winperf.h
- - winreg.h
- - winres.h
- - winresrc.h
- - winsdkver.h
- - winsock.h
- - winsock2.h
+ - robuffer.h
+ - rpc.h
+ - rpcdce.h
+ - rpcndr.h
+ - safeint.h
+ - sal.h
+ - sapi.h
+ - schannel.h
+ - schedule.h
+ - schnlsp.h
+ - scsi.h
+ - sddl.h
+ - sdkddkver.h
+ - sdv_driverspecs.h
+ - security.h
+ - securityappcontainer.h
+ - securitybaseapi.h
+ - sensors.h
+ - sfc.h
+ - share.h
+ - shellapi.h
+ - shlguid.h
+ - shlobj.h
+ - shlwapi.h
+ - specstrings.h
+ - specstrings_strict.h
+ - specstrings_undef.h
+ - spellcheck.h
+ - sperror.h
+ - sspi.h
+ - stralign.h
+ - stringapiset.h
+ - strsafe.h
+ - suppress.h
+ - synchapi.h
+ - sys/locking.h
+ - sys/utime.h
+ - sysinfoapi.h
+ - systemtopologyapi.h
+ - tbs.h
+ - tchar.h
+ - tdi.h
+ - threadpoolapiset.h
+ - threadpoollegacyapiset.h
+ - timezoneapi.h
+ - tlhelp32.h
+ - traffic.h
+ - tune.h
+ - tvout.h
+ - unknwn.h
+ - unknwn.idl
+ - upnp.h
+ - urlmon.h
+ - urlmon.idl
+ - usb.h
+ - userenv.h
+ - usp10.h
+ - utilapiset.h
+ - uxtheme.h
+ - verrsrc.h
+ - versionhelpers.h
+ - vfw.h
+ - wbemidl.h
+ - websocket.h
+ - winapifamily.h
+ - winbase.h
+ - winber.h
+ - wincon.h
+ - wincrypt.h
+ - windef.h
+ - windns.h
+ - windows.applicationmodel.core.h
+ - windows.graphics.display.h
+ - windows.h
+ - windows.storage.h
+ - windows.storage.streams.h
+ - windows.system.threading.h
+ - windows.ui.xaml.h
+ - windows.ui.xaml.media.dxinterop.h
+ - windowsx.h
+ - winerror.h
+ - wingdi.h
+ - winhttp.h
+ - wininet.h
+ - winioctl.h
+ - winldap.h
+ - winnetwk.h
+ - winnls.h
+ - winnt.h
+ - winperf.h
+ - winreg.h
+ - winres.h
+ - winresrc.h
+ - winsdkver.h
+ - winsock.h
+ - winsock2.h
- winstring.h
- - winsvc.h
- - winternl.h
- - winuser.h
- - winver.h
- - winwlx.h
- - wnnc.h
- - wow64apiset.h
- - wrl.h
- - wrl/async.h
- - wrl/client.h
- - wrl/event.h
- - wrl/ftm.h
- - wrl/implements.h
- - wrl/wrappers/corewrappers.h
+ - winsvc.h
+ - winternl.h
+ - winuser.h
+ - winver.h
+ - winwlx.h
+ - wnnc.h
+ - wow64apiset.h
+ - wrl.h
+ - wrl/async.h
+ - wrl/client.h
+ - wrl/event.h
+ - wrl/ftm.h
+ - wrl/implements.h
+ - wrl/wrappers/corewrappers.h
- ws2bth.h
- - ws2def.h
- - ws2ipdef.h
+ - ws2def.h
+ - ws2ipdef.h
- ws2spi.h
- - ws2tcpip.h
- - wscapi.h
- - wspiapi.h
- - wtsapi32.h
- - wtypes.h
- - xa.h
- - xaudio2.h
+ - ws2tcpip.h
+ - wscapi.h
+ - wspiapi.h
+ - wtsapi32.h
+ - wtypes.h
+ - xa.h
+ - xaudio2.h
- xmllite.h
diff --git a/build/ya.make b/build/ya.make
index 407b8f13e0..c98ee52b97 100644
--- a/build/ya.make
+++ b/build/ya.make
@@ -20,7 +20,7 @@ PEERDIR(
END()
RECURSE(
- conf_fatal_error
+ conf_fatal_error
config
docs/empty
external_resources
diff --git a/build/ymake.core.conf b/build/ymake.core.conf
index 081833998b..c13782fa96 100644
--- a/build/ymake.core.conf
+++ b/build/ymake.core.conf
@@ -112,7 +112,7 @@ otherwise {
# tag:codenav
when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
- PY_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"pyndex $TARGET"}
+ PY_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"pyndex $TARGET"}
YNDEXER_ARGS=$YMAKE_PYTHON ${input:"build/scripts/yndexer.py"} $CPPYNDEXER_RESOURCE_GLOBAL/yndexer 1500 $(SOURCE_ROOT) $ARCADIA_BUILD_ROOT ${input:SRC}
YNDEXER_OUTPUT=${output;noauto;suf=${OBJ_CROSS_SUF}.ydx.pb2:SRC}
}
@@ -188,7 +188,7 @@ otherwise {
when ($MUSL == "yes") {
SYSINCL+=build/sysincl/libc-musl-libcxx.yml
}
- }
+ }
}
# tag:linux-specific
@@ -341,9 +341,9 @@ otherwise {
}
SWIG_IMPLICIT_INCLUDES = swig.swg go.swg java.swg perl5.swg python.swg
-FATAL_ERROR_MODULE=no
-FATAL_ERROR_MESSAGE=
-
+FATAL_ERROR_MODULE=no
+FATAL_ERROR_MESSAGE=
+
# tag:python-specific
# PYTHON_DISTR={ "default" | "macos-brew" } determine python system supply
# see build/platform/python/ya.make
@@ -391,9 +391,9 @@ when ($USE_SYSTEM_PYTHON) {
PY_VERSION=3.10
PY_FRAMEWORK_VERSION=3.10
}
- default ? {
- FATAL_ERROR_MESSAGE+=invalid USE_SYSTEM_PYTHON value
- }
+ default ? {
+ FATAL_ERROR_MESSAGE+=invalid USE_SYSTEM_PYTHON value
+ }
}
}
@@ -406,7 +406,7 @@ when ($HOST_OS_WINDOWS == "yes") {
# tag:python-specific
when ($USE_ARCADIA_PYTHON == "no") {
- SYSINCL+=build/sysincl/python.yml
+ SYSINCL+=build/sysincl/python.yml
}
# tag:allocator
@@ -423,10 +423,10 @@ when ($OS_CYGWIN == "yes" || $ARCH_PPC64LE == "yes") {
}
# tag:allocator
-when ($OS_DARWIN == "yes") {
- DEFAULT_ALLOCATOR=SYSTEM
-}
-
+when ($OS_DARWIN == "yes") {
+ DEFAULT_ALLOCATOR=SYSTEM
+}
+
# tag:allocator
when ($SANITIZER_TYPE) {
when ($SANITIZER_TYPE != "no") {
@@ -436,7 +436,7 @@ when ($SANITIZER_TYPE) {
# tag:internal
### @usage: CHECK_CONFIG_H(<conf_header>) # internal
-###
+###
### This internal macro adds checking code for configuration header in external (contrib) library.
### The check is needed to avoid conflicts on certain types and functions available in arcadia.
###
@@ -636,7 +636,7 @@ macro PY_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
### using Tool. Extra dependencies are passed via DEPS
macro PY_PROTO_PLUGIN2(NAME, EXT1, EXT2, TOOL, DEPS[]) {
PY_PROTO_PLUGIN($NAME $EXT1 $TOOL DEPS $DEPS)
- _ADD_PY_PROTO_OUT($EXT2)
+ _ADD_PY_PROTO_OUT($EXT2)
}
# tag:proto tag:java-specific
@@ -1292,7 +1292,7 @@ module _BASE_UNIT: _BARE_UNIT {
CFLAGS += -D_musl_
LINK_DYN_LIB_FLAGS += --musl
LINK_SCRIPT_EXE_FLAGS += --musl
- PEERDIR+=contrib/libs/musl/include
+ PEERDIR+=contrib/libs/musl/include
}
# g++ has proxy C-headers which are incompatible with libc++ proxy C-headers.
@@ -1320,7 +1320,7 @@ module _BASE_UNIT: _BARE_UNIT {
when ($USE_SSE4 == "yes") {
CFLAGS+=$SSE4_CFLAGS
C_DEFINES+=$SSE4_DEFINES
- }
+ }
}
elsewhen ($MSVC != "yes") {
CFLAGS += -mno-sse
@@ -1340,7 +1340,7 @@ module _BASE_UNIT: _BARE_UNIT {
DEFAULT(SWIG_LANG python)
DEFAULT(BISON_FLAGS -v)
DEFAULT(GP_FLAGS -CtTLANSI-C -Dk* -c)
-
+
when ($NEED_BINUTILS_PEERDIR && $BINUTILS_USED && $NEED_PLATFORM_PEERDIRS == "yes") {
PEERDIR+=build/platform/binutils
}
@@ -1643,7 +1643,7 @@ module _BASE_PROGRAM: _LINK_UNIT {
when ($CPU_CHECK == "yes") {
PEERDIR += library/cpp/cpuid_check
- }
+ }
when ($USE_ARC_PROFILE == "yes" && $NOUTIL != "yes") {
PEERDIR += library/cpp/execprofile/autostart
@@ -1669,7 +1669,7 @@ module _BASE_PROGRAM: _LINK_UNIT {
CPP_PROGRAM_SEM=add_executable $MODDIR $REALPRJNAME ${hide:TARGET} ${hide:AUTO_INPUT} && vcs_info && target_link_flags PUBLIC $OBJADDE_LIB $OBJADDE
### @usage: PROGRAM([progname])
###
-### Regular program module.
+### Regular program module.
### If name is not specified it will be generated from the name of the containing project directory.
module PROGRAM: _BASE_PROGRAM {
.ALIASES=REQUIREMENTS=CC_REQUIREMENTS
@@ -1723,7 +1723,7 @@ macro NO_EXTENDED_SOURCE_SEARCH() {
}
# tag:python-specific
-### @usage: PY3_PROGRAM([progname])
+### @usage: PY3_PROGRAM([progname])
###
### Python 3.x binary program. Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
### If name is not specified it will be generated from the name of the containing project directory.
@@ -1797,7 +1797,7 @@ module PYCR_PROGRAM: PY3_PROGRAM_BIN {
}
### @usage: EXPORTS_SCRIPT(exports_file)
-###
+###
### Specify exports script within PROGRAM, DLL and DLL-derived modules.
### This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files.
### The other option use EXPORTS parameter of the DLL module itself.
@@ -2250,7 +2250,7 @@ macro STYLE(Globs...) {
###
### The test module based on gtest (contrib/libs/gtest contrib/libs/gmock).
### Use public documentation on gtest for details.
-###
+###
### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
module GTEST_UGLY: _BASE_PROGRAM {
.NODE_TYPE=Program
@@ -2971,7 +2971,7 @@ macro ALL_SRCS(GLOBAL?"GLOBAL":"", Files...) {
###
### Base module to place DLLs into multimodules back to back with libraries.
### In order to function properly all modules in multimodule shall have the
-### same set of arguments. So this module is just library that accepts but
+### same set of arguments. So this module is just library that accepts but
### ignores all DLL arguments.
module _DLL_COMPATIBLE_LIBRARY: LIBRARY {
}
@@ -3374,9 +3374,9 @@ macro PY_NAMESPACE(Arg) {
# tag:internal
### @usage: _SRCS_NO_GLOBAL(files...) # internal
###
-### Proxy macro to SRCS macro which filters out GLOBAL keyword from the list of source files.
-### Useful for modules like EXTERNAL_JAVA_LIBRARY, where GLOBAL keyword cannot be applied properly.
-### Note: this macro changes order of source files.
+### Proxy macro to SRCS macro which filters out GLOBAL keyword from the list of source files.
+### Useful for modules like EXTERNAL_JAVA_LIBRARY, where GLOBAL keyword cannot be applied properly.
+### Note: this macro changes order of source files.
macro _SRCS_NO_GLOBAL(GLOBAL[], FILES...) {
SRCS($GLOBAL $FILES)
}
@@ -3389,7 +3389,7 @@ COMPILE_JAVA_MF=$COMPILE_JAVA
when ($EXT_JAVA_VCS_INFO == "yes") {
JAVA_VCS_MF_ARG=--vcs-mf $VCS_JAVA
COMPILE_JAVA_MF=$GENERATE_VCS_JAVA_INFO_NODEP && $COMPILE_JAVA
-}
+}
# tag:java-specific
EXT_JAVA_VCS_INFO=no
@@ -4101,7 +4101,7 @@ module PY3_LIBRARY: _PY3_LIBRARY {
# tag:python-specific
### @usage: _BASE_PY_PROGRAM #internal
###
-### The base module for all Python 2.x binary programs. Adds linking logic, relevant module properties and
+### The base module for all Python 2.x binary programs. Adds linking logic, relevant module properties and
### dependency on Python 2.x interpreter. Also adds import tests on all sources including PEERDIR'ed libraries.
### Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
@@ -4162,7 +4162,7 @@ otherwise {
# tag:python-specific
### @usage: _BASE_PY_PROGRAM #internal
###
-### The base module for all Python 3.x binary programs. Adds linking logic, relevant module properties and
+### The base module for all Python 3.x binary programs. Adds linking logic, relevant module properties and
### dependency on Python 3.x interpreter. Also adds import tests on all sources including libraries.
### Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
### This only compatible with PYTHON3-tagged modules and selects those from multimodules
@@ -5227,7 +5227,7 @@ when ($PERL_DEFAULT_PEERDIR == "yes") {
PEERDIR+=build/platform/perl
}
}
-
+
# tag:perl-specific
### @usage: USE_PERL_LIB()
### Add dependency on Perl to your LIBRARY
@@ -6884,7 +6884,7 @@ macro BUILD_PLNS(Src...) {
### @usage: COMPILE_NLG(Src...)
###
### Generate and compile .nlg templates (Jinja2-based) and interface for megamind runtime.
-###
+###
### Alice-specific macro
macro COMPILE_NLG(Src...) {
PEERDIR(alice/nlg/runtime)
@@ -6953,8 +6953,8 @@ SCHEEME2_STRUCT_INFO_FLAGS=-f "const static ui32 RecordSig" -u "RecordSig" --gcc
###
### @example:
###
-### SET(EXTRACT_STRUCT_INFO_FLAGS -f \"const static ui32 RecordSig\"
-### -u \"RecordSig\" -n${scheeme_name}SchemeInfo ----gcc44_no_typename no_complex_overloaded_func_export
+### SET(EXTRACT_STRUCT_INFO_FLAGS -f \"const static ui32 RecordSig\"
+### -u \"RecordSig\" -n${scheeme_name}SchemeInfo ----gcc44_no_typename no_complex_overloaded_func_export
### ${DATAWORK_SCHEEME_EXPORT_FLAGS})
###
### for compatibility with C++ compiler and the external environment.
@@ -7253,7 +7253,7 @@ PACK_TGZ=${cwd:ARCADIA_BUILD_ROOT} tar -czf ${rootrel:OUTPUT} ${rootrel:INPUT} $
# tag:internal
### @usage TOUCH(Outputs...) # internal
-### Just introduce outputs
+### Just introduce outputs
macro TOUCH(Outputs...) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output:Outputs}
}
@@ -8043,7 +8043,7 @@ _GO_TOOL_COMMON_FLAGS=\
++link-flags $GO_LINK_FLAGS_VALUE \
++cgo-srcs ${input:CGO_FILES} \
$_GO_EMBED_VALUE \
- $GO_TOOLCHAIN_ENV
+ $GO_TOOLCHAIN_ENV
# tag:go-specific
macro _GO_GEN_COVER_GO(GO_FILE, VAR_ID) {
@@ -8895,7 +8895,7 @@ module IOS_INTERFACE: _BARE_UNIT {
# tag:ios-specific
module DEFAULT_IOS_INTERFACE: IOS_INTERFACE {
- SET(MODULE_SUFFIX .default.ios.interface)
+ SET(MODULE_SUFFIX .default.ios.interface)
}
DEFAULT_IOS_TYPE=
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_windows.h b/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_windows.h
index 9faebbc254..0af3f54018 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_windows.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_windows.h
@@ -25,16 +25,16 @@
#ifdef GRPC_WINSOCK_SOCKET
-#define OPTIONAL
-
+#define OPTIONAL
+
#include <winsock2.h>
#include <ws2tcpip.h>
// must be included after the above
#include <mswsock.h>
-#undef OPTIONAL
-
+#undef OPTIONAL
+
typedef struct sockaddr grpc_sockaddr;
typedef struct sockaddr_in grpc_sockaddr_in;
typedef struct in_addr grpc_in_addr;
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/socket_windows.cc b/contrib/libs/grpc/src/core/lib/iomgr/socket_windows.cc
index f117653c49..417fb83b02 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/socket_windows.cc
+++ b/contrib/libs/grpc/src/core/lib/iomgr/socket_windows.cc
@@ -22,15 +22,15 @@
#ifdef GRPC_WINSOCK_SOCKET
-#define OPTIONAL
-
+#define OPTIONAL
+
#include <winsock2.h>
// must be included after winsock2.h
#include <mswsock.h>
-#undef OPTIONAL
-
+#undef OPTIONAL
+
#include "y_absl/strings/str_format.h"
#include <grpc/support/alloc.h>
diff --git a/contrib/libs/libc_compat/update.sh b/contrib/libs/libc_compat/update.sh
index 4cee160904..860cc6a4da 100755
--- a/contrib/libs/libc_compat/update.sh
+++ b/contrib/libs/libc_compat/update.sh
@@ -25,8 +25,8 @@ get_string_method "strcasestr.c" && sed --in-place 's/#include <string.h>/#inclu
get_string_method "memrchr.c"
get_string_method "stpcpy.c"
-mkdir -p include/windows/sys
-curl "https://raw.githubusercontent.com/openbsd/src/master/sys/sys/queue.h" --output "include/windows/sys/queue.h"
+mkdir -p include/windows/sys
+curl "https://raw.githubusercontent.com/openbsd/src/master/sys/sys/queue.h" --output "include/windows/sys/queue.h"
mkdir -p include/readpassphrase
curl "https://raw.githubusercontent.com/openbsd/src/master/include/readpassphrase.h" --output "include/readpassphrase/readpassphrase.h" && fix_decls "include/readpassphrase/readpassphrase.h"
diff --git a/contrib/libs/libc_compat/ya.make b/contrib/libs/libc_compat/ya.make
index b92184c165..76ae81f992 100644
--- a/contrib/libs/libc_compat/ya.make
+++ b/contrib/libs/libc_compat/ya.make
@@ -65,7 +65,7 @@ IF (OS_DARWIN)
)
ENDIF()
-IF (OS_WINDOWS)
+IF (OS_WINDOWS)
ADDINCL(
GLOBAL contrib/libs/libc_compat/include/windows
)
@@ -78,8 +78,8 @@ IF (OS_WINDOWS)
strsep.c
src/windows/sys/uio.c
)
-ENDIF()
-
+ENDIF()
+
IF (OS_LINUX)
ADDINCL(
GLOBAL contrib/libs/libc_compat/include/readpassphrase
diff --git a/contrib/libs/libevent/ChangeLog b/contrib/libs/libevent/ChangeLog
index 17874b14b9..180832cabe 100644
--- a/contrib/libs/libevent/ChangeLog
+++ b/contrib/libs/libevent/ChangeLog
@@ -79,1312 +79,1312 @@ Changes in version 2.1.12-stable (05 Jul 2020)
o Change the minimum version of automake to 1.13 and autoconf to 2.67 (fdb8fb66 ygj6)
o Add Uninstall.cmake.in into dist archive (877f2355 Azat Khuzhin)
-Changes in version 2.1.11-stable (01 Aug 2019)
-
- This release contains one ABI breakage fix (that had been introduced in
- 2.1.10, and strictly speaking this release breaks ABI again to make it
- compatible with 2.1.9 and less, please take a look at 18104973 for more
- details). Apart from that it contains some bug fixes, that grouped below.
-
- And even though the return value for evbuffer_setcb() had been changed it
- should ABI compatible (anyway that function is in -compat.h header).
-
- There is also one patch that introduce new functionality, this is 546a366c,
- to tune SO_RCVBUF/SO_SNDBUF in evdns, but one can count it as a bug-fix on
- the application level, since before you cannot tune this settings and hence
- you could stumble on problems.
-
- ABI breakage:
- o Protect min_heap_push_ against integer overflow. (8c899768 Tobias Stoeckmann)
- o Revert "Protect min_heap_push_ against integer overflow." (18104973 Azat Khuzhin)
-
- functionality:
- o evdns: add new options -- so-rcvbuf/so-sndbuf (546a366c Azat Khuzhin)
-
- build:
- o Change autoconf version to 2.62 and automake version to 1.11.2 (2a333008 yuangongji)
- o cmake: install shared library only if it was requested (596855f7 Azat Khuzhin)
- o Missing <winerror.h> on win7/MinGW(MINGW32_NT-6.1)/MSYS (9559349c yuangongji)
- o cmake: set library names to be the same as with autotools (305251b9 yuangongji)
- o Enable _GNU_SOURCE for Android (f013fc7d Keith Smiley)
- o Enable kqueue for APPLE targets (3aa68a82 Keith Smiley)
- o autotools: do not install bufferevent_ssl.h under --disable-openssl (5349a07e Azat Khuzhin)
- o cmake: link against shell32.lib/advapi32.lib (c9ce638c Azat Khuzhin)
- o Add README.md into dist archive (3660a4cc Azat Khuzhin)
- o cmake: add missing autotools targets (doxygen, uninstall, event_rpcgen.py) (2d65071c yuangongji)
- o m4/libevent_openssl.m4: fix detection of openssl (d4056e59 Fabrice Fontaine)
- o Fix detection of the __has_attribute() for apple clang [ci skip] (7fd7c5ef Azat Khuzhin)
-
- lib:
- o buffer: fix possible NULL dereference in evbuffer_setcb() on ENOMEM (598f247d Azat Khuzhin)
- o Warn if forked from the event loop during event_reinit() (b75922ae Azat Khuzhin)
- o evutil: set the have_checked_interfaces in evutil_check_interfaces()
- (ef498aa2, a09265ac jeremyerb)
-
- samples:
- o https-client: correction error checking (a8a04565 wenyg)
-
-
-Changes in version 2.1.10-stable (26 May 2019)
-
- This release contains mostly fixes (some evbuffer oddity, AF_UNIX handling in
- http server, some UB fixes and others) but also some new functionality
- (without ABI breakage as usual) and now dist archive can be used for building
- on windows (getopt had been added into it).
-
- Above you will find changelog for this particular release (but with some
- trivial fixes pruned out from it - to make it a little bit more informative).
-
- To view full changelog please use git:
- git log --format=' o %s (%h %aN)' release-2.1.9-beta...release-2.1.10-stable
-
- dist:
- o Add getopt into dist archive (7042ff24 Azat Khuzhin)
-
- functionality:
- o evdns: add DNS_OPTION_NAMESERVERS_NO_DEFAULT/EVDNS_BASE_NAMESERVERS_NO_DEFAULT
- (58e81106 Azat Khuzhin)
- o Add support for EV_TIMEOUT to event_base_active_by_fd (3f893f0a John Ohl)
-
- fixes:
- o Merge branch 'evbuffer-fixes-806-v2' (2fea04b3 Azat Khuzhin)
- o Merge branch 'issue-807-accept4-getnameinfo-AF_UNIX' (7c4da937, e2790a7f
- Azat Khuzhin)
- o kqueue: Avoid undefined behaviour. (e70e18e9 Tobias Stoeckmann)
- o Prevent integer overflow in kq_build_changes_list. (43a55a23 Tobias Stoeckmann)
- o evdns: fix lock/unlock mismatch in evdns_close_server_port() (54103883 zhuizhuhaomeng)
- o Merge remote-tracking branch 'official/pr/804' -- Enforce limit of NSIG
- signals (87fa93a8 Tobias Stoeckmann)
- o Protect min_heap_push_ against integer overflow. (0b46bb8c Tobias Stoeckmann)
- o le-proxy: initiate use of the Winsock DLL (2a1e1530 linxiaohui)
- o Fix leaks in error path of the bufferevent_init_common_() (bb0f8fe7 Azat Khuzhin)
- o buffer: make evbuffer_prepend() of zero-length array no-op (61fa7b7d Azat Khuzhin)
- o Merge branch 'evbuffer-empty-chain-handling' (6a3dd717 Azat Khuzhin)
- o Don't loose top error in SSL (3d1a7a1d Yury Korzhetsky)
- o Remove needless check for arc4_seeded_ok (6602a97d Seong-Joong Kim)
- o Merge pull request #769 from sungjungk/fix-return-handling (91084140 Nathan French)
-
- build:
- o Define `_GNU_SOURCE` properly/consistently per autoconf (00ba9fa2 Enji Cooper)
- o signal: guard __cdecl definition with #ifdef (d89045a6 Azat Khuzhin)
- o Link test/regress with event_core/event_extra over event (22380996 Azat Khuzhin)
-
- tests:
- o Use kill() over raise() for raising the signal (fixes osx 10.14 with
- kqueue) (3db5296b, a45f6733 Azat Khuzhin)
- o tinytest: implement per-test timeout (via alarm() under !win32 only)
- (b64dbfb6, 75d7e1ff Azat Khuzhin)
-
-Changes in version 2.1.9-beta (10 February 2019)
-
- This changelog will differs from other releases in the next few clauses:
- - contains only highlighted changes (so now it will not contains a lot of
- patches that fixes some stuff in regression tests, typos, leaks fixes in
- samples and so forth)
- - no authors (since merge commits breaks them anyway, but AUTHORS sections in
- README will be kept up to date)
- - group name trimmed from commit subjects trimmed
- - it's been 2 years since the previoius release, so it is pretty huge
-
- And I think that this is more useful, so from now on it will always has the
- same look (until there will too many objections of course).
-
- To view full changelog please use git:
- git log --format=' o %s (%h %aN)' release-2.1.8-stable...release-2.1.9-beta
-
-
- dist archive:
- o Add cmake rules into dist archive (bf3a67cf)
- o Add missing print-winsock-errors.c into dist archive (822d6462)
- o Include openssl-compat.h into dist archive (08658136)
-
- core:
- o Merge branch 'check-O_NONBLOCK-in-debug' (a39898f3, a8155c62)
- o Merge branch 'event-ET-#636-v2' (ca4b6404)
- o Fix visibility issues under (mostly on win32)
- (349081e1g, 802be13ag, a1f28e2f)
- o Define __EXT_POSIX2 for QNX (a2176f2c)
- o Cleanup __func__ detection (b3af7bdd)
- o Add convenience macros for user-triggered events (06ec5de6)
- o Notify event base if there are no more events, so it can exit without delay (d9d1c09e)
- o Fix base unlocking in event_del() if event_base_set() runned in another thread (4f0f40e3)
- o If precise_time is false, we should not set EVENT_BASE_FLAG_PRECISE_TIMER (27dee54d)
- o Fix race in access to ev_res from event loop with event_active() (43d92a6d)
- o Return from event_del() after the last event callback termination (876c7ac7)
-
- http:
- o Merge branch 'http-EVHTTP_CON_READ_ON_WRITE_ERROR-fixes-v2' (eb7b472b)
- o Preserve socket error from listen across closesocket cleanup (2ccd00a6)
- o fix connection retries when there more then one request for connection (d30e7bba)
- o improve error path for bufferevent_{setfd,enable,disable}() (a8cc449e)
- o Fix conceivable UAF of the bufferevent in evhttp_connection_free() (6ac2ec25)
- o Merge branch 'http-request-line-parsing' (cdcfbafe)
- o Fix evhttp_connection_get_addr() fox incomming http connections (4215c003)
- o fix leaks in evhttp_uriencode() (123362e9)
- o CONNECT method only takes an authority (7d1ffe64)
- o Allow bodies for GET/DELETE/OPTIONS/CONNECT (23eb38b9)
- o Do not crash when evhttp_send_reply_start() is called after a timeout. (826f1134)
- o Fix crashing http server when callback do not reply in place (5b40744d, b2581380)
- o fix handling of close_notify (ssl) in http with openssl bufferevents (7e91622b)
-
- evrpc:
- o use *_new_with_arg() to match function prototype (a95cc9e3)
- o avoid NULL dereference on request is not EVHTTP_REQ_POST (e05136c7)
-
- regression tests:
- o Merge branch 'TT_RETRIABLE' (6ea1ec68, f9b592aa)
-
- bufferevent:
- o Merge branch 'iocp-fixes' (6bfac964)
- o Merge branch 'be-wm-overrun-v2' (3f692fff)
- o bufferevent_socket_connect{,_hostname}() missing event callback and use ret code (1dde74ef)
- o don't fail be_null_filter if bytes are copied (b92b0792)
- o Call underlying bev ctrl GET_FD on filtered bufferevents (ebfac517)
-
- bufferevent_openssl/openssl:
- o Merge branch 'ssl_bufferevent_wm_filter-fix' (30020a35)
- o be_openssl: avoid leaking of SSL structure (e86ccfe5)
- o Fix build with LibreSSL 2.7 (894ca48a)
- o Add missing includes into openssl-compat.h (01bc36c1)
- o Explicitly call SSL_clear when reseting the fd. (29b7a516)
- o Unbreak build with LibreSSL after openssl 1.1 support added (230af9f0)
-
- samples:
- o Merge branch 'sample-http-server' (b6309bcc)
- o sample/https-client: use host SSL certificate store by default (5c0132f3)
-
- listener:
- o ipv6only socket bind support (ba148796)
- o Merge branch 'listener-immediate-close' (df2ed13f)
- o Merge branch 'evconnlistener-do-not-close-client-fd' (42e851bb)
-
- evdns:
- o evdns: handle NULL filename explicitly (0033f5cc)
- o Merge branch 'evdns_getaddrinfo-race-fix' (3237d697)
- o Generating evdns_base_config_windows_nameservers docs on all platforms (3bd2ce43)
-
- utils:
- o Merge branch 'evutil_found_ifaddr-dev' (b07e43e6)
- o Avoid possible SEGVs in select() (in unit tests) (8818c86c)
- o Port `event_rpcgen.py` and `test/check-dumpevents.py` to Python 3. (532a8cc3)
-
- buffer:
- o Fix assert() condition in evbuffer_drain() for IOCP (d6326104)
- o fix incorrect unlock of the buffer mutex (for deferred callbacks) (2b4d127d)
- o Fix wrong assert in evbuffer_drain() (9f4d0dce)
-
- cmake:
- o fix checking of devpoll backend (like in autotools, by devpoll.h existence) (7f161902)
- o support static runtime (MSVC) (c8b3ec17, 61fb055a)
- o do not build both (SHARED and STATIC) for MSVC/win32 (bc7f2fd9)
- o introduce EVENT__LIBRARY_TYPE option (eb10a738)
- o ensure windows dll's are installed as well as lib files (29590718)
- o Fix generation of LibeventConfig.cmake for the installation tree (7fa08c4b)
- o fix pkgconfig generation (copy-paste typo) (cc554d87)
- o Merge branch 'cmake-missing-bits' (9806b126)
- o Fix detection of timerfd_create() in CMake. (e50af331)
- o Merge branch 'cmake-configure-fixes-v2' (a0bfe2c4)
- o Do not add epoll_sub (syscall wrappers) for epoll in cmake (cea61de6)
- o Fix RPATH for APPLE (45b1f379)
-
- autotools:
- o include win32 specific headers for socklen_t detection on win32/mingw (d7579fb9)
- o Ignore evconfig-private.h for autotools (37423849)
- o config.h can't be prefixed unconditionally (63a054f8)
- o Merge branch 'pull-628' (7e56c8b2)
- o Provide Makefile variables LIBEVENT_{CFLAGS,CPPFLAGS,LDFLAGS} (2f060c5f)
- o confirm openssl is working before using (b39ccf8e)
- o pass $(OPENSSL_INCS) for samples (FTBFS macOS) (c2495265)
- o Add configure check for midipix (d433201e)
- o Fix tests with detached builds (c46ff439)
-
- build:
- o Fix arc4random_addrandom() detecting and fallback (regression) (303d6d77)
- o Merge branch 'win32-fixes' (ebd12e6d)
- o Merge branch 'fix-openssl-linking' (e7bd9e03)
- o Merge branch 'fix-struct-linger' (8567f2f5)
-
- CI:
- o travis-ci/appveyor now uses fast_finish+allow_failures
- (5e97b6e6, dd472e7d, dfb5fc167)
- o Merge branch 'travis-ci-osx-fixes' (9f02b39c)
- o Merge branch 'win64-fixes' (aee0fcd5)
-
-
-Changes in version 2.1.8-stable (22 January 2017)
-
- Libevent 2.1.8-stable, it contains openssl fixes for resetting fd and using
- bufferevent_openssl_filter_new(). vagrant fixes, some build fixes, increased
- timeout for some tests (to reduce number of failures due to timing issues),
- date in RFC1123 format and running tests in parallel.
-
- There are highlighted changes above.
-
- Build fixes:
- o Fix _FILE_OFFSET_BITS redinition (solaris/autotools) (336f3b11 Azat Khuzhin)
- o util-internal: fix __func__ redefinition (netbsd) (253e7fa9 Azat Khuzhin)
- o Fix signedness differ for iov_base (solaris) (2c62062e Azat Khuzhin)
- o evutil_time: include <unistd.h> when there is only sleep()/usleep() (3e75194c Azat Khuzhin)
- o http: fix formatter for pritnf for req->ntoread (osx) (1cbf26f6 Azat Khuzhin)
- Testing environment:
- o Merge branch 'automake-tests-parallel-v4' (*includes ci bits also*) (59e217df Azat Khuzhin)
- Vagrant env fixes:
- o vagrant/netbsd: missing libtool (9c9be399 Azat Khuzhin)
- o vagrant/netbsd: more reliable way of installing packages (36da6877 Azat Khuzhin)
- o vagrant/osx: use make instead of gmake (there is no gmake) (f7c70aef Azat Khuzhin)
- o vagrant: add centos box (ca591c5b Azat Khuzhin)
- Tests:
- o test/dns: replace servname since solaris does not have "http" (d6bafbbe Azat Khuzhin)
- o test/thread: netbsd is too slow, increase timeout for conditions_simple (3c7422fc Azat Khuzhin)
- o test/dns: run async resolving after sync one (to avoid timeouts) (07862531 Azat Khuzhin)
- o test/http: turn off some tests that based on backlog filling (falky) (26f416c1 Azat Khuzhin)
- Bugfixes:
- o Merge branch 'openssl-filter-fixes-v4' (83e0f43b Azat Khuzhin)
- o Merge branch 'date-rfc1123' (68def435,4798de6c,4545807d Azat Khuzhin)
- o Merge branch 'be-openssl-fd-reset-fix-v2' (86fa0070,32adf434 Azat Khuzhin)
- o Merge branch 'openssl-1.1-init-fixes-v2' (18a161f0 Azat Khuzhin)
- o Fix incorrect MIME type (23f9a20e johnsonlee)
- Trivial fixes:
- Documentation updates:
- o Update README.md (3821cca1 Breaker)
-
-
-Changes in version 2.1.7-rc (2 Novemer 2016)
-
- Libevent 2.1.7-rc contains openssl 1.1 support, build fixes, CI improvements
- and plus Vagrantfile for testing under multiple OS'es.
-
-
- Continious Integration:
- o Use coveralls.io via travis (9ac000c Azat Khuzhin)
- o travis-ci: use container-based infrastructure (7e12e96 Azat Khuzhin)
- o travis-ci/osx: fix compiling/linking openssl libraries (9d2f8d4 Azat Khuzhin)
- o travis-ci: use gcc-5 (fixes osx|gcc failures) (d7ceae5 Azat Khuzhin)
- o Testing with vagrant for 6 OS and cmake+autoconf (9585338 Azat Khuzhin)
- o travis-ci/osx: install lcov (e4e099b Azat Khuzhin)
-
- Build Improvements/Fixes:
- o Fix cmake -DEVENT__COVERAGE=ON (40fbffc Azat Khuzhin)
- o autogen.sh: learn about gmake (9376ac4 Azat Khuzhin)
- o autogen.sh: remove all autoconf/automake caches, if any (69cce25 Azat Khuzhin)
- o cmake: fix finding python2, and check that it is really 2 (3453c08 Azat Khuzhin)
- o cmake: fix CheckFunctionExistsEx/CheckPrototypeDefinition (CMP0054) (43b69b2 Azat Khuzhin)
- o cmake: cleanup (dc624ad Zonr Chang)
- o cmake/win32: fix running regress, but fixing finding python2 interpreter (bcb990a Azat Khuzhin)
- o cmake: use PYTHON_EXECUTABLE to find python2 (a4d044c Azat Khuzhin)
- o Merge branch 'force-disable-clockgettime' (83c7cdf Azat Khuzhin)
-
- Code Improvements (core)
- o use ev_uint16_t instead of unsigned short for port (e983712 Thomas Bernard)
- o Merge branch 'contrib-guide-v2' (b9c5077 Azat Khuzhin)
- o poll: Prevent libevent from spinning if POLLNVAL occurs (675974c Tim Hentenaar)
-
- Testing:
- o test/regress: cover a polling of invalid fd (cb0df5c Tim Hentenaar)
-
- Code Improvements (bufferevent_openssl)
- o Make it build using OpenSSL 1.1.0 (3e9e0a0 Kurt Roeckx)
- o Don't call BIO_number_{read|written} on NULL BIOs. (6702da1 Adam Langley)
- o Switch from a 512 to 2048-bit RSA key. (f9803a6 Adam Langley)
-
- Trivial fixes:
- o Ignore temporary configure files (8fb08ae Azat Khuzhin)
- o README.md: fix typo: ar -> are (2361616 Simone Basso)
- o be: just a simple mistake, reinclude the <errno.h> (7521664 Seven)
-
-Changes in version 2.1.6-beta (4 July 2016)
-
- Libevent 2.1.6-beta contains mostly bug fixes (evbuffers, evthread, evdns,
- bufferevents, core, http, samples), improvements but mostly to fix some
- possible issues (EVHTTP_CON_LINGERING_CLOSE), a lot of new unit tests and new
- appveyor integration.
-
- Security Fixes (utils)
- o evutil_parse_sockaddr_port(): fix buffer overflow (329acc1 Azat Khuzhin)
-
- Security Fixes (evdns)
- o evdns: name_parse(): fix remote stack overread (96f64a0 Azat Khuzhin)
- o evdns: fix searching empty hostnames (ec65c42 Azat Khuzhin)
-
- New APIs (evdns)
- o New function to get address for nameserver. (537177d Nick Mathewson)
-
- New APIs (bufferevents)
- o expose bufferevent_incref/decref (with fewer modifications) (1ed6718 Mark Ellzey)
-
- New APIs (internal)
- o evdns: export cancel via callbacks in util (like async lib core/extra issues) (8cbe65d Azat Khuzhin)
-
- New APIs/Improvements (http)
- o http: take EVHTTP_CON_LINGERING_CLOSE into account for "Expect: 100-Continue" (ac448a7 Azat Khuzhin)
- o http: lingering close (like nginx have) for entity-too-large (9fde518 Azat Khuzhin)
- o http: read server response even after server closed the connection (680742e Azat Khuzhin)
- o http: export evhttp_connection_set_family() (714fc70 Azat Khuzhin)
- o http: reuse connected address only with EVHTTP_CON_REUSE_CONNECTED_ADDR (a50f5f0 Azat Khuzhin)
- o http: use IP address that we got before (if any) during retrying (54c887d Azat Khuzhin)
-
- Bugfixes (core)
- o Fix getaddrinfo under solaris (for multiprotocol case) (40730ae Azat Khuzhin)
- o Check for Mac OS X 10.4 kqueue bug properly (df6f99e Mark Mentovai)
- o event_reinit: make signals works after fork() without evsig_add() (88640aa Nicholas Marriott)
- o event_reinit: always re-init signal's socketpair (ad0c237 Nicholas Marriott)
- o Free event queues even for recursive finalizers (7c8d015 Azat Khuzhin)
- o Fix checking for make_base_notifiable() (f337296 Azat Khuzhin)
- o Set correct socklen for PF_INET6 sockaddr len (3499ad9 Mark Ellzey)
- o Fix garbage value in socketpair util function, stdint? (043ae74 Mark Ellzey)
- o fix the return value of event_deferred_cb_schedule_ (38cef64 Greg Hazel)
- o event_free_debug_globals_locks(): disable lock debugging (e5c87d1 Azat Khuzhin)
- o event: call event_disable_debug_mode() in libevent_global_shutdown() (941faae Azat Khuzhin)
- o ht-internal: don't reset hth_table_length explicitly in name_##HT_CLEAR (597c7b2 Azat Khuzhin)
-
- Bugfixes (evthread)
- o evthread: fix evthread_setup_global_lock_() for debug-lock with a real-lock case (e4556fc Azat Khuzhin)
- o evthread: evthreadimpl_disable_lock_debugging_() for libevent_global_shutdown() (ccc5593 Azat Khuzhin)
-
- Bugfixes (evdns)
- o evdns: avoid double-free in evdns_base_free() for probing requests (4db15e0 Azat Khuzhin)
- o evdns: evdns_base_free(): fix UAF of evdns_base with @fail_requests (00313c5 Azat Khuzhin)
- o evdns: evdns_base_free(): free requests before namservers (14f84bb Azat Khuzhin)
- o evdns: fix randomize-case by make case-insensitive as required (9c238de Azat Khuzhin)
-
- Bugfixes (bufferevents)
- o be_sock: handle readv() returns ECONNREFUSED (freebsd 9.2) (3189eb0 Azat Khuzhin)
- o be_filter: avoid data stuck under active watermarks (b627ad8 Eduardo Panisset)
- o Fix bufferevent_pair to properly set BEV_EVENT_{READING,WRITING} on flush. (2851889 David Paschich)
- o be_openssl: clear all pending errors before SSL_*() calls (38e0f4a Azat Khuzhin)
- o be_sock: cancel in-progress dns requests (86dfd2c Azat Khuzhin)
- o be_sock: unfreeze buffers on fd changing (255525d Azat Khuzhin)
- o be_sock: bufferevent_socket_connect_hostname(): make it thread-safe (809bb39 Azat Khuzhin)
- o be_openssl: don't call do_write() directly from outbuf_cb (da52933 Azat Khuzhin)
- o be_openssl: use bufferevent_enable() instead of bufferevent_add_event_() (0c66d32 Azat Khuzhin)
- o be_openssl: don't add events during bev creation (like be_sock) (f4b6284 Azat Khuzhin)
- o Fix lock leak in be_pair_flush() if flush type is BEV_NORMAL (f45d39d Bill Vaughan)
- o be_openssl: don't use *_auto() in do_handshake() we can't have fd == -1 there (877280d Azat Khuzhin)
- o be_openssl: don't call set_open_callbacks() if fd == -1 (e8a2da9 Azat Khuzhin)
- o be_openssl: get rid off hackish "fd_is_set", to fix some corner cases (40b0379 Azat Khuzhin)
- o be: we don't need to use getpeername() we we have conn_address (2c271e2 Azat Khuzhin)
- o Call underlying bev ctrl SET_FD on filtered bufferevents (c2aa7dc Mark Ellzey)
- o be_pair: release shared lock with the latest of bufferevent_pair (92a359e Azat Khuzhin)
-
- Bugfixes (http)
- o [Issue #313] set method to ASCII "NULL" if evhttp_method() returns NULL (17cc636 Mark Ellzey)
- o evhttp_have_expect(): fix -Wlogical-not-parentheses (24b5214 Azat Khuzhin)
- o http: set fd to -1 unconditioally, to avoid leaking of DNS requests (7a4b472 Azat Khuzhin)
- o http: avoid leaking of fd in evhttp_connection_free() (f0e1341 Azat Khuzhin)
- o http: get fd from be layer during connection reset (4a53c54 Azat Khuzhin)
- o http: fix EVHTTP_CON_READ_ON_WRITE_ERROR when it doesn't supported by OS (2ff164a Azat Khuzhin)
- o http: do not do function calls under EVUTIL_ASSERT() to fix NDEBUG builds (7c89999 Azat Khuzhin)
- o http: fix leaking of response_code_line (8f18a62 Azat Khuzhin)
- o http: fix "Expect: 100-continue" client side (0b46b39 Azat Khuzhin)
- o http: fix conflicts EVHTTP_CON_AUTOFREE and EVHTTP_CON_REUSE_CONNECTED_ADDR (4dc0979 Azat Khuzhin)
- o http: avoid epoll_ctl() on already closed fd (triggers by http/chunk_out) (ab3bc69 Azat Khuzhin)
- o http: install timeout for read too during connect for ssl (040000d Azat Khuzhin)
- o http: fix evhttp_request_own() by checking EVHTTP_USER_OWNED in more cases (b0d3964 Azat Khuzhin)
- o http: fix detecting EOF without write (7ed02ac Azat Khuzhin)
- o evhttp: Fix failure to send all output data for POST/PUT requests (24eea0d John Ohl)
- o Fix evhttp_uriencode() regression. (c6b1ec1 Mark Ellzey)
- o removed unused vars (e94250c Mark Ellzey)
- o pointer overflow checks for evhttp_uriencode (72afe4c Zonr Chang)
-
- Bugfixes (evbuffers)
- o buffer: fix overflow check in evbuffer_expand_singlechain() (a3f4ccd Azat Khuzhin)
- o buffer: evbuffer_add_buffer(): clean empty chains from destination buffer (26fd932 Azat Khuzhin)
- o Fix n_add_for_cb in evbuffer_prepend() in case of new buffer required (0abd039 Azat Khuzhin)
- o be_filter: actually disable output_filter during processing output (c031215 Simon Perreault)
- o evbuffer_add: Use last_with_datap if set, not last. (a8769ef Marcus Sundberg)
- o EVBUFFER_PTR_SET -> EVBUFFER_PTR_ADD (8674e4f jer-gentoo)
-
- Bugfixes (evconnlistener)
- o listener: unlock lev on error in listener_read_cb() (2a71b33 Azat Khuzhin)
- o Fix potential fd leak in listener_read_cb() (a695a72 Mark Ellzey)
-
- Testing
- o tests: use waitpid(..., WNOWAIT) to fix failing of main/fork under solaris (43eb56c Azat Khuzhin)
- o test: replace sleeping with syncing pair in main/fork (16d220c Azat Khuzhin)
- o test/http: do not run tests that based on backlog filling (freebsd) (500b6b7 Azat Khuzhin)
- o test/bufferevent/iocp: fix test name for "bufferevent_connect_fail_eventcb" (4410e9d Azat Khuzhin)
- o test/ssl: use send()/recv()/EVUTIL_ERR_RW_RETRIABLE()/EVUTIL_SOCKET_ERROR() to fix win32 (a9e8cd6 Azat Khuzhin)
- o test/https_basic: increase timeout for complete write (fixes win32) (d5a2f2f Azat Khuzhin)
- o test: fix building with --disable-thread-support under win32 (a487706 Azat Khuzhin)
- o test/buffer: evbuffer_add_buffer() with empty chains (a272bc4 Azat Khuzhin)
- o test/buffer: evbuffer_remove_buffer() with empty chains (prepend) (f0cfa14 Azat Khuzhin)
- o test/buffer: evbuffer_remove_buffer() with empty chains (evbuffer_add_buffer()) (2880ce6 Azat Khuzhin)
- o test/buffer: cover evbuffer_expand() for overflow (48dab7a Azat Khuzhin)
- o test/be_filter: creating test case for data stuck with active watermarks (766194b Eduardo Panisset)
- o test/http: avoid using conditionals with omitted operands (fixes VS2015) (2a4bf29 Azat Khuzhin)
- o test/http: don't mix declarations and code (fixes -Wdeclaration-after-statement) (aabf1c2 Azat Khuzhin)
- o test/buffer: fix leak in test_evbuffer_prepend() (c08d90b Azat Khuzhin)
- o test/buffer: avoid errors with --no-fork (reinitialize static vars) (e7d1e39 Azat Khuzhin)
- o test/buffer: cover n_add_for_cb when evbuffer_prepend() need to allocate buffer (e77ff41 Azat Khuzhin)
- o test/tinytest_macros: add new one tt_nstr_op() (bd19a28 Azat Khuzhin)
- o test/bufferevent: check that output_filter disabled during processing output (ae28812 Azat Khuzhin)
- o test/listener: regression for missing unlock in listener_read_cb() (7d85651 Azat Khuzhin)
- o test/regress: add tests for evbuffer_add() breakage on empty last chain (d5ee739 Marcus Sundberg)
- o test/http: fix running some tests sequential (with --no-fork) (bddad71 Azat Khuzhin)
- o test/http: localize evhttp server structure (cbc3209 Azat Khuzhin)
- o test/dns: regression for empty hostname (d7348ba Azat Khuzhin)
- o test/http: fix SERVER_TIMEOUT tests under win32 (d49a658 Azat Khuzhin)
- o test/http: add a helper for creating timedout/failed request (376f107 Azat Khuzhin)
- o test/http: adopt for C90 (mixed code and declarations) (d02a285 Azat Khuzhin)
- o test/http: cover NS timed out during request cancellations separatelly (0c343af Azat Khuzhin)
- o test/http: request cancellation with resolving/{conn,write}-timeouts in progress (334340d Azat Khuzhin)
- o test/http: exit from the loop in the errorcb to wait cancellation (927ab33 Azat Khuzhin)
- o regress_clean_dnsserver(): reset global port vars (351207f Azat Khuzhin)
- o test/http: read_on_write_error: fix it for win32 (3b58169 Azat Khuzhin)
- o test/http: separate coverage for EVHTTP_CON_READ_ON_WRITE_ERROR (5c2b4c1 Azat Khuzhin)
- o test/http: cover "Expect: 100-continue" client-server interaction (31d8116 Azat Khuzhin)
- o test/http: *lingering tests shouldn't have "Expect: 100-continue" (ed469ab Azat Khuzhin)
- o test: use EVUTIL_SHUT_WR (04fc82f Azat Khuzhin)
- o test/http: avoid huge stack allocations to fix win32 builds (3166765 Azat Khuzhin)
- o test: http/lingering_close: cover EVHTTP_SERVER_LINGERING_CLOSE (e122ca1 Azat Khuzhin)
- o test: http/non_lingering_close: cover ~EVHTTP_SERVER_LINGERING_CLOSE (f41e1b0 Azat Khuzhin)
- o test: http/*: update expected HTTP codes for body exceeds `max_body_size` (addf2b9 Azat Khuzhin)
- o test: http/data_length_constrains: set EVHTTP_CON_READ_ON_WRITE_ERROR (d38a723 Azat Khuzhin)
- o test: increase buffer size for http/data_length_constraints to trigger EPIPE (0792e1e Azat Khuzhin)
- o test/tinytest_demo: include <windows.h> for win32 to fix tdm-gcc (f062bbe Azat Khuzhin)
- o test/regress: cover event_del() waiting mechanism (5b58b70 Azat Khuzhin)
- o test/regress: cover existing signal callbacks and fork() + event_reinit() (ceddc60 Azat Khuzhin)
- o test/regress: cover signals after fork() + event_reinit() (b075b81 Azat Khuzhin)
- o test/regress: main/fork: rewrite assertions by just removing event in callback (088d8b3 Azat Khuzhin)
- o test/dns: check exit code of evdns_getaddrinfo() (0b9d432 Azat Khuzhin)
- o test/dns: cover evdns_getaddrinfo() and evdns_base_free() with @fail_requests (4ad3483 Azat Khuzhin)
- o test/dns: cover @fail_requests for evdns_base_free() (d6c6fb4 Azat Khuzhin)
- o test/dns: more graceful coverage of @fail_requests (123d372 Azat Khuzhin)
- o test/ssl: cover busy-loop (i.e. {read,write}-blocked-on-{write,read} stuff) (da0ea7a Azat Khuzhin)
- o test/http: write_during_read for https (23c77b6 Azat Khuzhin)
- o test/http: connection_fail for https (7ea26f7 Azat Khuzhin)
- o test/http: stream_out for https (ac04968 Azat Khuzhin)
- o test/http: chunk_out for https (a71ffb9 Azat Khuzhin)
- o test/regress: fix ssl-less builds (need to make this prettier) (3160716 Azat Khuzhin)
- o test/http: allow dirty shutdown for ssl to fix https_incomplete (1ede326 Azat Khuzhin)
- o test/http: https basic (59714b4 Azat Khuzhin)
- o test/http: incomplete{,_timeout} for https (615490d Azat Khuzhin)
- o test/http: add simplest test for http/https/https_dirty_shutdown (93b19dc Azat Khuzhin)
- o test/http: https: retry coverage (7c2d24a Azat Khuzhin)
- o test/http: https server support (plus some helpers) (a7088ad Azat Khuzhin)
- o test/http: more sanity checks (a27c53c Azat Khuzhin)
- o test/ssl: export getkey()/getcert()/get_ssl_ctx()/init_ssl() for https (0c4c387 Azat Khuzhin)
- o test/regress_be: basic coverage bufferevent_flush() for pair/sock layers (ad52602 Azat Khuzhin)
- o test/regress_be: socket_filter_inactive: check bufferevent after creation (f8081af Azat Khuzhin)
- o test/regress_be: cover finalizers from inactive to active queue (337684b Azat Khuzhin)
- o test/regress_buffer: fix clang compilation warnings (d8fd4c0 Azat Khuzhin)
- o test/regress_http: fix compilation warnings (-Wmissing-field-initializers) (cd422e0 Azat Khuzhin)
- o test/regress_dns: fix compilation warnings (-Wmissing-field-initializers/for) (f55db98 Azat Khuzhin)
- o tests/regress_dns: cover that randomize-case works case-insensitive (1e8bfbc Azat Khuzhin)
- o test: fix bufferevent/bufferevent_pair_release_lock in debug mode (3f749e9 Azat Khuzhin)
- o test: fix bufferevent/bufferevent_pair_release_lock for freebsd (79f9ace Azat Khuzhin)
- o test/regress_be: bufferevent_enable() shouldn't call eventcb by it's own (a0f308d Azat Khuzhin)
- o test/regress_be: introduce fake_listener_create() (37dc9e0 Azat Khuzhin)
- o test/regress_http: cover evhttp_request_own() (6f6fa0d Azat Khuzhin)
- o test/regress_http: cover write during read (3d15aeb Azat Khuzhin)
- o test/regress_http: verify that closecb will be called without multiple write (4be6c70 Azat Khuzhin)
- o test/regress: fix bufferevent_pair_release_lock with EVENT_DEBUG_MODE (6ea6655 Azat Khuzhin)
- o test/regress_ssl: check events fd/pending after timeout triggered (cdafdf0 Azat Khuzhin)
- o test/regress_ssl: cover case when server didn't up (failed with timeout) (74845f1 Azat Khuzhin)
- o test/regress_ssl: covert that we can't change fd with underlying (df507af Azat Khuzhin)
- o test/regress_ssl: cover that events (read/write) at finish not pending (762edb4 Azat Khuzhin)
- o test/regress_ssl: cover fd manipulations (b78a829 Azat Khuzhin)
- o test/regress_ssl: convert open_ssl_bufevs() to mask (46bba73 Azat Khuzhin)
- o test/regress_ssl: convert client/server to mask too (3455991 Azat Khuzhin)
- o test/regress_ssl: cover "allow_dirty_shutdown" (0430327 Azat Khuzhin)
- o test/regress_ssl: convert regress_bufferevent_openssl() to bitmask (342e116 Azat Khuzhin)
- o tests/regress_ssl: drop duplicated assert (25e56fd Azat Khuzhin)
- o test/regress_http: initialize "dns_base" to avoid reading trash (9f0bff3 Azat Khuzhin)
- o test/http: cover retrying with saved conn_address by shutting down dns server (f4874d8 Azat Khuzhin)
- o be_pair/regress: cover use of shared lock (lock/unlock/free) (a558fcd Azat Khuzhin)
- o regress_dns: drop hack for event_debug_map_HT_GROW in leak tests (3540a19 Azat Khuzhin)
-
- Sample code
- o Fix memory leak in signal-test.c (666db91 basavesh.as)
- o sample/hello-world: exAmple, not eXMple (2d3cd35 kirillDanshin)
- o dns-example: allow to set ns from args (df19a97 Azat Khuzhin)
- o dns-example: convert to getopt() (32f8592 Azat Khuzhin)
- o http-connect: make it win32 compilable (1bf7595 Azat Khuzhin)
- o sample/https-client: allow to change path to ca-certificates (fdf713a Azat Khuzhin)
- o sample/https-client: check for ERR_remove_thread_state() existence (c4e9d9b Azat Khuzhin)
- o sample/https-client: replace ERR_remove_state() by ERR_remove_thread_state() (77ad68a Azat Khuzhin)
- o sample/https-client: add -timeout option (4637aa8 Azat Khuzhin)
- o sample/https-client: don't try to free uninitialized SSL (f3d7ff5 Azat Khuzhin)
- o sample/https-client: graceful exit with freeing memory (to make valgrind happy) (24a1f25 Azat Khuzhin)
- o https-client: correctly handle URLs with no path (like "https://host:port") (29a0482 Andrey Skriabin)
- o sample/http-connect: don't use assert() to make it work with NDEBUG (6dc71e7 Azat Khuzhin)
- o sample/http-connect: made it compatible with C90 (f976d43 Azat Khuzhin)
- o sample: add HTTP CONNECT tunnelling example using libevent http layer (1d34498 Azat Khuzhin)
- o Update dns-example. (620ff24 Mark Ellzey)
-
- Documentation
- o Update README.md (b8ec70c Mark Ellzey)
- o Update README.md (80faee9 Mark Ellzey)
- o Update README.md (ad4a897 Mark Ellzey)
- o Update README.md (a2b2e1e Mark Ellzey)
- o Update README.md (0dfa5dc Mark Ellzey)
-
- Code Improvements (evthread)
- o evthread: add evthread_get_{lock,condition}_callbacks() helpers (c0b34f6 Azat Khuzhin)
-
- Code Improvements (core)
- o util: make @sa const for evutil_socket_connect_() (a8d32c2 Azat Khuzhin)
-
- Code Improvements (http)
- o http: assert's that evbuffer_drain() success on connection reset (2185e63 Azat Khuzhin)
- o http: introduce evhttp_request_free_() helper (22061ac Azat Khuzhin)
- o http: introduce evhttp_is_request_connection_close() helper (6540da3 Azat Khuzhin)
-
- Code Improvements (bufferevents)
- o be_sock: bufferevent_socket_set_conn_address(): assert instead of silent no-op (0ab88c2 Azat Khuzhin)
- o be_sock: sanity check in bufferevent_socket_set_conn_address() (eedbeff Azat Khuzhin)
- o be: replace sockaddr_storage with sockaddr_in6 for conn_address (3889612 Azat Khuzhin)
- o be: replace conn_address by full struct instead of pointer (e5615aa Azat Khuzhin)
- o bufferevent: move conn_address out from http into bufferevent (8bb3842 Azat Khuzhin)
- o be: make @sa const for bufferevent_socket_connect() (dc33c78 Azat Khuzhin)
-
- Cleanups (core)
- o Refactoring conditional directives that break parts of statements. (4b41eeb lzmths)
- o epoll: introduce PRINT_CHANGES() macro to avoid copy-pasting (a1b142b Azat Khuzhin)
- o tab (6e7a580 Greg Hazel)
-
- Cleanups (evbuffers)
- o buffer_compat: fix comment -- we have EVBUFFER_EOL_ANY not EOL_STYLE_ANY (575ff67 Azat Khuzhin)
-
- Cleanups (bufferevents)
- o be_sock: evutil_getaddrinfo_async_() always return 0 (dbff101 Azat Khuzhin)
- o be_sock: drop be_sock_add() macro (useless and debug unfriendly) (fad5fe2 Azat Khuzhin)
- o be: introduce bufferevent_generic_adj_existing_timeouts_() (3c1f58f Azat Khuzhin)
- o be: add_event: use evutil_timerisset() (a96b73b Azat Khuzhin)
- o be_openssl: introduce be_openssl_auto_fd() helper (2a8a711 Azat Khuzhin)
- o be_openssl: introduce set_open_callbacks_auto() (510da71 Azat Khuzhin)
-
- Cleanups (http)
- o http: make fallback for EVHTTP_CON_READ_ON_WRITE_ERROR more cleaner (d405492 Azat Khuzhin)
- o http: coding style issue (365f181 Azat Khuzhin)
-
- Cleanups (evdns)
- o evnds: inline TEST_NAME macro to make debuggin easier (0c615f4 Azat Khuzhin)
-
- Portability Fixes
- o [#372] check for errno.h (3031617 Mark Ellzey)
- o Fixed Unicode issue in error messages. (e8b7895 Mattes D)
- o Assume that ke_udata is an integer type on CloudABI. (5602e45 Ed Schouten)
- o Add missing include of <netinet/in.h>. (b2c68bc Ed Schouten)
- o Include <sys/ioctl.h>, <sys/resource.h> and <sys/wait.h> optionally. (c1404b5 Ed Schouten)
- o Test against SO_REUSEADDR (along with _WIN32). (ce1776c Ed Schouten)
- o Always define missing TAILQ functions from sys/queue.h (2828bdb Christopher Wiley)
- o Don't use BSD u_* types. (fd36647 Ed Schouten)
- o Remove BSD-ism: TIMEVAL_TO_TIMESPEC(). (193c7de Ed Schouten)
- o be: include all variations of headers for sockaddr_in6 struct (c212291 Azat Khuzhin)
- o be: fix sockaddr_in6 type definition for win32 (c42bc6b Azat Khuzhin)
-
- Continious Integration:
- o travis: split long lines, and make it cleaner (685a6a1 Azat Khuzhin)
- o travis: fix autotools on osx by reinstalling libtool (088ea5e Azat Khuzhin)
- o appveyor/autotools: link with openssl by passing LDFLAGS/CFLAGS (6fcfa25 Azat Khuzhin)
- o appveyor: image already had openssl installed (4634b85 Azat Khuzhin)
- o appveyor: check -DUNICODE -D_UNICODE according to ReleaseChecklist (cmake only) (e9acc44 Azat Khuzhin)
- o appveyor: ignore failure of mingw-get (1810857 Azat Khuzhin)
- o appveyor: drop shallow_clone, since we use tags for detecting version in cmake (ac90133 Azat Khuzhin)
- o appveyor: support cmake & autotools using build matrix (like travis-ci has) (8f95015 Azat Khuzhin)
- o travis-ci/osx: relink gcc/g++ instead of clang (481481d Azat Khuzhin)
- o travis-ci: enable multi-os mode (osx, linux) (79917e4 Azat Khuzhin)
- o travis-ci: increase matrix (--disable-foo) (59649f7 Azat Khuzhin)
- o travis-ci: adjust alignment (c8be339 Azat Khuzhin)
- o travis: add builds without debug mode into matrix (3e56da2 Azat Khuzhin)
- o test: run regress with EVENT_DEBUG_MODE=1 and without (cf2cf2a Azat Khuzhin)
- o Update travis config for status updates (37453ab Mark Ellzey)
- o Use autotools for appveyor until cmake is fixed. (1cc2e29 Mark Ellzey)
- o Fix the link for appveyor OpenSSL installer (WIN32) (107d565 Mark Ellzey)
- o Forgot to install OpenSSL for appveyor (26164a5 Joakim Söderberg)
- o Add support for appveyor.com windows CI (5f89c37 Joakim Söderberg)
-
- Build Improvements/Fixes:
- o evutil: mark ai_find_protocol() static (prototype-less) (5a157c8 Azat Khuzhin)
- o cmake/solaris: set CMAKE_REQUIRED_LIBRARIES to fix functions detections (dc95823 Azat Khuzhin)
- o cmake/solaris: fix building (link with socket,nsl) (050bfc7 Azat Khuzhin)
- o cmake: check for ZLIB_INCLUDE_DIR, since we can have only library without headers (c4dfb93 Azat Khuzhin)
- o autotools/win32: fix searching ssl library (671a24f Azat Khuzhin)
- o cmake/win32: do not compile regress_thread on -DEVENT__DISABLE_THREAD_SUPPORT=ON (de0c196 Azat Khuzhin)
- o cmake/win32: do not compile evthread_win32 on -DEVENT__DISABLE_THREAD_SUPPORT=ON (ecb0ec8 Azat Khuzhin)
- o cmake: fix -DEVENT__ENABLE_VERBOSE_DEBUG (typo on -DUSE_DEBUG) (e35f224 Azat Khuzhin)
- o cmake: do not use stderr for notifications/version-info (38716c6 Azat Khuzhin)
- o autoconf: fix --disable-thread-support build under win32 (bb09535 Azat Khuzhin)
- o buffer: don't mix code and declarations (8892f4c Azat Khuzhin)
- o Update gitignore file to ignore cscope gen'ed files (0aaa4fb Neeraj Badlani)
- o For non GCC/clang on OSX the -Wno-deprecated-declarations may not be valid (b5ca365 Rainer Keller)
- o automake: define serial-tests only if automake have this option (61179de Azat Khuzhin)
- o test/automake: don't use paralell test harness (since automake 1.12) (44d755e Azat Khuzhin)
- o Ignore all pkgconfig generated stuff (ce38993 Azat Khuzhin)
- o libevent_core and libevent_extra also deserve a pkgconfig file (b8d7c62 Jan Heylen)
- o Ignore verify_tests.bat (win32 version) (0f2de10 Azat Khuzhin)
- o cmake: require 3.1 only for win32 to make it work under ubunty precise (87f7238 Azat Khuzhin)
- o cmake: require at least 3.1 for target_sources() (c46ead5 Azat Khuzhin)
- o cmake: fix adding of compiler flags, and now it will (36588e1 Azat Khuzhin)
- o Replace -Wswitch-enum with -Wswitch, and add it into cmake rules too (f29f59e Azat Khuzhin)
- o test/regress_ssl: Fix compile problems for win32 (73d0360 Trond Norbye)
- o util: fix "%zu" format on TDM-gcc/MinGW-w64 (79b69d8 Azat Khuzhin)
- o cmake: don't define EVENT__NEED_DLLIMPORT always (fixes VS2013 static build) (49bd790 Azat Khuzhin)
- o Add missing return statement to del_wait_thread so libevent can build. (4f778ab Nick Mathewson)
- o cmake: fix building dns-example under win32 (missing getopt) (a1609a8 Azat Khuzhin)
- o visibility: align it to make it more readable (bb6b53d Azat Khuzhin)
- o cmake: Fix detection of ssize_t/SSIZE_T (7707f6b Azat Khuzhin)
- o Ignore more configure stuff (configure.lineno) (8d34302 Azat Khuzhin)
- o Fixed issue with cmake version generation (d56efd9 Mark Ellzey)
- o Cmake is now officially working. (7f9646d Mark Ellzey)
- o More cmake updates, lot's of missing definitions (49a5381 Mark Ellzey)
- o CMake syntax fixes fo .in files (6aad23d Mark Ellzey)
- o Revert "The Windows socket type is defined as SOCKET." (a264da8 Mark Ellzey)
- o CMAKE CMAKE CMAKE CLEANUPS (a9db46a Mark Ellzey)
- o Lot's of cmake updates (8b228e2 Mark Ellzey)
- o Provide a mechanism for building the library on Windows with different compiler flags. Add a batch file that builds it for the M[DT][d] options and performs a hunt and gather of the different output libraries. (ded8086 billsegall)
- o The Windows socket type is defined as SOCKET. (c9e6c3d billsegall)
- o autotools: fix getservbyname() detection (959a4c2 Azat Khuzhin)
- o Add missing <string.h> for openssl_hostname_validation module (3316a21 Azat Khuzhin)
- o make test/regress_ssl.c compile without warnings (9f02a44 Thomas Bernard)
- o test/regress_be: drop debug __asm__(int3) to fix arm build (8240379 Azat Khuzhin)
- o event_debug_created_threadable_ctx_: fix compilation without debug mode (a068f2e Azat Khuzhin)
- o Add a prototype for event_disable_debug_mode() (bfcedee Sebastian Hahn)
- o http: eliminate warning about "socklen" in evhttp_connection_connect_() (dfad1a4 Azat Khuzhin)
- o Updated gitignore (1dbb55d Mark Ellzey)
- o Update bench_httpclient.c (cb96931 Seungmo Koo)
- o *fix: bench_httpclient to support win32 (4e9325e zeliard)
- o Commented out a WIN32 threading / timing test for now (e84e269 Mark Ellzey)
- o Fix mixed declarations and code (forbidden by ISO C90) (0c7f217 Thomas Bernard)
- o Fix "function declaration isn’t a prototype" (746d2c5 Thomas Bernard)
- o This fixes a bug introduced in 27bd9faf498b91923296cc91643e03ec4055c230 (19ba454 Joakim Söderberg)
- o changed strtotimeval signature as per #211 (bdbc823 Xiao Bao Clark)
- o Added cmake-generated files to ignore list. (6c12bfe Matyas Dolak)
- o Ignore `make dist` generated files (8a2c6c7 Azat Khuzhin)
-
- Debugging
- o Debug mode option to error on evthread init AFTER other event calls. (dcfb19a Mark Ellzey)
-
-
-
-Changes in version 2.1.5-beta (5 January 2015)
-
- Security Fixes (evbuffers)
- o Avoid integer overflow bugs in evbuffer_add() and related functions. See CVE-2014-6272 advisory for more information. (d49bc0e88b81a5812116074dc007f1db0ca1eecd)
-
- New APIs (evconnlistener)
- o Provide support for SO_REUSEPORT through LEV_OPT_REUSABLE_PORT (b625361 Maciej Soltysiak)
-
- Bugfixes (core)
- o Fix use-after-free error in EV_CLOSURE_EVENT callback (3cc0eac John Ohl)
- o Fix race caused by event_active (3c7d6fc vjpai)
-
- Bugfixes (evbuffer)
- o Fix evbuffer_peek() with len==-1 and start_at non-NULL. (ba59923)
- o Consistently check for failure from evbuffer_pullup() (60f8f72)
- o Fix evbuffer_peek() with len==-1 and start_at non-NULL. (fb7e76a)
-
- Bugfixes (windows, IOCP)
- o be async: avoid double close() (f133b86 Azat Khuzhin)
-
- Bugfixes (bufferevents)
- o Fix issue #127, double free for filterevents that use BEV_OPT_CLOSE_ON_FREE (2c82aa0 John Ohl)
- o make bufferevent_getwatermark api more robust (a21e510 ufo2243)
- o [Bugfix] fix bufferevent setwatermark suspend_read (b34e4ac ufo2243)
- o bufferevent_openssl: reset fd_is_set when setfd with -1 is called (3da84c2 Azat Khuzhin)
- o Fix compilation for older OpenSSL versions. (5c7282f Joakim Soderberg)
-
- New APIs (evhttp)
- o Add evhttp_connection_set_family() to set addrinfo->family for DNS requests (12c29b0 Azat Khuzhin)
- o Implement interface that provides the ability to have an outbound evhttp_connection free itself once all requests have completed (2b9ec4c,10fe4f John Ohl)
-
- New APIs (core)
- o Implement new/free for struct evutil_monotonic_timer and export monotonic time functions (f2645f8 Andrea Shepard)
-
- Bugfixes (evdns)
- o Load hosts file on Windows. (a0b247c Vilmos Nebehaj)
- o Don't truncate hosts file path on Windows. (d0dc861 Vilmos Nebehaj)
- o Fix a crash in evdns related to shutting down evdns (9f39c88,e8fe749)
- o evdns: avoid read-after-free in evdns_request_timeout_callback() (61262a0 Azat Khuzhin)
- o Correctly handle allocation failures in evdns_getaddrinfo (6a53d15)
- o evdns: fix EVDNS_BASE_DISABLE_WHEN_INACTIVE in case retransmit/retry (74d0eee Azat Khuzhin)
- o evdns: add retry/reissue tests for EVDNS_BASE_DISABLE_WHEN_INACTIVE (3ca9d43 Azat Khuzhin)
- o evdns: fail ns after we are failing/retrasmitting request (97c750d Azat Khuzhin)
-
- Bugfixes (evhttp)
- o http: reset connection before installing retry timer (fix http retries handling) (bc79cc5 Azat Khuzhin)
-
-
- Testing
- o regress_dns: fix leaks in getaddrinfo_async{,_cancel_stress} tests (2fdc5f2 Azat Khuzhin)
- o test: add family argument for http_connection_test_() (177b8a7 Azat Khuzhin)
- o test: add regress for evhttp_connection_set_family() with AF_INET and AF_UNSPEC (42aefeb Azat Khuzhin)
- o test/http: add regress test for set family to AF_INET6 (3fbf3cc Azat Khuzhin)
- o Update to a more recent tinytest_macros. (8da5a18)
- o test/regress: add simplestsignal: to track reorder bugs separately (b897bef Azat Khuzhin)
- o test/evbuffer_peek: add regress in case we have first buffer greater (e2d139d Azat Khuzhin)
- o More evbuffer_peek() test cases (154006a)
- o use correct tt macro for pointer compare (08c88ea)
- o regress_buffer: fix 'memcmp' compare size (79800df Maks Naumov)
- o Fix a use-after-free in unit tests. CID 752027 (3739057)
- o Fix a dead-code warning in unit tests. CID 1193548 (c119f24)
- o Use evutil_weakrand() in unit tests. (a677b72, 364c110)
- o Use a more precise calculation for max in time-ratelim.c (ca5b5c7)
- o Make a buffer larger in the tests to avoid a scary evbuffer_copyout_from() (fb57b8b)
- o Fix several memory leaks in the unit tests. (89c1a3b)
- o Add test for evhttp_connection_free_on_completion (b0e9924 John Ohl)
- o Fix annoying heisenbug in test-time.c (cb73704)
-
- Sample code
- o Make http-server.c output into good html5 (6d72bdc)
- o Use FindClose for handle from FindFirstFile in http-server.c (6466e88)
- o https-client: add -retries argument, for connection retries (d9da844 Azat Khuzhin)
-
- Bugfixes (build)
- o Add missing headerfile for cmake (15d90cc Trond Norbye)
- o ignore one more test binary (b6593aa Michael Richardson)
- o ignore config.cache/test-driver files (c83f333 Mike Frysinger)
- o add a --disable-samples configure flag (0c492b3 Mike Frysinger)
- o Add a few files created by "make verify" to .gitignore. (1a8295a Pierre Phaneuf)
- o updates in cmake build (27bd9fa Sergey Nikulov)
- o Fix cmake error when the Module path has more than one entry. (befbd13 Acer Yang)
- o Fix CMake shared library build (e69d910 Nobuaki Sukegawa)
- o Fix warnings when compiling with clang 3.5 (f5b4765 John Ohl)
- o Fix mixed declarations and code (forbidden by ISO C90) (8afbdbc Thomas Bernard)
-
- Bugfixes (miscellaneous)
- o tree.h: drop duplicated content of tree.h (6193187 Azat Khuzhin)
- o evdns: disable probing with EVDNS_BASE_DISABLE_WHEN_INACTIVE (610410b,ad0493e,fea86a6,d83b337,5ca9e97 Azat Khuzhin)
- o [Bugfix] fix grammer error (3a4d249 ufo2243)
- o Change return type of evutil_load_windows_system_library_ to HMODULE (f691389)
- o Fix a c90 warning (76643dd)
- o Fix a typo in a doxygen comment. Reported by 亦得. (be1aeff)
- o remove trailing comma from enum (b361b8a Jean-Philippe Ouellet)
-
- Bugfixes (FreeBSD)
- o Handle ENOTCAPABLE from FreeBSD - this is returned if an event in the changelist is for an FD that has been closed. (6fd7394 Adrian Chadd)
-
-
-
-Changes in version 2.1.4-alpha (21 Mar 2014)
-
- Libevent 2.1.4-alpha adds a number of new miscellaneous APIs to make
- Libevent more useful, including support for early close detection with
- epoll via EPOLLRDHUP, triggering bufferevent callbacks, adding more
- evhttp callbacks, and more. There are also numerous bugfixes, including
- a number for finalize-related issues from 2.1.3-alpha; and an
- alternative (non-primary!) cmake-based build mechanism.
-
- New APIs (core)
- o Added event_base_get_num_events() (0fa107d Mobai Zhang)
- o New event_base_active_by_fd API (865a142 Greg Hazel, 5c9da9a, 87fa2b0)
- o Add event_base_active_by_signal by analogy (4865943)
- o Add access to max event count stats (5173bef, efbd3dc, 26230a2
- Andrew Sweeney)
- o Implemented EV_CLOSED event for epoll backend
- (EPOLLRDHUP). (b1b69ac Diego Giagio, 53d2793, 43ffcf6, dfe1e52
- Marcin Juszkiewicz, ff26633 Joakim Soderberg, 3908a5e)
-
- New APIs (evutil_secure_rng)
- o Add evutil_secure_rng_set_urandom_device_file (2bbb5d7)
-
- New APIs (bufferevents)
- o Add function to fetch underlying ratelimit cfg (4b3d5af Mark Ellzey)
- o Pass and return const for bufferevent_get_token_bucket_cfg (1c77fbb
- Mark Ellzey)
- o Add watermark introspection (4ce242b Ondřej Kuzník)
- o Add an option to trigger bufferevent I/O callbacks (61ee18b Ondřej Kuzník)
- o Add an option to trigger bufferevent event callbacks (a7384c7
- Ondřej Kuzník)
- o Clarifications in response to merge req. comments (bd41947 Ondřej
- Kuzník)
- o Minor optimizations on bufferevent_trigger options (a3172a4)
-
- New APIs (evhttp)
- o Add evhttp_connection_get_server(). (a7f82a3 Maxime Henrion)
- o add a http default content type option (5a5acd9 Nicolas Martyanoff)
- o http: implement new evhttp_connection_get_addr() api. (0c7f040 Azat
- Khuzhin)
- o Add a variant of evhttp_send_reply_chunk() with a callback on
- evhttp_write_buffer() (8d8decf Julien BLACHE)
- o Allow registering callback for parsing HTTP headers (b0bd7fe Balint Reczey)
- o Provide on request complete callback facility (b083ca0 Andrew Sweeney)
- o evhttp_request_set_on_complete_cb to be more specific about what
- the function actually does and usage (da86dda Andrew Sweeney)
- o Update unit test to make sure that the callback happens after the
- output data is written (b85f398 Andrew Sweeney)
-
- Features (evdns)
- o bug fix for issues #293 evdns_base_load_hosts doesn't remove
- outdated addresses (954d2f9, f03d353, 45eba6f Kuldeep Gupta)
-
- Features: (cmake build support)
- o Initial CMake commit. (e415196 Joakim Soderberg)
- o Add all tests and benchmarks to CMake project. (e9fc014 Joakim Soderberg)
- o More work on adding tests to CMake project (99c1dc3 Joakim Soderberg)
- o Generate a dummy evconfig-private.h so things build
- properly. (ce14def Joakim Soderberg)
- o Link libm on unix platforms. (58fcd42 Joakim Soderberg)
- o Added some GCC specific options. (19222e5 Joakim Soderberg)
- o Use evutil_closesocket instead. (dbf2b51 Joakim Soderberg)
- o Add copyright and licensing files for CMake modules. (c259d53
- Joakim Soderberg)
- o Only include WIN32 getopt where it is used. (9bbce0b Joakim Soderberg)
- o Fix bench_cascade program on Windows. (78da644 Joakim Soderberg)
- o Don't segfault on no found event backend. (8f2af50 Joakim Soderberg)
- o Only test the event backends available on the system. (7ea4159
- Joakim Soderberg)
- o Added a "make verify" target. (e053c4f Joakim Soderberg)
- o Fix the make "verify" target on Windows. (67e5d74 Joakim Soderberg)
- o Get rid of deprecation warnings for OpenSSL on OSX 10.7+ (69c3516
- Joakim Söderberg)
- o Fix kqueue support. (a831f2f Joakim Söderberg)
- o Added a test for testing if kqueue works with pipes. (2799b35
- Joakim Söderberg)
- o Change the BSD license from 4 to 3-clause. (86df3ed Joakim Soderberg)
- o Minimum required python version is 2.4. (968e97b Joakim Soderberg)
- o Get rid of unknown pragma warnings. (0ef1d04 Joakim Soderberg)
- o Add a "make verify_coverage" target generation coverage
- info. (f2483f8 Joakim Soderberg)
- o Fix the "make verify" target on NetBSD (4ac086a Joakim Soderberg)
- o Only look for ZLib when it is used (if tests are
- included). (f780593 Joakim Soderberg)
- o Added EVENT__ENABLE_GCC_WARNINGS, turns all warnings into
- errors. (dd413bd Joakim Soderberg)
- o Add CMake config and install targets. (f3446ed Joakim Soderberg)
- o Fix typo (4b754df Joakim Soderberg)
- o Some work on making it possible to simply do add_subdirectory() on
- the project. (49ab363 Joakim Soderberg)
- o Set USE_DEBUG=1 on EVENT__ENABLE_VERBOSE_DEBUG (fd42e70 Joakim Soderberg)
- o Fix so that old nmake project still builds. (24d6466 Joakim
- Soderberg)
- o Rename README to README.md and use markdown to format. (d2bc39a
- Joakim Soderberg)
- o Update README with CMake build instructions. (604b8cc Joakim Soderberg)
- o Clean up the README some. (8d4cb35 JoakimSoderberg)
- o Forgotten headers for old nmake project compatability. (8697b99
- Joakim Soderberg)
- o Change all uses of WIN32 to _WIN32 (4e14395 Joakim Söderberg)
- o Fix include bug. (2024467 Joakim Söderberg)
- o Check if we're on OSX before disabling deprecation in le-proxy
- (8b40a5b Joakim Söderberg)
- o Fix broken autotools build. (ae1bd82 Joakim Söderberg)
- o Disclaimerize cmake a little in the README (d03b5bf)
- o Fix CMake compile when OpenSSL is disabled. (e423d42 Joakim
- Söderberg)
- o CMake: Get rid of python not found warning when regress tests
- turned off. (d38d798 Joakim Söderberg)
- o Fix https-client compilation on Windows. (d7be788 Joakim Soderberg)
- o Guard against EVENT_NOWIN32 being set during testing. (f1715b4
- Joakim Soderberg)
- o Check for OSX when checking for clang. (e212c54 Joakim Soderberg)
- o Added a Travis-CI configuration file. (8c0f0a9 Joakim Soderberg)
- o Added -Qunused-arguments for clang on macosx (ed99d92 Trond Norbye)
- o Rename event_extras to event_extra (a0dd5df Trond Norbye)
- o Add option to build shared library (4545fa9 Trond Norbye)
- o Add -Qunused-arguments for clang on macos (b56611d Trond Norbye)
- o Add cmake-related files to .gitignore (e061321 Trond Norbye)
- o Export event_extra not event_extras. (2b41bcf Joakim Söderberg)
-
- Bugfixes (core)
- o If evsel->del() fails, don't leave the evmap in an inconsistent
- state (9b5a527 Maxime Henrion)
- o Move event_debug_note_teardown_ before mm_free. (69b5c64)
- o Check CLOCK_MONOTONIC_* at runtime if needed. (911abf3)
- o Fix reinit of fds with EV_WRITE but not EV_READ. (ebfd8a8 maksqwe)
- o Tweaked callbacks to prevent race condition
- (https://github.com/libevent/libevent/issues/104) (40830f1, 2ea15ed
- John Ohl)
- o Move assert(ev) to before we use ev in EV_CLOSURE_EVENT_FINALIZE
- case (9805972)
-
- Bugfixes (evhttp)
- o Fix a double close() bug in evhttp when the underlying bufferevent uses
- BEV_OPT_CLOSE_ON_FREE. (31db8a0 Maxime Henrion)
- o Fix an unlikely but possible error case for http connections (f22049e)
- o Avoid racy bufferevent activation (5eb1788 Nate Rosenblum)
-
- Bugfixes on 2.0 (Windows)
- o Use windows vsnprintf fixup logic on all windows environments (e826f19)
- o libevent/win32_dealloc() : fix sizeof(pointer) vs sizeof(*pointer)
- (b8f5980 Frank Denis)
-
- Bugfixes (evutil_secure_rng)
- o When we seed from /proc/sys/kernel/random/uuid, count it as success
- (e35b540)
- o We should return after arc4random_buf() (1ea1f26 Makoto Kato)
- o Avoid other RNG initialization FS reads when urandom file is
- specified (9695e9c)
- o Really remove RNG seeds from the stack (f5ced88)
- o Fix another arc4random_buf-related warning (e64a2b0)
-
- Bugfixes (bufferevents)
- o Initialize async bufferevent timeout CBs unconditionally (af9b2a7)
-
- Bugfixes (evdns)
- o Checking request nameserver for NULL, before using it. (5c710c0
- Belobrov Andrey)
- o Fix SEGFAULT after evdns_base_resume if no nameservers
- installed. (14971a8 Azat Khuzhin)
- o Actually use the log facility for reporting evdns problems. (e1766a1)
- o Fix SEGFAULT after evdns_base_resume if no nameservers
- installed. (f8d7df8 Azat Khuzhin)
- o fix for ServFail from RIPE Atlas release (62f596b Antony Antony)
-
- Bugfixes (compilation)
- o Fix test compilation with nmake: add the gdi.lib dependency (5ba8ab7)
- o Whoops. It is gdi.lib, not gdi32.lib. (github issue #61) (8ab612e)
- o Don't use return since return type is void and build error occurs
- using clang (838161d Makoto Kato)
- o Use void casts to suppress some "unchecked return value" warns (7080d55)
- o rpcgen: Generate regress.gen.[c,h] in build rather than src dir
- (243386c Ross Lagerwall)
- o Fix a compiler warning when checking for arc4random_buf linker
- breakage. (5cb3865)
- o Fix 'make distcheck' by adding regress.gen.[ch] to DISTCLEANFILES
- (239d834)
-
- o Fix a c90 warning (c207682)
- o Fix consts in WIN32-Code/getopt*.[ch] (57abb35)
-
- Bugfixes (locks, synchronization)
- o Missed lock acquire/release in event_base_cancel_single_callback_()
- (d3d999a Azat Khuzhin)
- o Fix locking in bufferevent_get_options_(). (dbc9cd4 Maxime Henrion)
-
- Bugfixes (leaks)
- o Avoid leaking segment mappings when offset is not a page multiple (d409514)
-
- Testing
- o Add tests for evdns_base_resume(). (1cd9ff5 Azat Khuzhin)
- o Fix dns/leak_resume_send_err test. (7e876df Azat Khuzhin)
- o Add checks for evhttp_connection_get_server() in unit
- tests. (fbc323b Maxime Henrion)
- o Fix a (failure-only) null dereference in the unit tests (1104d0b)
- o Fix a logic error in test_evbuffer_freeze (7765884)
- o Add missing check to test_evbuffer_file_segment_add_cleanup_cb (eba4506)
- o Fix some crash-on-fail cases in DNS regression tests (87cd6f0)
- o DNS tests: add a missing check (f314900)
- o Finalize tests: add a missing check (82b6956)
- o test_evutil_rtrim: add another missing check. (e193c95)
- o regress_main: logging all if env EVENT_DEBUG_LOGGING_ALL isset
- (611e28b Azat Khuzhin)
- o regress_http: add tests for evhttp_connection_get_addr() (4dd500c
- Azat Khuzhin)
- o Update to the latest version of tinytest (7a80476)
- o Heap-allocate zlib data structure in regress_zlib tests (4947c18)
-
- Performance tweaks (core)
- o Avoid redundant syscall to make a nonblocking socket nonblocking
- (42c03da Maxime Henrion)
- o Avoid redundant syscall if making a socket cloexec twice (1f29b18)
- o Avoid redundant invocations of init_extension_functions for IOCP (3b77d62)
-
- Documentation
- o Document that arc4random is not a great cryptographic PRNG. (6e49696)
- o Small doxygen tweaks (6e67b51)
- o Try another doxygen tweak (ccf432b)
- o Clarify event_base_loop exit conditions (031a803)
- o Fix a typo (be7bf2c Ondřej Kuzník)
- o Document deferred eventcb behaviour (13a9a02 Ondřej Kuzník)
- o Typo fixes from Linus Nordberg (cec62cb, 8cd695b)
- o Fix duplicate paragraph in evbuffer_ptr documentation (58408ee)
-
- Code Improvements (coverity)
- o Fix a pile of coverity warnings in the unit tests (867f401)
- o Fix coverity warnings in benchmark tools. (ff7f739)
- o Whoops; fix compilation in bench.c (544cf88)
- o Remove spurious checks in evrpc.c error cases (coverity) (991b362)
- o Fix a couple of compilation warnings in regress_http.c (860767e)
- o Fix even more coverity warnings. (d240328)
- o Stop checking for inet_aton; we don't use it. (f665d5c)
- o Add an include to evrpc-internal to fix openbsd compilation warning
- (5e161c6)
-
- Cleanups
- o Remove an unreachable return statement in minheap-internal.h (e639a9e)
- o Refactor evmap_{io,signal}_active_() to tolerate bad inputs (974c60e)
- o Fix needless bufferevent includes in evdns.c (254c04e)
- o Fix a couple of "#ifdef WIN32" instances (88ecda3)
- o Remove unneeded declaration in bufferevent-internal.h (4c8ebcd)
-
- Sample code
- o le-proxy: Fail more gracefully if opening listener fails (44b2491)
- o http-server: drop uri_root from base_url in http-server. (6171e1c Azat Khuzhin)
- o https-client: POST supported, args supported (c5887f7 Alexey Ozeritsky)
- o https-client: code cleanup (29af65e Alexey Ozeritsky)
- o https-client: Small tweaks to https-client.c (90786eb)
- o https-client: Set hostname for SNI extension (by f69m) (d1976f8)
- o https-client: add a cast to https-client.c (462e6b6)
-
-
-
-Changes in version 2.1.3-alpha (1 May 2013)
-
- Libevent 2.1.3-alpha fixes various bugs, adds new unit tests, and cleans
- up the code in a couple of places. It has a new callback in evhttp for
- reporting errors during a request, a new feature for allowing evdns to
- not keep the event_base looping when there are no requests inflight, and
- example code for writing an https client.
-
- Libevent 2.1.3-alpha also has an important new (experimental) event
- finalization feature to allow safe event teardown in multithreaded
- programs. This ought to fix the longstanding bug with deadlocks in
- multithreaded use of SSL-based bufferevents that some people have been
- experiencing since Libevent 2.0.
-
-
- Core (event finalization)
- o Implement event_finalize() and related functions to avoid certain
- deadlocks (8eedeab)
- o Use finalization feature so bufferevents can avoid deadlocks (02fbf68)
- o Always run pending finalizers when event_base_free() is called (e9ebef8)
- o Remove bufferevent_del_generic_timeout_cbs as now unused (4ea4c6a)
- o More documentation for finalization feature (a800b91)
- o Make the event_finalize* functions return an error code (5d11f4f)
- o Mark the finalize stuff as experiemental in case it needs to
- change (23e2e29)
-
- Evdns
- o evdns: New flag to make evdns not prevent the event loop from
- exiting (6b7fa62 Azat Khuzhin)
-
- Bugfixes (Core)
- o Make event_remove_timer behave correctly with persistent timers (5623e80)
- o Unit test for event_remove_timer with EV_PERSIST. (96150dd)
- o Double-check next timeout when adding events (9443868 Nate Rosenblum)
- o event_base_update_cache_time should be a no-op if the loop isn't
- running (5e6fa2a)
-
- Bugfixes (evhttp, crash fix, from 2.0)
- o fix #73 and fix http_connection_fail_test to catch it (b618204 Greg Hazel)
-
- Bugfixes (compilation and portability, from 2.0)
- o Fix compilation with WIN32_HAVE_CONDITION_VARIABLES enabled (7e45739)
- o Fix missing AC_PROG_SED on older Autoconfs (9ab2b3f Tay Ray Chuan)
- o Backport libevent to vanilla Autoconf 2.59 (as used in RHEL5)
- (74d4c44 Kevin Bowling)
- o Use AC_CONFIG_HEADERS in place of AM_CONFIG_HEADERS for autmake
- 1.13 compat (817ea36)
- o Rename configure.in to configure.ac to appease newer autoconfs (0c79787)
- o Avoid using top_srcdir in TESTS: new automakes do not like this (a55514e)
-
- Bugfixes (resource leaks/lock errors on error, from 2.0)
- o Avoid leaking fds on evconnlistener with no callback set (69db261)
- o Avoid double-close on getsockname error in evutil_ersatz_socketpair
- (0a822a6)
- o Fix a locking error in bufferevent_socket_get_dns_error. (0a5eb2e)
-
- Documentation Fixes (from 2.0)
- o Fix a mistake in evbuffer_remove() arguments in example http server code
- (c322c20 Gyepi Sam)
- o Fix a typo in a comment in buffer.h. Spotted by Alt_F4 (773b0a5)
-
- Documentation Fixes
- o minor documentation typos (809586a Patrick Pelletier)
- o Fix cut-and-paste err in whatsnew-2.1 (49905ac)
- o Fix comment to refer to sample/include.am correctly (9e8cdf3 Sebastian
- Hahn)
- o Fix typo : Dispatching instead of Dispaching (0c2bacc Volker Lendecke)
- o fix some hinky indentation in evhttp_make_request (80e220e Patrick
- Pelletier)
- o "buffer" spelling (a452811 Patrick Pelletier)
- o Specify return behavior in header for evbuffer_pullup() in corner case
- (cf8d1cd Dan Petro)
- o Clarify an important point about event_base_foreach_event() (920a5e6)
-
- Compilation Fixes/Tool Support
- o avoid valgrind false positive by zeroing epoll_event (1258614 Patrick
- Pelletier)
- o Fix harmless clang enum warning (b452a43 Sebastian Hahn)
- o remove all exes on "make clean", not just regress.exe (974bfa0 Patrick
- Pelletier)
- o Make --disable-libevent-regress work again (787fd74)
- o Do not build strlcpy.c when it will have no code. (4914620)
-
- Portability Fixes
- o When EWOULDBLOCK is not EAGAIN, treat it as equivalent to it (bf7a0ff)
- o Preliminary changes for Minix3. (0dda56a Nicholas Heath)
- o Use AC_CONFIG_HEADERS in place of AM_CONFIG_HEADERS for autmake 1.13
- compat (bf278b)
- o Avoid using $(top_srcdir) in TESTS. (2863c83)
- o build test/test-script.sh on systems with a less-featureful $< (f935e21)
- o Implement EVUTIL_ERR_IS_EAGAIN on windows. (42aaf4d)
-
- Evhttp changes:
- o Fix ipv6 support for http. When URL contain domain, not IP
- address. (71e709c Azat Khuzhin)
- o uri decode: fix for warning "use of uninitialised value" (64b6ece Azat
- Khuzhin)
- o uri decode: changed the test for the existence of the next character
- (e1903e3 Azat Khuzhin)
- o Move prototype of evhttp_decode_uri_internal() to http-internal.h
- (de8101a Azat Khuzhin)
- o Test: decoding just part of string with evhttp_decode_uri_internal()
- (1367653 Azat Khuzhin)
- o Add new error_cb for actual reporting of HTTP request errors. (7b07719
- Azat Khuzhin)
- o Add test for EVREQ_HTTP_REQUEST_CANCEL into http_cancel_test() (862c217
- Azat Khuzhin)
- o Drop extra header http_struct.h from regress_http.c (54cc800 Azat Khuzhin)
-
- Testing
- o Add regress test ipv6_for_domain. (9ec88bd Azat Khuzhin)
- o Add an environment variable (EVENT_DEBUG_MODE) to run unit tests in debug
- mode (2fad0f3)
- o Add a test with an active_later event at event_base_free time. (1c3147f)
- o Make all tests pass under EVENT_DEBUG_MODE=1 (b1b054f)
- o Add some verbose notes to bufferevent unit tests (9d893c9)
- o New test for active_later->active transition on event_active (a153874)
- o New tests for event_base_foreach_event() (0b096ef)
- o Unit tests for event_base_gettimeofday_cached() and
- event_base_update_cache_time() (30ea291)
- o A test for event_get_assignment() (f09629e)
- o More unit tests for initializing common timeouts. (d596739)
- o Fix a bug in the new main/event_foreach test (702c9aa)
-
- Windows:
- o use FormatMessage for winsock errors (0c6ec5d, 2078e9b, 4ccdd53, c9ad3af
- Patrick Pelletier)
- o a program to print out the error strings for winsock errors (7296512
- Patrick Pelletier)
- o Fix a warning introduced in 0c6ec5d8 (eeb700c)
- o Fix another warning introduced in 0c6ec5d8 (ed26561)
-
- Examples (http)
- o Add sample/https-client.c, an example of stacking evhttp as a client on
- top of bufferevent_ssl. (be46c99 Catalin Patulea)
- o use ${OPENSSL_LIBS} instead of -lssl -lcrypto (bf31fa5 Patrick Pelletier)
- o https-client was putting newlines at 256-byte boundaries (42d7441 Patrick
- Pelletier)
- o better handling of OpenSSL errors (5754d96 Patrick Pelletier)
- o use Debian's default root certificate location (aacd674 Patrick Pelletier)
- o use iSECPartners code to validate hostname in certificate (64d9f16
- Patrick Pelletier)
- o avoid sign mismatch warning in openssl_hostname_validation.c (6021cb5
- Patrick Pelletier)
- o pull in wildcard matching code from cURL (4db9da6 Patrick Pelletier)
- o Another tweak to https-client.c (95acdaa)
- o Remove http_struct.h usage in sample/https-client.c (8a90a85)
-
-
-
-Changes in version 2.1.2-alpha (18 Nov 2012)
-
- Libevent 2.1.2-alpha includes more portable for monotonic timers,
- refactors much of Libevent's internal and external infrastructure,
- closes some longstanding gaps in the interface, makde other
- improvements. Ths log below tries to organize features by rough area of
- effect. It omits a few commits which were pure bugfixes on other commits
- listed below. For more detail, see the git changelogs. For more
- insight, see the "whatsnew-2.1.txt" document included in the Libevent
- 2.1.2-alpha distribution.
-
- Libevent 2.1.2-alpha also includes all changes made in 2.0.19-stable
- through 2.0.21-stable inclusive.
-
- Performance (core):
- o Replace pipe-based notification with EVFILT_USER where possible. This
- should make multithreaded programs on OSX and *BSD alert the main thread a
- little faster. (53a07fe)
- o Make th_base_lock nonrecursive. (9cd5acb)
-
- New/Changed API Functions:
- o New event_get_priority() function to return an event's priority (f90e255)
- o Add a bufferevent_get_priority() function (bd39554)
- o Add an event_base_loopcontinue() to tell Libevent to rescan for more
- events right away (7d6aa5e)
- o Add a new callback to get called on evbuffer_file_segment free
- (e9f8feb yangacer, 64051b9)
- o Expose event_base_foreach_event() as a public API. (84fd6d7 Roman
- Puls, 232055e, ffe1643)
- o Add an event_remove_timer() to remove timer on an event without
- deleting it (e3b2e08)
- o Make bufferevent_set_timeouts(bev, NULL, NULL) have plausible
- semantics (9dee36b)
- o Rename event_enable_lock_debuging() to ..._debugging(). (The old name
- should still work.) (07e132e)
- o Add missing implementation for event_enable_debug_logging (3b3e21d)
-
- PORTABLE MONOTONIC TIMERS:
-
- Libevent 2.1.2 includes internal support for monotonic timers on
- (nearly) all supported platforms, including Windows, and OSX. Libevent
- applications should now be more resilient to jumps forwards or backwards
- in the system clock. Also, on Linux systems with epoll, we now
- optionally support microsecond-level timeouts (whereas epoll only
- supports millisecond-precision timeouts).
-
- o Use mach_absolute_time() for monotonic clock support on OSX. (b8fd6f9)
- o Do not track use_monotonic field when is no monotonic clock (cb653a0)
- o EVENT_BASE_FLAG_PRECISE_TIMER indicates we want fine timer precision
- (ddd69d3)
- o On Linux, use CLOCK_MONOTONIC_COARSE by default (55780a7)
- o Implement a GetTickCount-based monotonic timer for Windows (d5e1d5a)
- o Refactor monotonic timer handling into a new type and set of
- functions; add a gettimeofday-based ratcheting implementation (f5e4eb0)
- o Add EVENT_PRECISE_TIMER environment var for selecting precise-but-slow
- timer (a2598ec)
- o Implement fast/precise monotonic clocks on Windows (2c47045)
- o Simple unit tests for monotonic timers (630f077)
- o Improve the monotonic-time unit test: make it check the step size (7428c78)
- o When PRECISE_TIMERS is set with epoll, use timerfd for microsecond
- precision (26c7582)
- o Split out time-related evutil functions into a new evutil_time.c (c419485)
- o Split out time-related prototypes into time-internal.h (71bca50)
- o Add evutil_time.obj to Makefile.nmake (0ba0683)
- o Avoid giving a spurious warning when timerfd support is unavailable
- (1aaf9f0 Dave Hart)
- o Make test_evutil_monotonic a little more tolerant (def3b83)
- o Avoid unused-var warning on systems with clock_gettime but without
- CLOCK_MONOTONIC_COARSE (9be5468)
-
-EVENT_BASE_ONCE LEAKS:
- If a callback added by event_base_once() is never invoked, Libevent no
- longer leaks internal memory.
-
- o Free dangling event_once objects on event_base_free() (c17dd59)
- o Add a unit test in which an event is created with event_base_once()
- but never fires (4343edf)
-
-TESTING SUPPORT, FIXES AND IMPROVEMENTS:
-
- Libevent now disables by default its unit tests that would touch the
- network, or that tend to fail on heavily-loaded systems. To re-enable
- them, invoke the ./test/regress program with the @all alias.
-
- o Simplify test.sh code significantly. (9b856fd Ross Lagerwall)
- o Make all tests that hit the network disabled by default (f2cea87)
- o Avoid a resource leak on error in http client benchmark (ea92fba)
- o Update to latest tinytest (911b4f0349377) (ef7c4f7)
- o Avoid (unlikely) overflow in bench_httpclient.c (5671033)
- o Shave 700 msec off the persistent_timeout_jump test (21205b8)
- o Check return value of write() in regress.c (c8009d2)
- o Make load-dependent monotonic timer tests off-by-default (2b6fe8b)
- o Add deferred_cb_skew to list of timing-dependent tests (34c8f31)
- o Avoid test -e; older shs don't have one. (f1bd938)
- o Fix renegotiation test to work around openssl 1.0.1 bug (c2f3086)
- o Fix a couple of compile warnings in the unit tests (5a9a014)
-
-MISC:
- o Change evutil_weakrand_() to avoid platform random() (e86af4b Nicholas
- Marriott, 3aa4415)
-
-INFRASTRUCTURE (Active-later events):
- As a simplification and optimization to Libevent's "deferred callback"
- logic (introduced in 2.0 to avoid callback recursion), Libevent now
- treats all of its deferrable callback types using the same logic it uses
- for active events. Now deferred events no longer cause priority
- inversion, no longer require special code to cancel them, and so on.
-
- o Refactor the callback part of an event into its own event_callback
- type (cba59e5)
- o Add "active later" event_callbacks to supersede deferred (745a63d)
- o event_base_assert_ok: check value of event_active_count for
- correctness (fec8bae)
- o Replace deferred_cbs with event_callback-based implementation. (ae2b84b)
- o Replace more deferred_cb names with event_callback (a4079aa)
- o Give event_base_process_active a single exit path (581b5be)
- o Restore our priority-inversion-prevention code with deferreds (c0e425a)
- o Refactor event_persist_closure: raise and extract some common logic
- (bec22b4)
- o Remove the unused bits from EVLIST_ALL (9889a3d)
-||||||| merged common ancestors
-Changes in version 2.0.22-stable (?? Dec 2013)
-
- (As of 3b77d62829c4393bda6f9105a5d3b73b48a64b71.)
-
+Changes in version 2.1.11-stable (01 Aug 2019)
+
+ This release contains one ABI breakage fix (that had been introduced in
+ 2.1.10, and strictly speaking this release breaks ABI again to make it
+ compatible with 2.1.9 and less, please take a look at 18104973 for more
+ details). Apart from that it contains some bug fixes, that grouped below.
+
+ And even though the return value for evbuffer_setcb() had been changed it
+ should ABI compatible (anyway that function is in -compat.h header).
+
+ There is also one patch that introduce new functionality, this is 546a366c,
+ to tune SO_RCVBUF/SO_SNDBUF in evdns, but one can count it as a bug-fix on
+ the application level, since before you cannot tune this settings and hence
+ you could stumble on problems.
+
+ ABI breakage:
+ o Protect min_heap_push_ against integer overflow. (8c899768 Tobias Stoeckmann)
+ o Revert "Protect min_heap_push_ against integer overflow." (18104973 Azat Khuzhin)
+
+ functionality:
+ o evdns: add new options -- so-rcvbuf/so-sndbuf (546a366c Azat Khuzhin)
+
+ build:
+ o Change autoconf version to 2.62 and automake version to 1.11.2 (2a333008 yuangongji)
+ o cmake: install shared library only if it was requested (596855f7 Azat Khuzhin)
+ o Missing <winerror.h> on win7/MinGW(MINGW32_NT-6.1)/MSYS (9559349c yuangongji)
+ o cmake: set library names to be the same as with autotools (305251b9 yuangongji)
+ o Enable _GNU_SOURCE for Android (f013fc7d Keith Smiley)
+ o Enable kqueue for APPLE targets (3aa68a82 Keith Smiley)
+ o autotools: do not install bufferevent_ssl.h under --disable-openssl (5349a07e Azat Khuzhin)
+ o cmake: link against shell32.lib/advapi32.lib (c9ce638c Azat Khuzhin)
+ o Add README.md into dist archive (3660a4cc Azat Khuzhin)
+ o cmake: add missing autotools targets (doxygen, uninstall, event_rpcgen.py) (2d65071c yuangongji)
+ o m4/libevent_openssl.m4: fix detection of openssl (d4056e59 Fabrice Fontaine)
+ o Fix detection of the __has_attribute() for apple clang [ci skip] (7fd7c5ef Azat Khuzhin)
+
+ lib:
+ o buffer: fix possible NULL dereference in evbuffer_setcb() on ENOMEM (598f247d Azat Khuzhin)
+ o Warn if forked from the event loop during event_reinit() (b75922ae Azat Khuzhin)
+ o evutil: set the have_checked_interfaces in evutil_check_interfaces()
+ (ef498aa2, a09265ac jeremyerb)
+
+ samples:
+ o https-client: correction error checking (a8a04565 wenyg)
+
+
+Changes in version 2.1.10-stable (26 May 2019)
+
+ This release contains mostly fixes (some evbuffer oddity, AF_UNIX handling in
+ http server, some UB fixes and others) but also some new functionality
+ (without ABI breakage as usual) and now dist archive can be used for building
+ on windows (getopt had been added into it).
+
+ Above you will find changelog for this particular release (but with some
+ trivial fixes pruned out from it - to make it a little bit more informative).
+
+ To view full changelog please use git:
+ git log --format=' o %s (%h %aN)' release-2.1.9-beta...release-2.1.10-stable
+
+ dist:
+ o Add getopt into dist archive (7042ff24 Azat Khuzhin)
+
+ functionality:
+ o evdns: add DNS_OPTION_NAMESERVERS_NO_DEFAULT/EVDNS_BASE_NAMESERVERS_NO_DEFAULT
+ (58e81106 Azat Khuzhin)
+ o Add support for EV_TIMEOUT to event_base_active_by_fd (3f893f0a John Ohl)
+
+ fixes:
+ o Merge branch 'evbuffer-fixes-806-v2' (2fea04b3 Azat Khuzhin)
+ o Merge branch 'issue-807-accept4-getnameinfo-AF_UNIX' (7c4da937, e2790a7f
+ Azat Khuzhin)
+ o kqueue: Avoid undefined behaviour. (e70e18e9 Tobias Stoeckmann)
+ o Prevent integer overflow in kq_build_changes_list. (43a55a23 Tobias Stoeckmann)
+ o evdns: fix lock/unlock mismatch in evdns_close_server_port() (54103883 zhuizhuhaomeng)
+ o Merge remote-tracking branch 'official/pr/804' -- Enforce limit of NSIG
+ signals (87fa93a8 Tobias Stoeckmann)
+ o Protect min_heap_push_ against integer overflow. (0b46bb8c Tobias Stoeckmann)
+ o le-proxy: initiate use of the Winsock DLL (2a1e1530 linxiaohui)
+ o Fix leaks in error path of the bufferevent_init_common_() (bb0f8fe7 Azat Khuzhin)
+ o buffer: make evbuffer_prepend() of zero-length array no-op (61fa7b7d Azat Khuzhin)
+ o Merge branch 'evbuffer-empty-chain-handling' (6a3dd717 Azat Khuzhin)
+ o Don't loose top error in SSL (3d1a7a1d Yury Korzhetsky)
+ o Remove needless check for arc4_seeded_ok (6602a97d Seong-Joong Kim)
+ o Merge pull request #769 from sungjungk/fix-return-handling (91084140 Nathan French)
+
+ build:
+ o Define `_GNU_SOURCE` properly/consistently per autoconf (00ba9fa2 Enji Cooper)
+ o signal: guard __cdecl definition with #ifdef (d89045a6 Azat Khuzhin)
+ o Link test/regress with event_core/event_extra over event (22380996 Azat Khuzhin)
+
+ tests:
+ o Use kill() over raise() for raising the signal (fixes osx 10.14 with
+ kqueue) (3db5296b, a45f6733 Azat Khuzhin)
+ o tinytest: implement per-test timeout (via alarm() under !win32 only)
+ (b64dbfb6, 75d7e1ff Azat Khuzhin)
+
+Changes in version 2.1.9-beta (10 February 2019)
+
+ This changelog will differs from other releases in the next few clauses:
+ - contains only highlighted changes (so now it will not contains a lot of
+ patches that fixes some stuff in regression tests, typos, leaks fixes in
+ samples and so forth)
+ - no authors (since merge commits breaks them anyway, but AUTHORS sections in
+ README will be kept up to date)
+ - group name trimmed from commit subjects trimmed
+ - it's been 2 years since the previoius release, so it is pretty huge
+
+ And I think that this is more useful, so from now on it will always has the
+ same look (until there will too many objections of course).
+
+ To view full changelog please use git:
+ git log --format=' o %s (%h %aN)' release-2.1.8-stable...release-2.1.9-beta
+
+
+ dist archive:
+ o Add cmake rules into dist archive (bf3a67cf)
+ o Add missing print-winsock-errors.c into dist archive (822d6462)
+ o Include openssl-compat.h into dist archive (08658136)
+
+ core:
+ o Merge branch 'check-O_NONBLOCK-in-debug' (a39898f3, a8155c62)
+ o Merge branch 'event-ET-#636-v2' (ca4b6404)
+ o Fix visibility issues under (mostly on win32)
+ (349081e1g, 802be13ag, a1f28e2f)
+ o Define __EXT_POSIX2 for QNX (a2176f2c)
+ o Cleanup __func__ detection (b3af7bdd)
+ o Add convenience macros for user-triggered events (06ec5de6)
+ o Notify event base if there are no more events, so it can exit without delay (d9d1c09e)
+ o Fix base unlocking in event_del() if event_base_set() runned in another thread (4f0f40e3)
+ o If precise_time is false, we should not set EVENT_BASE_FLAG_PRECISE_TIMER (27dee54d)
+ o Fix race in access to ev_res from event loop with event_active() (43d92a6d)
+ o Return from event_del() after the last event callback termination (876c7ac7)
+
+ http:
+ o Merge branch 'http-EVHTTP_CON_READ_ON_WRITE_ERROR-fixes-v2' (eb7b472b)
+ o Preserve socket error from listen across closesocket cleanup (2ccd00a6)
+ o fix connection retries when there more then one request for connection (d30e7bba)
+ o improve error path for bufferevent_{setfd,enable,disable}() (a8cc449e)
+ o Fix conceivable UAF of the bufferevent in evhttp_connection_free() (6ac2ec25)
+ o Merge branch 'http-request-line-parsing' (cdcfbafe)
+ o Fix evhttp_connection_get_addr() fox incomming http connections (4215c003)
+ o fix leaks in evhttp_uriencode() (123362e9)
+ o CONNECT method only takes an authority (7d1ffe64)
+ o Allow bodies for GET/DELETE/OPTIONS/CONNECT (23eb38b9)
+ o Do not crash when evhttp_send_reply_start() is called after a timeout. (826f1134)
+ o Fix crashing http server when callback do not reply in place (5b40744d, b2581380)
+ o fix handling of close_notify (ssl) in http with openssl bufferevents (7e91622b)
+
+ evrpc:
+ o use *_new_with_arg() to match function prototype (a95cc9e3)
+ o avoid NULL dereference on request is not EVHTTP_REQ_POST (e05136c7)
+
+ regression tests:
+ o Merge branch 'TT_RETRIABLE' (6ea1ec68, f9b592aa)
+
+ bufferevent:
+ o Merge branch 'iocp-fixes' (6bfac964)
+ o Merge branch 'be-wm-overrun-v2' (3f692fff)
+ o bufferevent_socket_connect{,_hostname}() missing event callback and use ret code (1dde74ef)
+ o don't fail be_null_filter if bytes are copied (b92b0792)
+ o Call underlying bev ctrl GET_FD on filtered bufferevents (ebfac517)
+
+ bufferevent_openssl/openssl:
+ o Merge branch 'ssl_bufferevent_wm_filter-fix' (30020a35)
+ o be_openssl: avoid leaking of SSL structure (e86ccfe5)
+ o Fix build with LibreSSL 2.7 (894ca48a)
+ o Add missing includes into openssl-compat.h (01bc36c1)
+ o Explicitly call SSL_clear when reseting the fd. (29b7a516)
+ o Unbreak build with LibreSSL after openssl 1.1 support added (230af9f0)
+
+ samples:
+ o Merge branch 'sample-http-server' (b6309bcc)
+ o sample/https-client: use host SSL certificate store by default (5c0132f3)
+
+ listener:
+ o ipv6only socket bind support (ba148796)
+ o Merge branch 'listener-immediate-close' (df2ed13f)
+ o Merge branch 'evconnlistener-do-not-close-client-fd' (42e851bb)
+
+ evdns:
+ o evdns: handle NULL filename explicitly (0033f5cc)
+ o Merge branch 'evdns_getaddrinfo-race-fix' (3237d697)
+ o Generating evdns_base_config_windows_nameservers docs on all platforms (3bd2ce43)
+
+ utils:
+ o Merge branch 'evutil_found_ifaddr-dev' (b07e43e6)
+ o Avoid possible SEGVs in select() (in unit tests) (8818c86c)
+ o Port `event_rpcgen.py` and `test/check-dumpevents.py` to Python 3. (532a8cc3)
+
+ buffer:
+ o Fix assert() condition in evbuffer_drain() for IOCP (d6326104)
+ o fix incorrect unlock of the buffer mutex (for deferred callbacks) (2b4d127d)
+ o Fix wrong assert in evbuffer_drain() (9f4d0dce)
+
+ cmake:
+ o fix checking of devpoll backend (like in autotools, by devpoll.h existence) (7f161902)
+ o support static runtime (MSVC) (c8b3ec17, 61fb055a)
+ o do not build both (SHARED and STATIC) for MSVC/win32 (bc7f2fd9)
+ o introduce EVENT__LIBRARY_TYPE option (eb10a738)
+ o ensure windows dll's are installed as well as lib files (29590718)
+ o Fix generation of LibeventConfig.cmake for the installation tree (7fa08c4b)
+ o fix pkgconfig generation (copy-paste typo) (cc554d87)
+ o Merge branch 'cmake-missing-bits' (9806b126)
+ o Fix detection of timerfd_create() in CMake. (e50af331)
+ o Merge branch 'cmake-configure-fixes-v2' (a0bfe2c4)
+ o Do not add epoll_sub (syscall wrappers) for epoll in cmake (cea61de6)
+ o Fix RPATH for APPLE (45b1f379)
+
+ autotools:
+ o include win32 specific headers for socklen_t detection on win32/mingw (d7579fb9)
+ o Ignore evconfig-private.h for autotools (37423849)
+ o config.h can't be prefixed unconditionally (63a054f8)
+ o Merge branch 'pull-628' (7e56c8b2)
+ o Provide Makefile variables LIBEVENT_{CFLAGS,CPPFLAGS,LDFLAGS} (2f060c5f)
+ o confirm openssl is working before using (b39ccf8e)
+ o pass $(OPENSSL_INCS) for samples (FTBFS macOS) (c2495265)
+ o Add configure check for midipix (d433201e)
+ o Fix tests with detached builds (c46ff439)
+
+ build:
+ o Fix arc4random_addrandom() detecting and fallback (regression) (303d6d77)
+ o Merge branch 'win32-fixes' (ebd12e6d)
+ o Merge branch 'fix-openssl-linking' (e7bd9e03)
+ o Merge branch 'fix-struct-linger' (8567f2f5)
+
+ CI:
+ o travis-ci/appveyor now uses fast_finish+allow_failures
+ (5e97b6e6, dd472e7d, dfb5fc167)
+ o Merge branch 'travis-ci-osx-fixes' (9f02b39c)
+ o Merge branch 'win64-fixes' (aee0fcd5)
+
+
+Changes in version 2.1.8-stable (22 January 2017)
+
+ Libevent 2.1.8-stable, it contains openssl fixes for resetting fd and using
+ bufferevent_openssl_filter_new(). vagrant fixes, some build fixes, increased
+ timeout for some tests (to reduce number of failures due to timing issues),
+ date in RFC1123 format and running tests in parallel.
+
+ There are highlighted changes above.
+
+ Build fixes:
+ o Fix _FILE_OFFSET_BITS redinition (solaris/autotools) (336f3b11 Azat Khuzhin)
+ o util-internal: fix __func__ redefinition (netbsd) (253e7fa9 Azat Khuzhin)
+ o Fix signedness differ for iov_base (solaris) (2c62062e Azat Khuzhin)
+ o evutil_time: include <unistd.h> when there is only sleep()/usleep() (3e75194c Azat Khuzhin)
+ o http: fix formatter for pritnf for req->ntoread (osx) (1cbf26f6 Azat Khuzhin)
+ Testing environment:
+ o Merge branch 'automake-tests-parallel-v4' (*includes ci bits also*) (59e217df Azat Khuzhin)
+ Vagrant env fixes:
+ o vagrant/netbsd: missing libtool (9c9be399 Azat Khuzhin)
+ o vagrant/netbsd: more reliable way of installing packages (36da6877 Azat Khuzhin)
+ o vagrant/osx: use make instead of gmake (there is no gmake) (f7c70aef Azat Khuzhin)
+ o vagrant: add centos box (ca591c5b Azat Khuzhin)
+ Tests:
+ o test/dns: replace servname since solaris does not have "http" (d6bafbbe Azat Khuzhin)
+ o test/thread: netbsd is too slow, increase timeout for conditions_simple (3c7422fc Azat Khuzhin)
+ o test/dns: run async resolving after sync one (to avoid timeouts) (07862531 Azat Khuzhin)
+ o test/http: turn off some tests that based on backlog filling (falky) (26f416c1 Azat Khuzhin)
+ Bugfixes:
+ o Merge branch 'openssl-filter-fixes-v4' (83e0f43b Azat Khuzhin)
+ o Merge branch 'date-rfc1123' (68def435,4798de6c,4545807d Azat Khuzhin)
+ o Merge branch 'be-openssl-fd-reset-fix-v2' (86fa0070,32adf434 Azat Khuzhin)
+ o Merge branch 'openssl-1.1-init-fixes-v2' (18a161f0 Azat Khuzhin)
+ o Fix incorrect MIME type (23f9a20e johnsonlee)
+ Trivial fixes:
+ Documentation updates:
+ o Update README.md (3821cca1 Breaker)
+
+
+Changes in version 2.1.7-rc (2 Novemer 2016)
+
+ Libevent 2.1.7-rc contains openssl 1.1 support, build fixes, CI improvements
+ and plus Vagrantfile for testing under multiple OS'es.
+
+
+ Continious Integration:
+ o Use coveralls.io via travis (9ac000c Azat Khuzhin)
+ o travis-ci: use container-based infrastructure (7e12e96 Azat Khuzhin)
+ o travis-ci/osx: fix compiling/linking openssl libraries (9d2f8d4 Azat Khuzhin)
+ o travis-ci: use gcc-5 (fixes osx|gcc failures) (d7ceae5 Azat Khuzhin)
+ o Testing with vagrant for 6 OS and cmake+autoconf (9585338 Azat Khuzhin)
+ o travis-ci/osx: install lcov (e4e099b Azat Khuzhin)
+
+ Build Improvements/Fixes:
+ o Fix cmake -DEVENT__COVERAGE=ON (40fbffc Azat Khuzhin)
+ o autogen.sh: learn about gmake (9376ac4 Azat Khuzhin)
+ o autogen.sh: remove all autoconf/automake caches, if any (69cce25 Azat Khuzhin)
+ o cmake: fix finding python2, and check that it is really 2 (3453c08 Azat Khuzhin)
+ o cmake: fix CheckFunctionExistsEx/CheckPrototypeDefinition (CMP0054) (43b69b2 Azat Khuzhin)
+ o cmake: cleanup (dc624ad Zonr Chang)
+ o cmake/win32: fix running regress, but fixing finding python2 interpreter (bcb990a Azat Khuzhin)
+ o cmake: use PYTHON_EXECUTABLE to find python2 (a4d044c Azat Khuzhin)
+ o Merge branch 'force-disable-clockgettime' (83c7cdf Azat Khuzhin)
+
+ Code Improvements (core)
+ o use ev_uint16_t instead of unsigned short for port (e983712 Thomas Bernard)
+ o Merge branch 'contrib-guide-v2' (b9c5077 Azat Khuzhin)
+ o poll: Prevent libevent from spinning if POLLNVAL occurs (675974c Tim Hentenaar)
+
+ Testing:
+ o test/regress: cover a polling of invalid fd (cb0df5c Tim Hentenaar)
+
+ Code Improvements (bufferevent_openssl)
+ o Make it build using OpenSSL 1.1.0 (3e9e0a0 Kurt Roeckx)
+ o Don't call BIO_number_{read|written} on NULL BIOs. (6702da1 Adam Langley)
+ o Switch from a 512 to 2048-bit RSA key. (f9803a6 Adam Langley)
+
+ Trivial fixes:
+ o Ignore temporary configure files (8fb08ae Azat Khuzhin)
+ o README.md: fix typo: ar -> are (2361616 Simone Basso)
+ o be: just a simple mistake, reinclude the <errno.h> (7521664 Seven)
+
+Changes in version 2.1.6-beta (4 July 2016)
+
+ Libevent 2.1.6-beta contains mostly bug fixes (evbuffers, evthread, evdns,
+ bufferevents, core, http, samples), improvements but mostly to fix some
+ possible issues (EVHTTP_CON_LINGERING_CLOSE), a lot of new unit tests and new
+ appveyor integration.
+
+ Security Fixes (utils)
+ o evutil_parse_sockaddr_port(): fix buffer overflow (329acc1 Azat Khuzhin)
+
+ Security Fixes (evdns)
+ o evdns: name_parse(): fix remote stack overread (96f64a0 Azat Khuzhin)
+ o evdns: fix searching empty hostnames (ec65c42 Azat Khuzhin)
+
+ New APIs (evdns)
+ o New function to get address for nameserver. (537177d Nick Mathewson)
+
+ New APIs (bufferevents)
+ o expose bufferevent_incref/decref (with fewer modifications) (1ed6718 Mark Ellzey)
+
+ New APIs (internal)
+ o evdns: export cancel via callbacks in util (like async lib core/extra issues) (8cbe65d Azat Khuzhin)
+
+ New APIs/Improvements (http)
+ o http: take EVHTTP_CON_LINGERING_CLOSE into account for "Expect: 100-Continue" (ac448a7 Azat Khuzhin)
+ o http: lingering close (like nginx have) for entity-too-large (9fde518 Azat Khuzhin)
+ o http: read server response even after server closed the connection (680742e Azat Khuzhin)
+ o http: export evhttp_connection_set_family() (714fc70 Azat Khuzhin)
+ o http: reuse connected address only with EVHTTP_CON_REUSE_CONNECTED_ADDR (a50f5f0 Azat Khuzhin)
+ o http: use IP address that we got before (if any) during retrying (54c887d Azat Khuzhin)
+
+ Bugfixes (core)
+ o Fix getaddrinfo under solaris (for multiprotocol case) (40730ae Azat Khuzhin)
+ o Check for Mac OS X 10.4 kqueue bug properly (df6f99e Mark Mentovai)
+ o event_reinit: make signals works after fork() without evsig_add() (88640aa Nicholas Marriott)
+ o event_reinit: always re-init signal's socketpair (ad0c237 Nicholas Marriott)
+ o Free event queues even for recursive finalizers (7c8d015 Azat Khuzhin)
+ o Fix checking for make_base_notifiable() (f337296 Azat Khuzhin)
+ o Set correct socklen for PF_INET6 sockaddr len (3499ad9 Mark Ellzey)
+ o Fix garbage value in socketpair util function, stdint? (043ae74 Mark Ellzey)
+ o fix the return value of event_deferred_cb_schedule_ (38cef64 Greg Hazel)
+ o event_free_debug_globals_locks(): disable lock debugging (e5c87d1 Azat Khuzhin)
+ o event: call event_disable_debug_mode() in libevent_global_shutdown() (941faae Azat Khuzhin)
+ o ht-internal: don't reset hth_table_length explicitly in name_##HT_CLEAR (597c7b2 Azat Khuzhin)
+
+ Bugfixes (evthread)
+ o evthread: fix evthread_setup_global_lock_() for debug-lock with a real-lock case (e4556fc Azat Khuzhin)
+ o evthread: evthreadimpl_disable_lock_debugging_() for libevent_global_shutdown() (ccc5593 Azat Khuzhin)
+
+ Bugfixes (evdns)
+ o evdns: avoid double-free in evdns_base_free() for probing requests (4db15e0 Azat Khuzhin)
+ o evdns: evdns_base_free(): fix UAF of evdns_base with @fail_requests (00313c5 Azat Khuzhin)
+ o evdns: evdns_base_free(): free requests before namservers (14f84bb Azat Khuzhin)
+ o evdns: fix randomize-case by make case-insensitive as required (9c238de Azat Khuzhin)
+
+ Bugfixes (bufferevents)
+ o be_sock: handle readv() returns ECONNREFUSED (freebsd 9.2) (3189eb0 Azat Khuzhin)
+ o be_filter: avoid data stuck under active watermarks (b627ad8 Eduardo Panisset)
+ o Fix bufferevent_pair to properly set BEV_EVENT_{READING,WRITING} on flush. (2851889 David Paschich)
+ o be_openssl: clear all pending errors before SSL_*() calls (38e0f4a Azat Khuzhin)
+ o be_sock: cancel in-progress dns requests (86dfd2c Azat Khuzhin)
+ o be_sock: unfreeze buffers on fd changing (255525d Azat Khuzhin)
+ o be_sock: bufferevent_socket_connect_hostname(): make it thread-safe (809bb39 Azat Khuzhin)
+ o be_openssl: don't call do_write() directly from outbuf_cb (da52933 Azat Khuzhin)
+ o be_openssl: use bufferevent_enable() instead of bufferevent_add_event_() (0c66d32 Azat Khuzhin)
+ o be_openssl: don't add events during bev creation (like be_sock) (f4b6284 Azat Khuzhin)
+ o Fix lock leak in be_pair_flush() if flush type is BEV_NORMAL (f45d39d Bill Vaughan)
+ o be_openssl: don't use *_auto() in do_handshake() we can't have fd == -1 there (877280d Azat Khuzhin)
+ o be_openssl: don't call set_open_callbacks() if fd == -1 (e8a2da9 Azat Khuzhin)
+ o be_openssl: get rid off hackish "fd_is_set", to fix some corner cases (40b0379 Azat Khuzhin)
+ o be: we don't need to use getpeername() we we have conn_address (2c271e2 Azat Khuzhin)
+ o Call underlying bev ctrl SET_FD on filtered bufferevents (c2aa7dc Mark Ellzey)
+ o be_pair: release shared lock with the latest of bufferevent_pair (92a359e Azat Khuzhin)
+
+ Bugfixes (http)
+ o [Issue #313] set method to ASCII "NULL" if evhttp_method() returns NULL (17cc636 Mark Ellzey)
+ o evhttp_have_expect(): fix -Wlogical-not-parentheses (24b5214 Azat Khuzhin)
+ o http: set fd to -1 unconditioally, to avoid leaking of DNS requests (7a4b472 Azat Khuzhin)
+ o http: avoid leaking of fd in evhttp_connection_free() (f0e1341 Azat Khuzhin)
+ o http: get fd from be layer during connection reset (4a53c54 Azat Khuzhin)
+ o http: fix EVHTTP_CON_READ_ON_WRITE_ERROR when it doesn't supported by OS (2ff164a Azat Khuzhin)
+ o http: do not do function calls under EVUTIL_ASSERT() to fix NDEBUG builds (7c89999 Azat Khuzhin)
+ o http: fix leaking of response_code_line (8f18a62 Azat Khuzhin)
+ o http: fix "Expect: 100-continue" client side (0b46b39 Azat Khuzhin)
+ o http: fix conflicts EVHTTP_CON_AUTOFREE and EVHTTP_CON_REUSE_CONNECTED_ADDR (4dc0979 Azat Khuzhin)
+ o http: avoid epoll_ctl() on already closed fd (triggers by http/chunk_out) (ab3bc69 Azat Khuzhin)
+ o http: install timeout for read too during connect for ssl (040000d Azat Khuzhin)
+ o http: fix evhttp_request_own() by checking EVHTTP_USER_OWNED in more cases (b0d3964 Azat Khuzhin)
+ o http: fix detecting EOF without write (7ed02ac Azat Khuzhin)
+ o evhttp: Fix failure to send all output data for POST/PUT requests (24eea0d John Ohl)
+ o Fix evhttp_uriencode() regression. (c6b1ec1 Mark Ellzey)
+ o removed unused vars (e94250c Mark Ellzey)
+ o pointer overflow checks for evhttp_uriencode (72afe4c Zonr Chang)
+
+ Bugfixes (evbuffers)
+ o buffer: fix overflow check in evbuffer_expand_singlechain() (a3f4ccd Azat Khuzhin)
+ o buffer: evbuffer_add_buffer(): clean empty chains from destination buffer (26fd932 Azat Khuzhin)
+ o Fix n_add_for_cb in evbuffer_prepend() in case of new buffer required (0abd039 Azat Khuzhin)
+ o be_filter: actually disable output_filter during processing output (c031215 Simon Perreault)
+ o evbuffer_add: Use last_with_datap if set, not last. (a8769ef Marcus Sundberg)
+ o EVBUFFER_PTR_SET -> EVBUFFER_PTR_ADD (8674e4f jer-gentoo)
+
+ Bugfixes (evconnlistener)
+ o listener: unlock lev on error in listener_read_cb() (2a71b33 Azat Khuzhin)
+ o Fix potential fd leak in listener_read_cb() (a695a72 Mark Ellzey)
+
+ Testing
+ o tests: use waitpid(..., WNOWAIT) to fix failing of main/fork under solaris (43eb56c Azat Khuzhin)
+ o test: replace sleeping with syncing pair in main/fork (16d220c Azat Khuzhin)
+ o test/http: do not run tests that based on backlog filling (freebsd) (500b6b7 Azat Khuzhin)
+ o test/bufferevent/iocp: fix test name for "bufferevent_connect_fail_eventcb" (4410e9d Azat Khuzhin)
+ o test/ssl: use send()/recv()/EVUTIL_ERR_RW_RETRIABLE()/EVUTIL_SOCKET_ERROR() to fix win32 (a9e8cd6 Azat Khuzhin)
+ o test/https_basic: increase timeout for complete write (fixes win32) (d5a2f2f Azat Khuzhin)
+ o test: fix building with --disable-thread-support under win32 (a487706 Azat Khuzhin)
+ o test/buffer: evbuffer_add_buffer() with empty chains (a272bc4 Azat Khuzhin)
+ o test/buffer: evbuffer_remove_buffer() with empty chains (prepend) (f0cfa14 Azat Khuzhin)
+ o test/buffer: evbuffer_remove_buffer() with empty chains (evbuffer_add_buffer()) (2880ce6 Azat Khuzhin)
+ o test/buffer: cover evbuffer_expand() for overflow (48dab7a Azat Khuzhin)
+ o test/be_filter: creating test case for data stuck with active watermarks (766194b Eduardo Panisset)
+ o test/http: avoid using conditionals with omitted operands (fixes VS2015) (2a4bf29 Azat Khuzhin)
+ o test/http: don't mix declarations and code (fixes -Wdeclaration-after-statement) (aabf1c2 Azat Khuzhin)
+ o test/buffer: fix leak in test_evbuffer_prepend() (c08d90b Azat Khuzhin)
+ o test/buffer: avoid errors with --no-fork (reinitialize static vars) (e7d1e39 Azat Khuzhin)
+ o test/buffer: cover n_add_for_cb when evbuffer_prepend() need to allocate buffer (e77ff41 Azat Khuzhin)
+ o test/tinytest_macros: add new one tt_nstr_op() (bd19a28 Azat Khuzhin)
+ o test/bufferevent: check that output_filter disabled during processing output (ae28812 Azat Khuzhin)
+ o test/listener: regression for missing unlock in listener_read_cb() (7d85651 Azat Khuzhin)
+ o test/regress: add tests for evbuffer_add() breakage on empty last chain (d5ee739 Marcus Sundberg)
+ o test/http: fix running some tests sequential (with --no-fork) (bddad71 Azat Khuzhin)
+ o test/http: localize evhttp server structure (cbc3209 Azat Khuzhin)
+ o test/dns: regression for empty hostname (d7348ba Azat Khuzhin)
+ o test/http: fix SERVER_TIMEOUT tests under win32 (d49a658 Azat Khuzhin)
+ o test/http: add a helper for creating timedout/failed request (376f107 Azat Khuzhin)
+ o test/http: adopt for C90 (mixed code and declarations) (d02a285 Azat Khuzhin)
+ o test/http: cover NS timed out during request cancellations separatelly (0c343af Azat Khuzhin)
+ o test/http: request cancellation with resolving/{conn,write}-timeouts in progress (334340d Azat Khuzhin)
+ o test/http: exit from the loop in the errorcb to wait cancellation (927ab33 Azat Khuzhin)
+ o regress_clean_dnsserver(): reset global port vars (351207f Azat Khuzhin)
+ o test/http: read_on_write_error: fix it for win32 (3b58169 Azat Khuzhin)
+ o test/http: separate coverage for EVHTTP_CON_READ_ON_WRITE_ERROR (5c2b4c1 Azat Khuzhin)
+ o test/http: cover "Expect: 100-continue" client-server interaction (31d8116 Azat Khuzhin)
+ o test/http: *lingering tests shouldn't have "Expect: 100-continue" (ed469ab Azat Khuzhin)
+ o test: use EVUTIL_SHUT_WR (04fc82f Azat Khuzhin)
+ o test/http: avoid huge stack allocations to fix win32 builds (3166765 Azat Khuzhin)
+ o test: http/lingering_close: cover EVHTTP_SERVER_LINGERING_CLOSE (e122ca1 Azat Khuzhin)
+ o test: http/non_lingering_close: cover ~EVHTTP_SERVER_LINGERING_CLOSE (f41e1b0 Azat Khuzhin)
+ o test: http/*: update expected HTTP codes for body exceeds `max_body_size` (addf2b9 Azat Khuzhin)
+ o test: http/data_length_constrains: set EVHTTP_CON_READ_ON_WRITE_ERROR (d38a723 Azat Khuzhin)
+ o test: increase buffer size for http/data_length_constraints to trigger EPIPE (0792e1e Azat Khuzhin)
+ o test/tinytest_demo: include <windows.h> for win32 to fix tdm-gcc (f062bbe Azat Khuzhin)
+ o test/regress: cover event_del() waiting mechanism (5b58b70 Azat Khuzhin)
+ o test/regress: cover existing signal callbacks and fork() + event_reinit() (ceddc60 Azat Khuzhin)
+ o test/regress: cover signals after fork() + event_reinit() (b075b81 Azat Khuzhin)
+ o test/regress: main/fork: rewrite assertions by just removing event in callback (088d8b3 Azat Khuzhin)
+ o test/dns: check exit code of evdns_getaddrinfo() (0b9d432 Azat Khuzhin)
+ o test/dns: cover evdns_getaddrinfo() and evdns_base_free() with @fail_requests (4ad3483 Azat Khuzhin)
+ o test/dns: cover @fail_requests for evdns_base_free() (d6c6fb4 Azat Khuzhin)
+ o test/dns: more graceful coverage of @fail_requests (123d372 Azat Khuzhin)
+ o test/ssl: cover busy-loop (i.e. {read,write}-blocked-on-{write,read} stuff) (da0ea7a Azat Khuzhin)
+ o test/http: write_during_read for https (23c77b6 Azat Khuzhin)
+ o test/http: connection_fail for https (7ea26f7 Azat Khuzhin)
+ o test/http: stream_out for https (ac04968 Azat Khuzhin)
+ o test/http: chunk_out for https (a71ffb9 Azat Khuzhin)
+ o test/regress: fix ssl-less builds (need to make this prettier) (3160716 Azat Khuzhin)
+ o test/http: allow dirty shutdown for ssl to fix https_incomplete (1ede326 Azat Khuzhin)
+ o test/http: https basic (59714b4 Azat Khuzhin)
+ o test/http: incomplete{,_timeout} for https (615490d Azat Khuzhin)
+ o test/http: add simplest test for http/https/https_dirty_shutdown (93b19dc Azat Khuzhin)
+ o test/http: https: retry coverage (7c2d24a Azat Khuzhin)
+ o test/http: https server support (plus some helpers) (a7088ad Azat Khuzhin)
+ o test/http: more sanity checks (a27c53c Azat Khuzhin)
+ o test/ssl: export getkey()/getcert()/get_ssl_ctx()/init_ssl() for https (0c4c387 Azat Khuzhin)
+ o test/regress_be: basic coverage bufferevent_flush() for pair/sock layers (ad52602 Azat Khuzhin)
+ o test/regress_be: socket_filter_inactive: check bufferevent after creation (f8081af Azat Khuzhin)
+ o test/regress_be: cover finalizers from inactive to active queue (337684b Azat Khuzhin)
+ o test/regress_buffer: fix clang compilation warnings (d8fd4c0 Azat Khuzhin)
+ o test/regress_http: fix compilation warnings (-Wmissing-field-initializers) (cd422e0 Azat Khuzhin)
+ o test/regress_dns: fix compilation warnings (-Wmissing-field-initializers/for) (f55db98 Azat Khuzhin)
+ o tests/regress_dns: cover that randomize-case works case-insensitive (1e8bfbc Azat Khuzhin)
+ o test: fix bufferevent/bufferevent_pair_release_lock in debug mode (3f749e9 Azat Khuzhin)
+ o test: fix bufferevent/bufferevent_pair_release_lock for freebsd (79f9ace Azat Khuzhin)
+ o test/regress_be: bufferevent_enable() shouldn't call eventcb by it's own (a0f308d Azat Khuzhin)
+ o test/regress_be: introduce fake_listener_create() (37dc9e0 Azat Khuzhin)
+ o test/regress_http: cover evhttp_request_own() (6f6fa0d Azat Khuzhin)
+ o test/regress_http: cover write during read (3d15aeb Azat Khuzhin)
+ o test/regress_http: verify that closecb will be called without multiple write (4be6c70 Azat Khuzhin)
+ o test/regress: fix bufferevent_pair_release_lock with EVENT_DEBUG_MODE (6ea6655 Azat Khuzhin)
+ o test/regress_ssl: check events fd/pending after timeout triggered (cdafdf0 Azat Khuzhin)
+ o test/regress_ssl: cover case when server didn't up (failed with timeout) (74845f1 Azat Khuzhin)
+ o test/regress_ssl: covert that we can't change fd with underlying (df507af Azat Khuzhin)
+ o test/regress_ssl: cover that events (read/write) at finish not pending (762edb4 Azat Khuzhin)
+ o test/regress_ssl: cover fd manipulations (b78a829 Azat Khuzhin)
+ o test/regress_ssl: convert open_ssl_bufevs() to mask (46bba73 Azat Khuzhin)
+ o test/regress_ssl: convert client/server to mask too (3455991 Azat Khuzhin)
+ o test/regress_ssl: cover "allow_dirty_shutdown" (0430327 Azat Khuzhin)
+ o test/regress_ssl: convert regress_bufferevent_openssl() to bitmask (342e116 Azat Khuzhin)
+ o tests/regress_ssl: drop duplicated assert (25e56fd Azat Khuzhin)
+ o test/regress_http: initialize "dns_base" to avoid reading trash (9f0bff3 Azat Khuzhin)
+ o test/http: cover retrying with saved conn_address by shutting down dns server (f4874d8 Azat Khuzhin)
+ o be_pair/regress: cover use of shared lock (lock/unlock/free) (a558fcd Azat Khuzhin)
+ o regress_dns: drop hack for event_debug_map_HT_GROW in leak tests (3540a19 Azat Khuzhin)
+
+ Sample code
+ o Fix memory leak in signal-test.c (666db91 basavesh.as)
+ o sample/hello-world: exAmple, not eXMple (2d3cd35 kirillDanshin)
+ o dns-example: allow to set ns from args (df19a97 Azat Khuzhin)
+ o dns-example: convert to getopt() (32f8592 Azat Khuzhin)
+ o http-connect: make it win32 compilable (1bf7595 Azat Khuzhin)
+ o sample/https-client: allow to change path to ca-certificates (fdf713a Azat Khuzhin)
+ o sample/https-client: check for ERR_remove_thread_state() existence (c4e9d9b Azat Khuzhin)
+ o sample/https-client: replace ERR_remove_state() by ERR_remove_thread_state() (77ad68a Azat Khuzhin)
+ o sample/https-client: add -timeout option (4637aa8 Azat Khuzhin)
+ o sample/https-client: don't try to free uninitialized SSL (f3d7ff5 Azat Khuzhin)
+ o sample/https-client: graceful exit with freeing memory (to make valgrind happy) (24a1f25 Azat Khuzhin)
+ o https-client: correctly handle URLs with no path (like "https://host:port") (29a0482 Andrey Skriabin)
+ o sample/http-connect: don't use assert() to make it work with NDEBUG (6dc71e7 Azat Khuzhin)
+ o sample/http-connect: made it compatible with C90 (f976d43 Azat Khuzhin)
+ o sample: add HTTP CONNECT tunnelling example using libevent http layer (1d34498 Azat Khuzhin)
+ o Update dns-example. (620ff24 Mark Ellzey)
+
+ Documentation
+ o Update README.md (b8ec70c Mark Ellzey)
+ o Update README.md (80faee9 Mark Ellzey)
+ o Update README.md (ad4a897 Mark Ellzey)
+ o Update README.md (a2b2e1e Mark Ellzey)
+ o Update README.md (0dfa5dc Mark Ellzey)
+
+ Code Improvements (evthread)
+ o evthread: add evthread_get_{lock,condition}_callbacks() helpers (c0b34f6 Azat Khuzhin)
+
+ Code Improvements (core)
+ o util: make @sa const for evutil_socket_connect_() (a8d32c2 Azat Khuzhin)
+
+ Code Improvements (http)
+ o http: assert's that evbuffer_drain() success on connection reset (2185e63 Azat Khuzhin)
+ o http: introduce evhttp_request_free_() helper (22061ac Azat Khuzhin)
+ o http: introduce evhttp_is_request_connection_close() helper (6540da3 Azat Khuzhin)
+
+ Code Improvements (bufferevents)
+ o be_sock: bufferevent_socket_set_conn_address(): assert instead of silent no-op (0ab88c2 Azat Khuzhin)
+ o be_sock: sanity check in bufferevent_socket_set_conn_address() (eedbeff Azat Khuzhin)
+ o be: replace sockaddr_storage with sockaddr_in6 for conn_address (3889612 Azat Khuzhin)
+ o be: replace conn_address by full struct instead of pointer (e5615aa Azat Khuzhin)
+ o bufferevent: move conn_address out from http into bufferevent (8bb3842 Azat Khuzhin)
+ o be: make @sa const for bufferevent_socket_connect() (dc33c78 Azat Khuzhin)
+
+ Cleanups (core)
+ o Refactoring conditional directives that break parts of statements. (4b41eeb lzmths)
+ o epoll: introduce PRINT_CHANGES() macro to avoid copy-pasting (a1b142b Azat Khuzhin)
+ o tab (6e7a580 Greg Hazel)
+
+ Cleanups (evbuffers)
+ o buffer_compat: fix comment -- we have EVBUFFER_EOL_ANY not EOL_STYLE_ANY (575ff67 Azat Khuzhin)
+
+ Cleanups (bufferevents)
+ o be_sock: evutil_getaddrinfo_async_() always return 0 (dbff101 Azat Khuzhin)
+ o be_sock: drop be_sock_add() macro (useless and debug unfriendly) (fad5fe2 Azat Khuzhin)
+ o be: introduce bufferevent_generic_adj_existing_timeouts_() (3c1f58f Azat Khuzhin)
+ o be: add_event: use evutil_timerisset() (a96b73b Azat Khuzhin)
+ o be_openssl: introduce be_openssl_auto_fd() helper (2a8a711 Azat Khuzhin)
+ o be_openssl: introduce set_open_callbacks_auto() (510da71 Azat Khuzhin)
+
+ Cleanups (http)
+ o http: make fallback for EVHTTP_CON_READ_ON_WRITE_ERROR more cleaner (d405492 Azat Khuzhin)
+ o http: coding style issue (365f181 Azat Khuzhin)
+
+ Cleanups (evdns)
+ o evnds: inline TEST_NAME macro to make debuggin easier (0c615f4 Azat Khuzhin)
+
+ Portability Fixes
+ o [#372] check for errno.h (3031617 Mark Ellzey)
+ o Fixed Unicode issue in error messages. (e8b7895 Mattes D)
+ o Assume that ke_udata is an integer type on CloudABI. (5602e45 Ed Schouten)
+ o Add missing include of <netinet/in.h>. (b2c68bc Ed Schouten)
+ o Include <sys/ioctl.h>, <sys/resource.h> and <sys/wait.h> optionally. (c1404b5 Ed Schouten)
+ o Test against SO_REUSEADDR (along with _WIN32). (ce1776c Ed Schouten)
+ o Always define missing TAILQ functions from sys/queue.h (2828bdb Christopher Wiley)
+ o Don't use BSD u_* types. (fd36647 Ed Schouten)
+ o Remove BSD-ism: TIMEVAL_TO_TIMESPEC(). (193c7de Ed Schouten)
+ o be: include all variations of headers for sockaddr_in6 struct (c212291 Azat Khuzhin)
+ o be: fix sockaddr_in6 type definition for win32 (c42bc6b Azat Khuzhin)
+
+ Continious Integration:
+ o travis: split long lines, and make it cleaner (685a6a1 Azat Khuzhin)
+ o travis: fix autotools on osx by reinstalling libtool (088ea5e Azat Khuzhin)
+ o appveyor/autotools: link with openssl by passing LDFLAGS/CFLAGS (6fcfa25 Azat Khuzhin)
+ o appveyor: image already had openssl installed (4634b85 Azat Khuzhin)
+ o appveyor: check -DUNICODE -D_UNICODE according to ReleaseChecklist (cmake only) (e9acc44 Azat Khuzhin)
+ o appveyor: ignore failure of mingw-get (1810857 Azat Khuzhin)
+ o appveyor: drop shallow_clone, since we use tags for detecting version in cmake (ac90133 Azat Khuzhin)
+ o appveyor: support cmake & autotools using build matrix (like travis-ci has) (8f95015 Azat Khuzhin)
+ o travis-ci/osx: relink gcc/g++ instead of clang (481481d Azat Khuzhin)
+ o travis-ci: enable multi-os mode (osx, linux) (79917e4 Azat Khuzhin)
+ o travis-ci: increase matrix (--disable-foo) (59649f7 Azat Khuzhin)
+ o travis-ci: adjust alignment (c8be339 Azat Khuzhin)
+ o travis: add builds without debug mode into matrix (3e56da2 Azat Khuzhin)
+ o test: run regress with EVENT_DEBUG_MODE=1 and without (cf2cf2a Azat Khuzhin)
+ o Update travis config for status updates (37453ab Mark Ellzey)
+ o Use autotools for appveyor until cmake is fixed. (1cc2e29 Mark Ellzey)
+ o Fix the link for appveyor OpenSSL installer (WIN32) (107d565 Mark Ellzey)
+ o Forgot to install OpenSSL for appveyor (26164a5 Joakim Söderberg)
+ o Add support for appveyor.com windows CI (5f89c37 Joakim Söderberg)
+
+ Build Improvements/Fixes:
+ o evutil: mark ai_find_protocol() static (prototype-less) (5a157c8 Azat Khuzhin)
+ o cmake/solaris: set CMAKE_REQUIRED_LIBRARIES to fix functions detections (dc95823 Azat Khuzhin)
+ o cmake/solaris: fix building (link with socket,nsl) (050bfc7 Azat Khuzhin)
+ o cmake: check for ZLIB_INCLUDE_DIR, since we can have only library without headers (c4dfb93 Azat Khuzhin)
+ o autotools/win32: fix searching ssl library (671a24f Azat Khuzhin)
+ o cmake/win32: do not compile regress_thread on -DEVENT__DISABLE_THREAD_SUPPORT=ON (de0c196 Azat Khuzhin)
+ o cmake/win32: do not compile evthread_win32 on -DEVENT__DISABLE_THREAD_SUPPORT=ON (ecb0ec8 Azat Khuzhin)
+ o cmake: fix -DEVENT__ENABLE_VERBOSE_DEBUG (typo on -DUSE_DEBUG) (e35f224 Azat Khuzhin)
+ o cmake: do not use stderr for notifications/version-info (38716c6 Azat Khuzhin)
+ o autoconf: fix --disable-thread-support build under win32 (bb09535 Azat Khuzhin)
+ o buffer: don't mix code and declarations (8892f4c Azat Khuzhin)
+ o Update gitignore file to ignore cscope gen'ed files (0aaa4fb Neeraj Badlani)
+ o For non GCC/clang on OSX the -Wno-deprecated-declarations may not be valid (b5ca365 Rainer Keller)
+ o automake: define serial-tests only if automake have this option (61179de Azat Khuzhin)
+ o test/automake: don't use paralell test harness (since automake 1.12) (44d755e Azat Khuzhin)
+ o Ignore all pkgconfig generated stuff (ce38993 Azat Khuzhin)
+ o libevent_core and libevent_extra also deserve a pkgconfig file (b8d7c62 Jan Heylen)
+ o Ignore verify_tests.bat (win32 version) (0f2de10 Azat Khuzhin)
+ o cmake: require 3.1 only for win32 to make it work under ubunty precise (87f7238 Azat Khuzhin)
+ o cmake: require at least 3.1 for target_sources() (c46ead5 Azat Khuzhin)
+ o cmake: fix adding of compiler flags, and now it will (36588e1 Azat Khuzhin)
+ o Replace -Wswitch-enum with -Wswitch, and add it into cmake rules too (f29f59e Azat Khuzhin)
+ o test/regress_ssl: Fix compile problems for win32 (73d0360 Trond Norbye)
+ o util: fix "%zu" format on TDM-gcc/MinGW-w64 (79b69d8 Azat Khuzhin)
+ o cmake: don't define EVENT__NEED_DLLIMPORT always (fixes VS2013 static build) (49bd790 Azat Khuzhin)
+ o Add missing return statement to del_wait_thread so libevent can build. (4f778ab Nick Mathewson)
+ o cmake: fix building dns-example under win32 (missing getopt) (a1609a8 Azat Khuzhin)
+ o visibility: align it to make it more readable (bb6b53d Azat Khuzhin)
+ o cmake: Fix detection of ssize_t/SSIZE_T (7707f6b Azat Khuzhin)
+ o Ignore more configure stuff (configure.lineno) (8d34302 Azat Khuzhin)
+ o Fixed issue with cmake version generation (d56efd9 Mark Ellzey)
+ o Cmake is now officially working. (7f9646d Mark Ellzey)
+ o More cmake updates, lot's of missing definitions (49a5381 Mark Ellzey)
+ o CMake syntax fixes fo .in files (6aad23d Mark Ellzey)
+ o Revert "The Windows socket type is defined as SOCKET." (a264da8 Mark Ellzey)
+ o CMAKE CMAKE CMAKE CLEANUPS (a9db46a Mark Ellzey)
+ o Lot's of cmake updates (8b228e2 Mark Ellzey)
+ o Provide a mechanism for building the library on Windows with different compiler flags. Add a batch file that builds it for the M[DT][d] options and performs a hunt and gather of the different output libraries. (ded8086 billsegall)
+ o The Windows socket type is defined as SOCKET. (c9e6c3d billsegall)
+ o autotools: fix getservbyname() detection (959a4c2 Azat Khuzhin)
+ o Add missing <string.h> for openssl_hostname_validation module (3316a21 Azat Khuzhin)
+ o make test/regress_ssl.c compile without warnings (9f02a44 Thomas Bernard)
+ o test/regress_be: drop debug __asm__(int3) to fix arm build (8240379 Azat Khuzhin)
+ o event_debug_created_threadable_ctx_: fix compilation without debug mode (a068f2e Azat Khuzhin)
+ o Add a prototype for event_disable_debug_mode() (bfcedee Sebastian Hahn)
+ o http: eliminate warning about "socklen" in evhttp_connection_connect_() (dfad1a4 Azat Khuzhin)
+ o Updated gitignore (1dbb55d Mark Ellzey)
+ o Update bench_httpclient.c (cb96931 Seungmo Koo)
+ o *fix: bench_httpclient to support win32 (4e9325e zeliard)
+ o Commented out a WIN32 threading / timing test for now (e84e269 Mark Ellzey)
+ o Fix mixed declarations and code (forbidden by ISO C90) (0c7f217 Thomas Bernard)
+ o Fix "function declaration isn’t a prototype" (746d2c5 Thomas Bernard)
+ o This fixes a bug introduced in 27bd9faf498b91923296cc91643e03ec4055c230 (19ba454 Joakim Söderberg)
+ o changed strtotimeval signature as per #211 (bdbc823 Xiao Bao Clark)
+ o Added cmake-generated files to ignore list. (6c12bfe Matyas Dolak)
+ o Ignore `make dist` generated files (8a2c6c7 Azat Khuzhin)
+
+ Debugging
+ o Debug mode option to error on evthread init AFTER other event calls. (dcfb19a Mark Ellzey)
+
+
+
+Changes in version 2.1.5-beta (5 January 2015)
+
+ Security Fixes (evbuffers)
+ o Avoid integer overflow bugs in evbuffer_add() and related functions. See CVE-2014-6272 advisory for more information. (d49bc0e88b81a5812116074dc007f1db0ca1eecd)
+
+ New APIs (evconnlistener)
+ o Provide support for SO_REUSEPORT through LEV_OPT_REUSABLE_PORT (b625361 Maciej Soltysiak)
+
+ Bugfixes (core)
+ o Fix use-after-free error in EV_CLOSURE_EVENT callback (3cc0eac John Ohl)
+ o Fix race caused by event_active (3c7d6fc vjpai)
+
+ Bugfixes (evbuffer)
+ o Fix evbuffer_peek() with len==-1 and start_at non-NULL. (ba59923)
+ o Consistently check for failure from evbuffer_pullup() (60f8f72)
+ o Fix evbuffer_peek() with len==-1 and start_at non-NULL. (fb7e76a)
+
+ Bugfixes (windows, IOCP)
+ o be async: avoid double close() (f133b86 Azat Khuzhin)
+
+ Bugfixes (bufferevents)
+ o Fix issue #127, double free for filterevents that use BEV_OPT_CLOSE_ON_FREE (2c82aa0 John Ohl)
+ o make bufferevent_getwatermark api more robust (a21e510 ufo2243)
+ o [Bugfix] fix bufferevent setwatermark suspend_read (b34e4ac ufo2243)
+ o bufferevent_openssl: reset fd_is_set when setfd with -1 is called (3da84c2 Azat Khuzhin)
+ o Fix compilation for older OpenSSL versions. (5c7282f Joakim Soderberg)
+
+ New APIs (evhttp)
+ o Add evhttp_connection_set_family() to set addrinfo->family for DNS requests (12c29b0 Azat Khuzhin)
+ o Implement interface that provides the ability to have an outbound evhttp_connection free itself once all requests have completed (2b9ec4c,10fe4f John Ohl)
+
+ New APIs (core)
+ o Implement new/free for struct evutil_monotonic_timer and export monotonic time functions (f2645f8 Andrea Shepard)
+
+ Bugfixes (evdns)
+ o Load hosts file on Windows. (a0b247c Vilmos Nebehaj)
+ o Don't truncate hosts file path on Windows. (d0dc861 Vilmos Nebehaj)
+ o Fix a crash in evdns related to shutting down evdns (9f39c88,e8fe749)
+ o evdns: avoid read-after-free in evdns_request_timeout_callback() (61262a0 Azat Khuzhin)
+ o Correctly handle allocation failures in evdns_getaddrinfo (6a53d15)
+ o evdns: fix EVDNS_BASE_DISABLE_WHEN_INACTIVE in case retransmit/retry (74d0eee Azat Khuzhin)
+ o evdns: add retry/reissue tests for EVDNS_BASE_DISABLE_WHEN_INACTIVE (3ca9d43 Azat Khuzhin)
+ o evdns: fail ns after we are failing/retrasmitting request (97c750d Azat Khuzhin)
+
+ Bugfixes (evhttp)
+ o http: reset connection before installing retry timer (fix http retries handling) (bc79cc5 Azat Khuzhin)
+
+
+ Testing
+ o regress_dns: fix leaks in getaddrinfo_async{,_cancel_stress} tests (2fdc5f2 Azat Khuzhin)
+ o test: add family argument for http_connection_test_() (177b8a7 Azat Khuzhin)
+ o test: add regress for evhttp_connection_set_family() with AF_INET and AF_UNSPEC (42aefeb Azat Khuzhin)
+ o test/http: add regress test for set family to AF_INET6 (3fbf3cc Azat Khuzhin)
+ o Update to a more recent tinytest_macros. (8da5a18)
+ o test/regress: add simplestsignal: to track reorder bugs separately (b897bef Azat Khuzhin)
+ o test/evbuffer_peek: add regress in case we have first buffer greater (e2d139d Azat Khuzhin)
+ o More evbuffer_peek() test cases (154006a)
+ o use correct tt macro for pointer compare (08c88ea)
+ o regress_buffer: fix 'memcmp' compare size (79800df Maks Naumov)
+ o Fix a use-after-free in unit tests. CID 752027 (3739057)
+ o Fix a dead-code warning in unit tests. CID 1193548 (c119f24)
+ o Use evutil_weakrand() in unit tests. (a677b72, 364c110)
+ o Use a more precise calculation for max in time-ratelim.c (ca5b5c7)
+ o Make a buffer larger in the tests to avoid a scary evbuffer_copyout_from() (fb57b8b)
+ o Fix several memory leaks in the unit tests. (89c1a3b)
+ o Add test for evhttp_connection_free_on_completion (b0e9924 John Ohl)
+ o Fix annoying heisenbug in test-time.c (cb73704)
+
+ Sample code
+ o Make http-server.c output into good html5 (6d72bdc)
+ o Use FindClose for handle from FindFirstFile in http-server.c (6466e88)
+ o https-client: add -retries argument, for connection retries (d9da844 Azat Khuzhin)
+
+ Bugfixes (build)
+ o Add missing headerfile for cmake (15d90cc Trond Norbye)
+ o ignore one more test binary (b6593aa Michael Richardson)
+ o ignore config.cache/test-driver files (c83f333 Mike Frysinger)
+ o add a --disable-samples configure flag (0c492b3 Mike Frysinger)
+ o Add a few files created by "make verify" to .gitignore. (1a8295a Pierre Phaneuf)
+ o updates in cmake build (27bd9fa Sergey Nikulov)
+ o Fix cmake error when the Module path has more than one entry. (befbd13 Acer Yang)
+ o Fix CMake shared library build (e69d910 Nobuaki Sukegawa)
+ o Fix warnings when compiling with clang 3.5 (f5b4765 John Ohl)
+ o Fix mixed declarations and code (forbidden by ISO C90) (8afbdbc Thomas Bernard)
+
+ Bugfixes (miscellaneous)
+ o tree.h: drop duplicated content of tree.h (6193187 Azat Khuzhin)
+ o evdns: disable probing with EVDNS_BASE_DISABLE_WHEN_INACTIVE (610410b,ad0493e,fea86a6,d83b337,5ca9e97 Azat Khuzhin)
+ o [Bugfix] fix grammer error (3a4d249 ufo2243)
+ o Change return type of evutil_load_windows_system_library_ to HMODULE (f691389)
+ o Fix a c90 warning (76643dd)
+ o Fix a typo in a doxygen comment. Reported by 亦得. (be1aeff)
+ o remove trailing comma from enum (b361b8a Jean-Philippe Ouellet)
+
+ Bugfixes (FreeBSD)
+ o Handle ENOTCAPABLE from FreeBSD - this is returned if an event in the changelist is for an FD that has been closed. (6fd7394 Adrian Chadd)
+
+
+
+Changes in version 2.1.4-alpha (21 Mar 2014)
+
+ Libevent 2.1.4-alpha adds a number of new miscellaneous APIs to make
+ Libevent more useful, including support for early close detection with
+ epoll via EPOLLRDHUP, triggering bufferevent callbacks, adding more
+ evhttp callbacks, and more. There are also numerous bugfixes, including
+ a number for finalize-related issues from 2.1.3-alpha; and an
+ alternative (non-primary!) cmake-based build mechanism.
+
+ New APIs (core)
+ o Added event_base_get_num_events() (0fa107d Mobai Zhang)
+ o New event_base_active_by_fd API (865a142 Greg Hazel, 5c9da9a, 87fa2b0)
+ o Add event_base_active_by_signal by analogy (4865943)
+ o Add access to max event count stats (5173bef, efbd3dc, 26230a2
+ Andrew Sweeney)
+ o Implemented EV_CLOSED event for epoll backend
+ (EPOLLRDHUP). (b1b69ac Diego Giagio, 53d2793, 43ffcf6, dfe1e52
+ Marcin Juszkiewicz, ff26633 Joakim Soderberg, 3908a5e)
+
+ New APIs (evutil_secure_rng)
+ o Add evutil_secure_rng_set_urandom_device_file (2bbb5d7)
+
+ New APIs (bufferevents)
+ o Add function to fetch underlying ratelimit cfg (4b3d5af Mark Ellzey)
+ o Pass and return const for bufferevent_get_token_bucket_cfg (1c77fbb
+ Mark Ellzey)
+ o Add watermark introspection (4ce242b Ondřej Kuzník)
+ o Add an option to trigger bufferevent I/O callbacks (61ee18b Ondřej Kuzník)
+ o Add an option to trigger bufferevent event callbacks (a7384c7
+ Ondřej Kuzník)
+ o Clarifications in response to merge req. comments (bd41947 Ondřej
+ Kuzník)
+ o Minor optimizations on bufferevent_trigger options (a3172a4)
+
+ New APIs (evhttp)
+ o Add evhttp_connection_get_server(). (a7f82a3 Maxime Henrion)
+ o add a http default content type option (5a5acd9 Nicolas Martyanoff)
+ o http: implement new evhttp_connection_get_addr() api. (0c7f040 Azat
+ Khuzhin)
+ o Add a variant of evhttp_send_reply_chunk() with a callback on
+ evhttp_write_buffer() (8d8decf Julien BLACHE)
+ o Allow registering callback for parsing HTTP headers (b0bd7fe Balint Reczey)
+ o Provide on request complete callback facility (b083ca0 Andrew Sweeney)
+ o evhttp_request_set_on_complete_cb to be more specific about what
+ the function actually does and usage (da86dda Andrew Sweeney)
+ o Update unit test to make sure that the callback happens after the
+ output data is written (b85f398 Andrew Sweeney)
+
+ Features (evdns)
+ o bug fix for issues #293 evdns_base_load_hosts doesn't remove
+ outdated addresses (954d2f9, f03d353, 45eba6f Kuldeep Gupta)
+
+ Features: (cmake build support)
+ o Initial CMake commit. (e415196 Joakim Soderberg)
+ o Add all tests and benchmarks to CMake project. (e9fc014 Joakim Soderberg)
+ o More work on adding tests to CMake project (99c1dc3 Joakim Soderberg)
+ o Generate a dummy evconfig-private.h so things build
+ properly. (ce14def Joakim Soderberg)
+ o Link libm on unix platforms. (58fcd42 Joakim Soderberg)
+ o Added some GCC specific options. (19222e5 Joakim Soderberg)
+ o Use evutil_closesocket instead. (dbf2b51 Joakim Soderberg)
+ o Add copyright and licensing files for CMake modules. (c259d53
+ Joakim Soderberg)
+ o Only include WIN32 getopt where it is used. (9bbce0b Joakim Soderberg)
+ o Fix bench_cascade program on Windows. (78da644 Joakim Soderberg)
+ o Don't segfault on no found event backend. (8f2af50 Joakim Soderberg)
+ o Only test the event backends available on the system. (7ea4159
+ Joakim Soderberg)
+ o Added a "make verify" target. (e053c4f Joakim Soderberg)
+ o Fix the make "verify" target on Windows. (67e5d74 Joakim Soderberg)
+ o Get rid of deprecation warnings for OpenSSL on OSX 10.7+ (69c3516
+ Joakim Söderberg)
+ o Fix kqueue support. (a831f2f Joakim Söderberg)
+ o Added a test for testing if kqueue works with pipes. (2799b35
+ Joakim Söderberg)
+ o Change the BSD license from 4 to 3-clause. (86df3ed Joakim Soderberg)
+ o Minimum required python version is 2.4. (968e97b Joakim Soderberg)
+ o Get rid of unknown pragma warnings. (0ef1d04 Joakim Soderberg)
+ o Add a "make verify_coverage" target generation coverage
+ info. (f2483f8 Joakim Soderberg)
+ o Fix the "make verify" target on NetBSD (4ac086a Joakim Soderberg)
+ o Only look for ZLib when it is used (if tests are
+ included). (f780593 Joakim Soderberg)
+ o Added EVENT__ENABLE_GCC_WARNINGS, turns all warnings into
+ errors. (dd413bd Joakim Soderberg)
+ o Add CMake config and install targets. (f3446ed Joakim Soderberg)
+ o Fix typo (4b754df Joakim Soderberg)
+ o Some work on making it possible to simply do add_subdirectory() on
+ the project. (49ab363 Joakim Soderberg)
+ o Set USE_DEBUG=1 on EVENT__ENABLE_VERBOSE_DEBUG (fd42e70 Joakim Soderberg)
+ o Fix so that old nmake project still builds. (24d6466 Joakim
+ Soderberg)
+ o Rename README to README.md and use markdown to format. (d2bc39a
+ Joakim Soderberg)
+ o Update README with CMake build instructions. (604b8cc Joakim Soderberg)
+ o Clean up the README some. (8d4cb35 JoakimSoderberg)
+ o Forgotten headers for old nmake project compatability. (8697b99
+ Joakim Soderberg)
+ o Change all uses of WIN32 to _WIN32 (4e14395 Joakim Söderberg)
+ o Fix include bug. (2024467 Joakim Söderberg)
+ o Check if we're on OSX before disabling deprecation in le-proxy
+ (8b40a5b Joakim Söderberg)
+ o Fix broken autotools build. (ae1bd82 Joakim Söderberg)
+ o Disclaimerize cmake a little in the README (d03b5bf)
+ o Fix CMake compile when OpenSSL is disabled. (e423d42 Joakim
+ Söderberg)
+ o CMake: Get rid of python not found warning when regress tests
+ turned off. (d38d798 Joakim Söderberg)
+ o Fix https-client compilation on Windows. (d7be788 Joakim Soderberg)
+ o Guard against EVENT_NOWIN32 being set during testing. (f1715b4
+ Joakim Soderberg)
+ o Check for OSX when checking for clang. (e212c54 Joakim Soderberg)
+ o Added a Travis-CI configuration file. (8c0f0a9 Joakim Soderberg)
+ o Added -Qunused-arguments for clang on macosx (ed99d92 Trond Norbye)
+ o Rename event_extras to event_extra (a0dd5df Trond Norbye)
+ o Add option to build shared library (4545fa9 Trond Norbye)
+ o Add -Qunused-arguments for clang on macos (b56611d Trond Norbye)
+ o Add cmake-related files to .gitignore (e061321 Trond Norbye)
+ o Export event_extra not event_extras. (2b41bcf Joakim Söderberg)
+
+ Bugfixes (core)
+ o If evsel->del() fails, don't leave the evmap in an inconsistent
+ state (9b5a527 Maxime Henrion)
+ o Move event_debug_note_teardown_ before mm_free. (69b5c64)
+ o Check CLOCK_MONOTONIC_* at runtime if needed. (911abf3)
+ o Fix reinit of fds with EV_WRITE but not EV_READ. (ebfd8a8 maksqwe)
+ o Tweaked callbacks to prevent race condition
+ (https://github.com/libevent/libevent/issues/104) (40830f1, 2ea15ed
+ John Ohl)
+ o Move assert(ev) to before we use ev in EV_CLOSURE_EVENT_FINALIZE
+ case (9805972)
+
+ Bugfixes (evhttp)
+ o Fix a double close() bug in evhttp when the underlying bufferevent uses
+ BEV_OPT_CLOSE_ON_FREE. (31db8a0 Maxime Henrion)
+ o Fix an unlikely but possible error case for http connections (f22049e)
+ o Avoid racy bufferevent activation (5eb1788 Nate Rosenblum)
+
+ Bugfixes on 2.0 (Windows)
+ o Use windows vsnprintf fixup logic on all windows environments (e826f19)
+ o libevent/win32_dealloc() : fix sizeof(pointer) vs sizeof(*pointer)
+ (b8f5980 Frank Denis)
+
+ Bugfixes (evutil_secure_rng)
+ o When we seed from /proc/sys/kernel/random/uuid, count it as success
+ (e35b540)
+ o We should return after arc4random_buf() (1ea1f26 Makoto Kato)
+ o Avoid other RNG initialization FS reads when urandom file is
+ specified (9695e9c)
+ o Really remove RNG seeds from the stack (f5ced88)
+ o Fix another arc4random_buf-related warning (e64a2b0)
+
+ Bugfixes (bufferevents)
+ o Initialize async bufferevent timeout CBs unconditionally (af9b2a7)
+
+ Bugfixes (evdns)
+ o Checking request nameserver for NULL, before using it. (5c710c0
+ Belobrov Andrey)
+ o Fix SEGFAULT after evdns_base_resume if no nameservers
+ installed. (14971a8 Azat Khuzhin)
+ o Actually use the log facility for reporting evdns problems. (e1766a1)
+ o Fix SEGFAULT after evdns_base_resume if no nameservers
+ installed. (f8d7df8 Azat Khuzhin)
+ o fix for ServFail from RIPE Atlas release (62f596b Antony Antony)
+
+ Bugfixes (compilation)
+ o Fix test compilation with nmake: add the gdi.lib dependency (5ba8ab7)
+ o Whoops. It is gdi.lib, not gdi32.lib. (github issue #61) (8ab612e)
+ o Don't use return since return type is void and build error occurs
+ using clang (838161d Makoto Kato)
+ o Use void casts to suppress some "unchecked return value" warns (7080d55)
+ o rpcgen: Generate regress.gen.[c,h] in build rather than src dir
+ (243386c Ross Lagerwall)
+ o Fix a compiler warning when checking for arc4random_buf linker
+ breakage. (5cb3865)
+ o Fix 'make distcheck' by adding regress.gen.[ch] to DISTCLEANFILES
+ (239d834)
+
+ o Fix a c90 warning (c207682)
+ o Fix consts in WIN32-Code/getopt*.[ch] (57abb35)
+
+ Bugfixes (locks, synchronization)
+ o Missed lock acquire/release in event_base_cancel_single_callback_()
+ (d3d999a Azat Khuzhin)
+ o Fix locking in bufferevent_get_options_(). (dbc9cd4 Maxime Henrion)
+
+ Bugfixes (leaks)
+ o Avoid leaking segment mappings when offset is not a page multiple (d409514)
+
+ Testing
+ o Add tests for evdns_base_resume(). (1cd9ff5 Azat Khuzhin)
+ o Fix dns/leak_resume_send_err test. (7e876df Azat Khuzhin)
+ o Add checks for evhttp_connection_get_server() in unit
+ tests. (fbc323b Maxime Henrion)
+ o Fix a (failure-only) null dereference in the unit tests (1104d0b)
+ o Fix a logic error in test_evbuffer_freeze (7765884)
+ o Add missing check to test_evbuffer_file_segment_add_cleanup_cb (eba4506)
+ o Fix some crash-on-fail cases in DNS regression tests (87cd6f0)
+ o DNS tests: add a missing check (f314900)
+ o Finalize tests: add a missing check (82b6956)
+ o test_evutil_rtrim: add another missing check. (e193c95)
+ o regress_main: logging all if env EVENT_DEBUG_LOGGING_ALL isset
+ (611e28b Azat Khuzhin)
+ o regress_http: add tests for evhttp_connection_get_addr() (4dd500c
+ Azat Khuzhin)
+ o Update to the latest version of tinytest (7a80476)
+ o Heap-allocate zlib data structure in regress_zlib tests (4947c18)
+
+ Performance tweaks (core)
+ o Avoid redundant syscall to make a nonblocking socket nonblocking
+ (42c03da Maxime Henrion)
+ o Avoid redundant syscall if making a socket cloexec twice (1f29b18)
+ o Avoid redundant invocations of init_extension_functions for IOCP (3b77d62)
+
+ Documentation
+ o Document that arc4random is not a great cryptographic PRNG. (6e49696)
+ o Small doxygen tweaks (6e67b51)
+ o Try another doxygen tweak (ccf432b)
+ o Clarify event_base_loop exit conditions (031a803)
+ o Fix a typo (be7bf2c Ondřej Kuzník)
+ o Document deferred eventcb behaviour (13a9a02 Ondřej Kuzník)
+ o Typo fixes from Linus Nordberg (cec62cb, 8cd695b)
+ o Fix duplicate paragraph in evbuffer_ptr documentation (58408ee)
+
+ Code Improvements (coverity)
+ o Fix a pile of coverity warnings in the unit tests (867f401)
+ o Fix coverity warnings in benchmark tools. (ff7f739)
+ o Whoops; fix compilation in bench.c (544cf88)
+ o Remove spurious checks in evrpc.c error cases (coverity) (991b362)
+ o Fix a couple of compilation warnings in regress_http.c (860767e)
+ o Fix even more coverity warnings. (d240328)
+ o Stop checking for inet_aton; we don't use it. (f665d5c)
+ o Add an include to evrpc-internal to fix openbsd compilation warning
+ (5e161c6)
+
+ Cleanups
+ o Remove an unreachable return statement in minheap-internal.h (e639a9e)
+ o Refactor evmap_{io,signal}_active_() to tolerate bad inputs (974c60e)
+ o Fix needless bufferevent includes in evdns.c (254c04e)
+ o Fix a couple of "#ifdef WIN32" instances (88ecda3)
+ o Remove unneeded declaration in bufferevent-internal.h (4c8ebcd)
+
+ Sample code
+ o le-proxy: Fail more gracefully if opening listener fails (44b2491)
+ o http-server: drop uri_root from base_url in http-server. (6171e1c Azat Khuzhin)
+ o https-client: POST supported, args supported (c5887f7 Alexey Ozeritsky)
+ o https-client: code cleanup (29af65e Alexey Ozeritsky)
+ o https-client: Small tweaks to https-client.c (90786eb)
+ o https-client: Set hostname for SNI extension (by f69m) (d1976f8)
+ o https-client: add a cast to https-client.c (462e6b6)
+
+
+
+Changes in version 2.1.3-alpha (1 May 2013)
+
+ Libevent 2.1.3-alpha fixes various bugs, adds new unit tests, and cleans
+ up the code in a couple of places. It has a new callback in evhttp for
+ reporting errors during a request, a new feature for allowing evdns to
+ not keep the event_base looping when there are no requests inflight, and
+ example code for writing an https client.
+
+ Libevent 2.1.3-alpha also has an important new (experimental) event
+ finalization feature to allow safe event teardown in multithreaded
+ programs. This ought to fix the longstanding bug with deadlocks in
+ multithreaded use of SSL-based bufferevents that some people have been
+ experiencing since Libevent 2.0.
+
+
+ Core (event finalization)
+ o Implement event_finalize() and related functions to avoid certain
+ deadlocks (8eedeab)
+ o Use finalization feature so bufferevents can avoid deadlocks (02fbf68)
+ o Always run pending finalizers when event_base_free() is called (e9ebef8)
+ o Remove bufferevent_del_generic_timeout_cbs as now unused (4ea4c6a)
+ o More documentation for finalization feature (a800b91)
+ o Make the event_finalize* functions return an error code (5d11f4f)
+ o Mark the finalize stuff as experiemental in case it needs to
+ change (23e2e29)
+
+ Evdns
+ o evdns: New flag to make evdns not prevent the event loop from
+ exiting (6b7fa62 Azat Khuzhin)
+
+ Bugfixes (Core)
+ o Make event_remove_timer behave correctly with persistent timers (5623e80)
+ o Unit test for event_remove_timer with EV_PERSIST. (96150dd)
+ o Double-check next timeout when adding events (9443868 Nate Rosenblum)
+ o event_base_update_cache_time should be a no-op if the loop isn't
+ running (5e6fa2a)
+
+ Bugfixes (evhttp, crash fix, from 2.0)
+ o fix #73 and fix http_connection_fail_test to catch it (b618204 Greg Hazel)
+
+ Bugfixes (compilation and portability, from 2.0)
+ o Fix compilation with WIN32_HAVE_CONDITION_VARIABLES enabled (7e45739)
+ o Fix missing AC_PROG_SED on older Autoconfs (9ab2b3f Tay Ray Chuan)
+ o Backport libevent to vanilla Autoconf 2.59 (as used in RHEL5)
+ (74d4c44 Kevin Bowling)
+ o Use AC_CONFIG_HEADERS in place of AM_CONFIG_HEADERS for autmake
+ 1.13 compat (817ea36)
+ o Rename configure.in to configure.ac to appease newer autoconfs (0c79787)
+ o Avoid using top_srcdir in TESTS: new automakes do not like this (a55514e)
+
+ Bugfixes (resource leaks/lock errors on error, from 2.0)
+ o Avoid leaking fds on evconnlistener with no callback set (69db261)
+ o Avoid double-close on getsockname error in evutil_ersatz_socketpair
+ (0a822a6)
+ o Fix a locking error in bufferevent_socket_get_dns_error. (0a5eb2e)
+
+ Documentation Fixes (from 2.0)
+ o Fix a mistake in evbuffer_remove() arguments in example http server code
+ (c322c20 Gyepi Sam)
+ o Fix a typo in a comment in buffer.h. Spotted by Alt_F4 (773b0a5)
+
+ Documentation Fixes
+ o minor documentation typos (809586a Patrick Pelletier)
+ o Fix cut-and-paste err in whatsnew-2.1 (49905ac)
+ o Fix comment to refer to sample/include.am correctly (9e8cdf3 Sebastian
+ Hahn)
+ o Fix typo : Dispatching instead of Dispaching (0c2bacc Volker Lendecke)
+ o fix some hinky indentation in evhttp_make_request (80e220e Patrick
+ Pelletier)
+ o "buffer" spelling (a452811 Patrick Pelletier)
+ o Specify return behavior in header for evbuffer_pullup() in corner case
+ (cf8d1cd Dan Petro)
+ o Clarify an important point about event_base_foreach_event() (920a5e6)
+
+ Compilation Fixes/Tool Support
+ o avoid valgrind false positive by zeroing epoll_event (1258614 Patrick
+ Pelletier)
+ o Fix harmless clang enum warning (b452a43 Sebastian Hahn)
+ o remove all exes on "make clean", not just regress.exe (974bfa0 Patrick
+ Pelletier)
+ o Make --disable-libevent-regress work again (787fd74)
+ o Do not build strlcpy.c when it will have no code. (4914620)
+
+ Portability Fixes
+ o When EWOULDBLOCK is not EAGAIN, treat it as equivalent to it (bf7a0ff)
+ o Preliminary changes for Minix3. (0dda56a Nicholas Heath)
+ o Use AC_CONFIG_HEADERS in place of AM_CONFIG_HEADERS for autmake 1.13
+ compat (bf278b)
+ o Avoid using $(top_srcdir) in TESTS. (2863c83)
+ o build test/test-script.sh on systems with a less-featureful $< (f935e21)
+ o Implement EVUTIL_ERR_IS_EAGAIN on windows. (42aaf4d)
+
+ Evhttp changes:
+ o Fix ipv6 support for http. When URL contain domain, not IP
+ address. (71e709c Azat Khuzhin)
+ o uri decode: fix for warning "use of uninitialised value" (64b6ece Azat
+ Khuzhin)
+ o uri decode: changed the test for the existence of the next character
+ (e1903e3 Azat Khuzhin)
+ o Move prototype of evhttp_decode_uri_internal() to http-internal.h
+ (de8101a Azat Khuzhin)
+ o Test: decoding just part of string with evhttp_decode_uri_internal()
+ (1367653 Azat Khuzhin)
+ o Add new error_cb for actual reporting of HTTP request errors. (7b07719
+ Azat Khuzhin)
+ o Add test for EVREQ_HTTP_REQUEST_CANCEL into http_cancel_test() (862c217
+ Azat Khuzhin)
+ o Drop extra header http_struct.h from regress_http.c (54cc800 Azat Khuzhin)
+
+ Testing
+ o Add regress test ipv6_for_domain. (9ec88bd Azat Khuzhin)
+ o Add an environment variable (EVENT_DEBUG_MODE) to run unit tests in debug
+ mode (2fad0f3)
+ o Add a test with an active_later event at event_base_free time. (1c3147f)
+ o Make all tests pass under EVENT_DEBUG_MODE=1 (b1b054f)
+ o Add some verbose notes to bufferevent unit tests (9d893c9)
+ o New test for active_later->active transition on event_active (a153874)
+ o New tests for event_base_foreach_event() (0b096ef)
+ o Unit tests for event_base_gettimeofday_cached() and
+ event_base_update_cache_time() (30ea291)
+ o A test for event_get_assignment() (f09629e)
+ o More unit tests for initializing common timeouts. (d596739)
+ o Fix a bug in the new main/event_foreach test (702c9aa)
+
+ Windows:
+ o use FormatMessage for winsock errors (0c6ec5d, 2078e9b, 4ccdd53, c9ad3af
+ Patrick Pelletier)
+ o a program to print out the error strings for winsock errors (7296512
+ Patrick Pelletier)
+ o Fix a warning introduced in 0c6ec5d8 (eeb700c)
+ o Fix another warning introduced in 0c6ec5d8 (ed26561)
+
+ Examples (http)
+ o Add sample/https-client.c, an example of stacking evhttp as a client on
+ top of bufferevent_ssl. (be46c99 Catalin Patulea)
+ o use ${OPENSSL_LIBS} instead of -lssl -lcrypto (bf31fa5 Patrick Pelletier)
+ o https-client was putting newlines at 256-byte boundaries (42d7441 Patrick
+ Pelletier)
+ o better handling of OpenSSL errors (5754d96 Patrick Pelletier)
+ o use Debian's default root certificate location (aacd674 Patrick Pelletier)
+ o use iSECPartners code to validate hostname in certificate (64d9f16
+ Patrick Pelletier)
+ o avoid sign mismatch warning in openssl_hostname_validation.c (6021cb5
+ Patrick Pelletier)
+ o pull in wildcard matching code from cURL (4db9da6 Patrick Pelletier)
+ o Another tweak to https-client.c (95acdaa)
+ o Remove http_struct.h usage in sample/https-client.c (8a90a85)
+
+
+
+Changes in version 2.1.2-alpha (18 Nov 2012)
+
+ Libevent 2.1.2-alpha includes more portable for monotonic timers,
+ refactors much of Libevent's internal and external infrastructure,
+ closes some longstanding gaps in the interface, makde other
+ improvements. Ths log below tries to organize features by rough area of
+ effect. It omits a few commits which were pure bugfixes on other commits
+ listed below. For more detail, see the git changelogs. For more
+ insight, see the "whatsnew-2.1.txt" document included in the Libevent
+ 2.1.2-alpha distribution.
+
+ Libevent 2.1.2-alpha also includes all changes made in 2.0.19-stable
+ through 2.0.21-stable inclusive.
+
+ Performance (core):
+ o Replace pipe-based notification with EVFILT_USER where possible. This
+ should make multithreaded programs on OSX and *BSD alert the main thread a
+ little faster. (53a07fe)
+ o Make th_base_lock nonrecursive. (9cd5acb)
+
+ New/Changed API Functions:
+ o New event_get_priority() function to return an event's priority (f90e255)
+ o Add a bufferevent_get_priority() function (bd39554)
+ o Add an event_base_loopcontinue() to tell Libevent to rescan for more
+ events right away (7d6aa5e)
+ o Add a new callback to get called on evbuffer_file_segment free
+ (e9f8feb yangacer, 64051b9)
+ o Expose event_base_foreach_event() as a public API. (84fd6d7 Roman
+ Puls, 232055e, ffe1643)
+ o Add an event_remove_timer() to remove timer on an event without
+ deleting it (e3b2e08)
+ o Make bufferevent_set_timeouts(bev, NULL, NULL) have plausible
+ semantics (9dee36b)
+ o Rename event_enable_lock_debuging() to ..._debugging(). (The old name
+ should still work.) (07e132e)
+ o Add missing implementation for event_enable_debug_logging (3b3e21d)
+
+ PORTABLE MONOTONIC TIMERS:
+
+ Libevent 2.1.2 includes internal support for monotonic timers on
+ (nearly) all supported platforms, including Windows, and OSX. Libevent
+ applications should now be more resilient to jumps forwards or backwards
+ in the system clock. Also, on Linux systems with epoll, we now
+ optionally support microsecond-level timeouts (whereas epoll only
+ supports millisecond-precision timeouts).
+
+ o Use mach_absolute_time() for monotonic clock support on OSX. (b8fd6f9)
+ o Do not track use_monotonic field when is no monotonic clock (cb653a0)
+ o EVENT_BASE_FLAG_PRECISE_TIMER indicates we want fine timer precision
+ (ddd69d3)
+ o On Linux, use CLOCK_MONOTONIC_COARSE by default (55780a7)
+ o Implement a GetTickCount-based monotonic timer for Windows (d5e1d5a)
+ o Refactor monotonic timer handling into a new type and set of
+ functions; add a gettimeofday-based ratcheting implementation (f5e4eb0)
+ o Add EVENT_PRECISE_TIMER environment var for selecting precise-but-slow
+ timer (a2598ec)
+ o Implement fast/precise monotonic clocks on Windows (2c47045)
+ o Simple unit tests for monotonic timers (630f077)
+ o Improve the monotonic-time unit test: make it check the step size (7428c78)
+ o When PRECISE_TIMERS is set with epoll, use timerfd for microsecond
+ precision (26c7582)
+ o Split out time-related evutil functions into a new evutil_time.c (c419485)
+ o Split out time-related prototypes into time-internal.h (71bca50)
+ o Add evutil_time.obj to Makefile.nmake (0ba0683)
+ o Avoid giving a spurious warning when timerfd support is unavailable
+ (1aaf9f0 Dave Hart)
+ o Make test_evutil_monotonic a little more tolerant (def3b83)
+ o Avoid unused-var warning on systems with clock_gettime but without
+ CLOCK_MONOTONIC_COARSE (9be5468)
+
+EVENT_BASE_ONCE LEAKS:
+ If a callback added by event_base_once() is never invoked, Libevent no
+ longer leaks internal memory.
+
+ o Free dangling event_once objects on event_base_free() (c17dd59)
+ o Add a unit test in which an event is created with event_base_once()
+ but never fires (4343edf)
+
+TESTING SUPPORT, FIXES AND IMPROVEMENTS:
+
+ Libevent now disables by default its unit tests that would touch the
+ network, or that tend to fail on heavily-loaded systems. To re-enable
+ them, invoke the ./test/regress program with the @all alias.
+
+ o Simplify test.sh code significantly. (9b856fd Ross Lagerwall)
+ o Make all tests that hit the network disabled by default (f2cea87)
+ o Avoid a resource leak on error in http client benchmark (ea92fba)
+ o Update to latest tinytest (911b4f0349377) (ef7c4f7)
+ o Avoid (unlikely) overflow in bench_httpclient.c (5671033)
+ o Shave 700 msec off the persistent_timeout_jump test (21205b8)
+ o Check return value of write() in regress.c (c8009d2)
+ o Make load-dependent monotonic timer tests off-by-default (2b6fe8b)
+ o Add deferred_cb_skew to list of timing-dependent tests (34c8f31)
+ o Avoid test -e; older shs don't have one. (f1bd938)
+ o Fix renegotiation test to work around openssl 1.0.1 bug (c2f3086)
+ o Fix a couple of compile warnings in the unit tests (5a9a014)
+
+MISC:
+ o Change evutil_weakrand_() to avoid platform random() (e86af4b Nicholas
+ Marriott, 3aa4415)
+
+INFRASTRUCTURE (Active-later events):
+ As a simplification and optimization to Libevent's "deferred callback"
+ logic (introduced in 2.0 to avoid callback recursion), Libevent now
+ treats all of its deferrable callback types using the same logic it uses
+ for active events. Now deferred events no longer cause priority
+ inversion, no longer require special code to cancel them, and so on.
+
+ o Refactor the callback part of an event into its own event_callback
+ type (cba59e5)
+ o Add "active later" event_callbacks to supersede deferred (745a63d)
+ o event_base_assert_ok: check value of event_active_count for
+ correctness (fec8bae)
+ o Replace deferred_cbs with event_callback-based implementation. (ae2b84b)
+ o Replace more deferred_cb names with event_callback (a4079aa)
+ o Give event_base_process_active a single exit path (581b5be)
+ o Restore our priority-inversion-prevention code with deferreds (c0e425a)
+ o Refactor event_persist_closure: raise and extract some common logic
+ (bec22b4)
+ o Remove the unused bits from EVLIST_ALL (9889a3d)
+||||||| merged common ancestors
+Changes in version 2.0.22-stable (?? Dec 2013)
+
+ (As of 3b77d62829c4393bda6f9105a5d3b73b48a64b71.)
+
BUGFIXES (evhttp)
o fix #73 and fix http_connection_fail_test to catch it (crash fix) (b618204 Greg Hazel)
o Avoid racy bufferevent activation (5eb1788 Nate Rosenblum)
@@ -1407,7 +1407,7 @@ BUGFIXES (resource leaks/lock errors on error)
o libevent/win32_dealloc() : fix sizeof(pointer) vs sizeof(*pointer) (b8f5980 Frank Denis)
BUGFIXES (miscellaneous)
- o Avoid other RNG initialization FS reads when urandom file is specified (9695e9c, bb52471)
+ o Avoid other RNG initialization FS reads when urandom file is specified (9695e9c, bb52471)
o Avoid redundant invocations of init_extension_functions for IOCP (3b77d62)
BUFGIXES (evdns)
@@ -1426,7 +1426,7 @@ DOCUMENTATION FIXES
o Fix a typo in a comment in buffer.h. Spotted by Alt_F4 (773b0a5)
-
+
Changes in version 2.0.21-stable (18 Nov 2012)
BUGFIXES:
o ssl: Don't discard SSL read event when timeout and read come close together (576b29f)
@@ -1804,358 +1804,358 @@ DOCUMENTATION:
-BUILD IMPROVEMENTS:
- Libevent 2.1.2-alpha modernizes Libevent's use of autotools, and makes
- numerous other build system. Parallel builds should be faster, and all
- builds should be quieter.
-
- o Split long lists in Makefile.am into one-item-per-line (2711cda)
- o Remove unnecessary code in configure.in. (e65914f Ross Lagerwall)
- o attempt to support OpenSSL in Makefile.nmake (eba0eb2 Patrick Pelletier)
- o Use newer syntax for autoconf/automake init (7d60ba8)
- o Enable silent build rules by default. Override with V=1 (7b18e5c)
- o Switch to non-recursive makefiles (7092f3b)
- o Rename subordinate Makefile.ams to include.am (6cdfeeb)
- o Make quiet build even quieter (371a123)
- o New --quiet option for event_rpcgen.py (aa59c1e)
- o Be quiet when making regress.gen.[ch] (607a8ff)
- o Fix handling of no-python case for nonrecursive make (1e3123d)
- o We now require automake 1.9 or later. Modernize! (b7f6e89)
- o Rename configure.in to configure.ac. (b3fea67 Ross Lagerwall)
- o Use correct openssl libs and includes in pkgconfig file (d70af27)
- o Use the same CFLAGS for openssl when building unit tests as with
- libevent (1d9d511)
+BUILD IMPROVEMENTS:
+ Libevent 2.1.2-alpha modernizes Libevent's use of autotools, and makes
+ numerous other build system. Parallel builds should be faster, and all
+ builds should be quieter.
+
+ o Split long lists in Makefile.am into one-item-per-line (2711cda)
+ o Remove unnecessary code in configure.in. (e65914f Ross Lagerwall)
+ o attempt to support OpenSSL in Makefile.nmake (eba0eb2 Patrick Pelletier)
+ o Use newer syntax for autoconf/automake init (7d60ba8)
+ o Enable silent build rules by default. Override with V=1 (7b18e5c)
+ o Switch to non-recursive makefiles (7092f3b)
+ o Rename subordinate Makefile.ams to include.am (6cdfeeb)
+ o Make quiet build even quieter (371a123)
+ o New --quiet option for event_rpcgen.py (aa59c1e)
+ o Be quiet when making regress.gen.[ch] (607a8ff)
+ o Fix handling of no-python case for nonrecursive make (1e3123d)
+ o We now require automake 1.9 or later. Modernize! (b7f6e89)
+ o Rename configure.in to configure.ac. (b3fea67 Ross Lagerwall)
+ o Use correct openssl libs and includes in pkgconfig file (d70af27)
+ o Use the same CFLAGS for openssl when building unit tests as with
+ libevent (1d9d511)
DOCUMENTATION
- o Note that make_base_notifiable should not be necessary (26ee5f9)
- o Be more clear that LEV_OPT_DEFERRED_ACCEPT has tricky prereqs (371efeb)
- o Add caveat to docs about bufferevent_free() with data in outbuf (6fab9ee)
- o Make it more clear that NOLOCK means "I promise, no multithreading"
- (9444524)
- o Fix a comment in test-fdleak after 077c7e949. (3881d8f Ross Lagerwall)
- o Make the Makefile.nmake warning slightly less dire (e7bf4c8)
- o Fix typo : events instead of evets (05f1aca Azat Khuzhin)
- o Additional comments about OPENSSL_DIR variable, prompted by Dave Hart
- (6bde2ef Patrick Pelletier)
-
-EVHTTP:
- o ignore LWS after field-content in headers (370a2c0 Artem Germanov)
- o Clean up rtrim implementation (aa59d80)
- o Remove trailing tabs in HTTP headers as well. (ac42519)
- o Remove internal ws from multiline http headers correctly (c6ff381)
- o Move evutil_rtrim_lws_ to evutil.c where it belongs (61b93af)
- o add evhttp_request_get_response_code_line (4f4d0c9 Jay R. Wren)
- o Use EVUTIL_SOCKET_ERROR() wrapper to save/restore errno in
- evhttp_connection_fail_ (7afbd60)
- o preserve errno in evhttp_connection_fail_ for inspection by the
- callback (36d0ee5 Patrick Pelletier)
-
-BUGFIXES:
- o Correctly handle running on a system where accept4 doesn't work. (9fbfe9b)
- o Avoid double-free on error in evbuffer_add_file. Found by
- coverity. (6a81b1f)
- o Fix another possible uninitialized read in dns regression tests. Found
- by coverity. (13525c5)
- o Add checks for functions in test-ratelim.c; found by Coverity (aa501e1)
- o Avoid memory leak in test_event_calloc unit test; found by coverity
- (92817a1)
- o Fix a shadowed variable in addfile_test_readcb; found by coverity
- (225344c)
- o Check return value when using LEV_OPT_DEFERRED_ACCEPT. Found by
- coverity (6487f63)
- o Prevent reference leak of bufferevent if getaddrinfo fails. (b757786
- Joachim Bauch)
- o Make event_base_getnpriorities work with old "implicit base" code
- (c46cb9c)
- o Simplify and correct evutil_open_closeonexec_ (0de587f)
- o Fix event_dlist definition when sys/queue not included (81b6209
- Derrick Pallas)
-
-
-
-Changes in version 2.1.1-alpha (4 Apr 2012)
-
- Libevent 2.1.1-alpha includes a number of new features and performance
- improvements. The log below tries to organize them by rough area of
- effect. It omits some commits which were pure bugfixes on other commits
- listed below. For more detail, see the git changelogs. For more
- insight, see the "whatsnew-2.1.txt" document included in the Libevent
- 2.1.1-alpha distribution.
-
- Performance: Core
- o Replace several TAILQ users with LIST. LIST can be a little faster than
- TAILQ for cases where we don't need queue-like behavior. (f9db33d,
- 6494772, d313c29, 974d004)
- o Disabled code to optimize the case where we reinsert an existing
- timeout (e47042f, 09cbc3d)
- o Remove a needless base-notify when rescheduling the first timeout (77a96fd)
- o Save a needless comparison when removing/adjusting timeouts (dd5189b)
- o Possible optimization: split event_queue_insert/remove into
- separate functions. needs testing (efc4dc5)
- o Make event_count maintenance branchless at the expense of an
- extra shift. Needs benchmarking (d1cee3b)
- o In the 2.1 branch, let's try out lazy gettimeofday/clock_gettime
- comparison (2a83ecc)
- o Optimization in event_process_active(): ignore maxcb & endtime
- for highest priority events. (a9866aa Alexander Drozdov)
- o Bypass event_add when using event_base_once() for a 0-sec timeout (35c5c95)
- o Remove the eventqueue list and the ev_next pointers. (604569b 066775e)
-
- Performance: Evbuffers
- o Roughly 20% speed increase when line-draining a buffer using
- EVBUFFER_EOL_CRLF (5dde0f0 Mina Naguib)
- o Try to squeeze a little more speed out of EVBUFFER_EOL_CRLF (7b9d139)
- o Fix a bug in the improved EOL_CRLF code (d927965)
- o Remove a needless branch in evbuffer_drain() (d19a326)
-
- Performance: Linux
- o Infrastructure for using faster/fewer syscalls when creating
- sockets (a1c042b)
- o Minimize syscalls during socket creation in listener.c (7e9e289)
- o Use a wrapper function to create the notification
- pipe/socketpair/eventfd (ca76cd9)
- o Use pipes for telling signals to main thread when possible (a35f396)
- o Save syscalls when constructing listener sockets for evhttp (af6c9d8)
- o Save some syscalls when creating evdns sockets (713e570)
- o Save some syscalls when constructing a socket for a bufferevent (33fca62)
- o Prefer epoll_create1 on Linuxen that have it (bac906c)
-
- Performance: Epoll backend
- o Use current event set rather than current pending change when
- deciding whether to no-op a del (04ba27e Mike Smellie)
- o Replace big chain of if/thens in epoll.c with a table lookup (8c83eb6)
- o Clean up error handling in epoll_apply_one_change() a little (2d55a19)
-
- Performance: Evport backend
- o evport: use evmap_io to track fdinfo status. Should save time and
- RAM. (4687ce4)
- o evport: Remove a linear search over recent events when
- reactivating them (0f77efe)
- o evport: Use portev_user to remember fdinfo struct (276ec0e)
- o evport: don't scan more events in ed_pending than needed (849a5cf)
- o evport: Remove artificial low limit on max events per getn call (c04d927)
- o Reenable main/many_events_slow_add for evport in 2.1 (e903db3)
-
- Performance: Windows
- o Use GetSystemTimeAsFileTime to implement gettimeofday on
- win32. It's faster and more accurate than our old
- approach. (b8b8aa5)
-
- New functions and features: debugging
- o Add event_enable_debug_logging() to control use of debug logs (e30a82f)
-
- New functions and features: core
- o Add event_config function to limit time/callbacks between calls
- to dispatch (fd4de1e, 9fa56bd, a37a0c0, 3c63edd)
- o New EVLOOP_NO_EXIT_ON_EMPTY option to keep looping even when no
- events are pending (084e68f)
- o Add event_base_get_npriorities() function. (ee3a4ee Alexander Drozdov)
- o Make evbase_priority_init() and evbase_get_npriorities()
- threadsafe (3c55b5e)
- o New event_base_update_cache_time() to set cached_tv to current
- time (212533e Abel Mathew)
- o Add event_self_cbarg() to be used in conjunction with
- event_new(). (ed36e6a Ross Lagerwall, fa931bb, 09a1906, 1338e6c,
- 33e43ef)
- o Add a new libevent_global_shutdown() to free all globals before
- exiting. (041ca00 Mark Ellzey, f98c158, 15296d0, 55e991b)
- o Use getifaddrs to detect our interfaces if possible (7085a45)
- o Add event_base_get_running_event() to get the event* whose cb we
- are in (c5732fd, 13dad99)
-
- New functions and features: building
- o Implement --enable-gcc-hardening configure option (7550267 Sebastian Hahn)
-
- New functions and features: evbuffers
- o Add evbuffer_add_file_segment() so one fd can be used efficiently
- in more than one evbuffer_add_file at a time (e72afae, c2d9884,
- 3f405d2, 0aad014)
- o Fix windows file segment mappings (8254de7)
- o Allow evbuffer_ptr_set to yield a point just after the end of the
- buffer. (e6fe1da)
- o Allow evbuffer_ptr to point to position 0 in an empty evbuffer
- (7aeb2fd Nir Soffer)
- o Set the special "not found" evbuffer_ptr consistently. (e3e97ae Nir Soffer)
- o support adding buffers to other buffers non-destructively
- (9d7368a Joachim Bauch)
- o prevent nested multicast references, reworked locking (26041a8
- Joachim Bauch)
- o New EVBUFFER_EOL_NUL to read NUL-terminated strings from an
- evbuffer (d7a8b36 Andrea Montefusco, 54142c9)
- o Make evbuffer_file_segment_types adaptable (c6bbbf1)
- o Added evbuffer_add_iovec and unit tests. (aaec5ac Mark Ellzey, 27b5398)
- o Add evbuffer_copyout_from to copy data from the middle of a
- buffer (27e2225)
-
- New functions and features: bufferevents
- o Allow users to set allow_dirty_shutdown (099d27d Catalin Patulea)
- o Tweak allow_dirty_shutdown documentation (a44cd2b)
- o Fix two issues in the allow_dirty_shutdown code. (f3b89de)
- o Add a bufferevent_getcb() to find a bufferevent's current
- callbacks (a650394)
- o bufferevent: Add functions to set/get max_single_read/write
- values. (998c813 Alexander Drozdov)
- o bev_ssl: Be more specific in event callbacks. evhttp in particular gets
- confused without at least one of BEV_EVENT_{READING|WRITING}. (f7eb69a
- Catalin Patulea)
-
- New functions and features: evconnlisteners
- o Support TCP_DEFER_ACCEPT sockopts for listeners (5880e4a Mark Ellzey,
- a270728)
- o Add another caveat to the TCP_DEFER_ACCEPT documentation (a270728)
- o Allow evconnlistener to be created in disabled state. (9593a33
- Alexander Drozdov)
- o The LEV_OPT_CLOSE_ON_EXEC flag now applies to accepted listener
- sockets too (4970329)
-
- Evhttp:
- o Add new evhttp_{connection_}set_timeout_tv() functions to set
- finger-grained http timeouts (6350e6c Constantine Verutin)
- o Performance tweak to evhttp_parse_request_line. (aee1a97 Mark Ellzey)
- o Add missing break to evhttp_parse_request_line (0fcc536)
- o Add evhttp callback for bufferevent creation; this lets evhttp
- support SSL. (8d3a850)
- o Remove calls to deprecated bufferevent functions from evhttp.c (4d63758)
- o evhttp: Add evhttp_foreach_bound_socket. (a2c48e3 Samy Al Bahra)
-
- Build improvements:
- o Add AC_USE_SYSTEM_EXTENSIONS to configure.in. Requires follow on
- patches for correctness and robustness. (1fa7dbe Kevin Bowling)
- o Filter '# define' statements from autoconf and generate
- event-private.h (321b558 Kevin Bowling)
- o Remove internal usage of _GNU_SOURCE (3b26541 Kevin Bowling)
- o Eliminate a couple more manual internal _GNU_SOURCE defines (c51ef93
- Kevin Bowling)
- o Add AC_GNU_SOURCE to the fallback case. (ea8fa4c Kevin Bowling)
- o Use a Configuration Header Template for evconfig-private.h (868f888
- Kevin Bowling)
- o Fix a comment warning and add evconfig-private.h to .gitignore
- (f6d66bc Kevin Bowling)
- o Include evconfig-private.h in internal files for great good. (0915ca0
- Kevin Bowling)
- o Backport libevent to vanilla Autoconf 2.59 (as used in RHEL5)
- (ad03952 Kevin Bowling)
- o Prefer the ./configure evconfig-private.h in MinGW, just in
- case. (f964b72 Kevin Bowling)
- o Shell hack for weird mkdir -p commands (fd7b5a8 Kevin Bowling)
- o Add evconfig-private to remaining files (ded0a09 Kevin Bowling)
- o Allow use of --enable-silent-rules for quieter compilation with
- automake 1.11 (f1f8514 Dave Hart)
- o Use "_WIN32", not WIN32: it's standard and we don't need to fake it
- (9f560b)
- o In configure, test for _WIN32 not WIN32. (85078b1 Peter Rosin)
- o Do not define WIN32 in Makefile.nmake (d41f3ea Peter Rosin)
- o Provide the autoconf m4 macros for the new OpenSSL via pkg-config
- stuff. (674dc3d Harlan Stenn)
- o Use pkg-config (if available) to handle OpenSSL. (1c63860 Harlan Stenn)
- o We need AM_CPPFLAGS when compiling bufferevent_openssl.c (6d2613b
- Harlan Stenn)
- o Fix OSX build: $(OPENSSL_INCS) needs to be after
- $(AM_CPPFLAGS). (46f1769 Zack Weinberg)
- o Make gcc warnings on by default, and --enable-gcc-warnings only add
- -Werror (d46517e Sebastian Hahn)
- o Split up extra-long AC_CHECK_FUNCS/HEADERS lines in configure.in (88a30ad)
- o Move libevent 1.x headers to include/, to put all public headers in
- one place. (bbea8d6)
- o Put #ifdef around some files to support alternate build
- systems. (76d4c92 Ross Lagerwall)
- o Also make win32select.c conditional for IDE users (bf2c5a7)
-
- Debugging:
- o Add a magic number to debug_locks to better catch lock-coding
- errors. (b4a29c0 Dave Hart)
- o munge the debug_lock signature before freeing it: it might help us
- catch use-after-free (f28084d)
- o Added --enable-event-debugging in configure (bc7b4e4, a9c2c9a Mark Ellzey)
- o Debug addition for printing usec on TIMEOUT debugging. (ac43ce0 Mark Ellzey)
- o Added usec debug in another area for debug (3baab0d Mark Ellzey)
- o added timeout debug logs to include event ptr. (4b7d298 Mark Ellzey)
- o more event dbg updates (6727543 Mark Ellzey)
- o Clarify event_enable_debug_logging a little (6207826)
- o Make --enable-verbose-debug option match its help text (10c3450)
- o Add argument checks to some memory functions in `event.c'. (c8953d1
- Mansour Moufid)
-
- Testing:
- o More abstraction in test.sh (cd74c4e)
- o Add failing test for evbuffer_search_range. (8e26154 Nir Soffer)
- o Tweaks to return types with end-of-buf ptrs (9ab8ab8)
- o Add an (internal) usleep function for use by unit tests (f25d9d3)
- o Synchronize with upstream tinytest (6c81be7)
- o Make test-changelist faster (7622d26)
- o Reduce the timeout in the main/fork test. (ab14f7c)
- o New evhttp function to adjust initial retry timeout (350a3c4)
- o Make regression tests run over 3x faster. (67a1763)
- o Use test_timeval_diff_eq more consistently (b77b43f)
- o Allow more slop in deferred_cb_skew test; freebsd needs it (b9f7e5f)
- o When including an -internal.h header outside the main tree, do so
- early (95e2455)
- o Add a new test: test-fdleak which tests for fd leaks by creating many
- sockets. (2ef9278 Ross Lagerwall, f7af194, 1c4288f, etc)
- o Add a unit test for event_base_dump_events() (7afe48a, 8d08cce)
- o Test more bufferevent_ratelim features (c24f91a)
-
- Documentation:
- o Improve evbuffer_ptr documentation (261ba63)
- o added comments to describe refcounting of multicast chains (ba24f61
- Joachim Bauch)
- o Add doxygen for event_base_dump_events (cad5753)
-
- OSX:
- o Use "unlimited select" on OSX so that we can have more than
- FD_SETSIZE fds (1fb5cc6)
-
- KQueue:
- o Use SIG_IGN instead of a do-nothing handler for signal events with
- kqueue (148458e Zack Weinberg)
-
- evprc:
- o event_rpcgen.py now prints status information to stdout and errors to
- stderr. (ffb0ba0 Ross Lagerwall)
-
- Code improvement and refactoring:
- o Make event_reinit() more robust and maintainable (272033e)
- o Restore fast-path event_reinit() for slower backends (2c4b5de)
- o Check changelist as part of checking representational integrity (39b3f38)
- o Fix a compile warning in event_reinit (e4a56ed Sebastian Hahn)
- o Refactor the functions that run over every event. (c89b4e6)
- o Remove the last vestiges of _EVENT_USE_EVENTLIST (a3cec90)
- o Make event-config.h depend on Makefile.am (2958a5c)
-
- Build fixes:
- o Don't do clang version detection when disabling some flags (083296b
- Sebastian Hahn)
-
- C standards conformance:
- o Check for NULL return on win32 mm_calloc, and set ENOMEM. (af7ba69)
- o Convert event-config.h macros to avoid reserved identifiers (68120d9)
- o Generate event-config.h using the correct macros. (f82c57e)
- o Convert include-guard macro convention to avoid reserved identifiers
- (3f8c7cd)
- o Make event_rpcgen.py output conform to identifier conventions (372bff1)
- o Stop referring to an obsolete include guard in bench_http.h (5c0f7e0)
- o Make the generated event-config.h use correct include guards (639383a)
- o Fix all identifiers with names beginning with underscore. (cb9da0b)
- o Make event_rpcgen.py output conform to identifier conventions, more
- (bcefd24)
- o Fix some problems introduced by automated identifier cleanup script
- (c963534)
- o Have all visible internal function names end with an underscore. (8ac3c4c)
- o Apply the naming convention to our EVUTIL_IS* functions (c7848fa)
- o Clean up lingering _identifiers. (946b584)
- o Fix doxygen to use new macro conventions (da455e9)
-
- Bugfixes:
- o Do not use system EAI/AI values if we are not using the system
- getaddrinfo. (7bcac07)
-
- Sample Code:
- o Fix up sample/event-test.c to use newer interfaces and make it
- actually work. (19bab4f Ross Lagerwall)
- o On Unix, remove event.fifo left by sample/event-test.c. (c0dacd2 Ross
- Lagerwall)
- o Rename event-test.c to event-read-fifo.c. (a5b370a Ross Lagerwall)
- o event-read-fifo: Use EV_PERSIST appropriately (24dab0b)
+ o Note that make_base_notifiable should not be necessary (26ee5f9)
+ o Be more clear that LEV_OPT_DEFERRED_ACCEPT has tricky prereqs (371efeb)
+ o Add caveat to docs about bufferevent_free() with data in outbuf (6fab9ee)
+ o Make it more clear that NOLOCK means "I promise, no multithreading"
+ (9444524)
+ o Fix a comment in test-fdleak after 077c7e949. (3881d8f Ross Lagerwall)
+ o Make the Makefile.nmake warning slightly less dire (e7bf4c8)
+ o Fix typo : events instead of evets (05f1aca Azat Khuzhin)
+ o Additional comments about OPENSSL_DIR variable, prompted by Dave Hart
+ (6bde2ef Patrick Pelletier)
+
+EVHTTP:
+ o ignore LWS after field-content in headers (370a2c0 Artem Germanov)
+ o Clean up rtrim implementation (aa59d80)
+ o Remove trailing tabs in HTTP headers as well. (ac42519)
+ o Remove internal ws from multiline http headers correctly (c6ff381)
+ o Move evutil_rtrim_lws_ to evutil.c where it belongs (61b93af)
+ o add evhttp_request_get_response_code_line (4f4d0c9 Jay R. Wren)
+ o Use EVUTIL_SOCKET_ERROR() wrapper to save/restore errno in
+ evhttp_connection_fail_ (7afbd60)
+ o preserve errno in evhttp_connection_fail_ for inspection by the
+ callback (36d0ee5 Patrick Pelletier)
+
+BUGFIXES:
+ o Correctly handle running on a system where accept4 doesn't work. (9fbfe9b)
+ o Avoid double-free on error in evbuffer_add_file. Found by
+ coverity. (6a81b1f)
+ o Fix another possible uninitialized read in dns regression tests. Found
+ by coverity. (13525c5)
+ o Add checks for functions in test-ratelim.c; found by Coverity (aa501e1)
+ o Avoid memory leak in test_event_calloc unit test; found by coverity
+ (92817a1)
+ o Fix a shadowed variable in addfile_test_readcb; found by coverity
+ (225344c)
+ o Check return value when using LEV_OPT_DEFERRED_ACCEPT. Found by
+ coverity (6487f63)
+ o Prevent reference leak of bufferevent if getaddrinfo fails. (b757786
+ Joachim Bauch)
+ o Make event_base_getnpriorities work with old "implicit base" code
+ (c46cb9c)
+ o Simplify and correct evutil_open_closeonexec_ (0de587f)
+ o Fix event_dlist definition when sys/queue not included (81b6209
+ Derrick Pallas)
+
+
+
+Changes in version 2.1.1-alpha (4 Apr 2012)
+
+ Libevent 2.1.1-alpha includes a number of new features and performance
+ improvements. The log below tries to organize them by rough area of
+ effect. It omits some commits which were pure bugfixes on other commits
+ listed below. For more detail, see the git changelogs. For more
+ insight, see the "whatsnew-2.1.txt" document included in the Libevent
+ 2.1.1-alpha distribution.
+
+ Performance: Core
+ o Replace several TAILQ users with LIST. LIST can be a little faster than
+ TAILQ for cases where we don't need queue-like behavior. (f9db33d,
+ 6494772, d313c29, 974d004)
+ o Disabled code to optimize the case where we reinsert an existing
+ timeout (e47042f, 09cbc3d)
+ o Remove a needless base-notify when rescheduling the first timeout (77a96fd)
+ o Save a needless comparison when removing/adjusting timeouts (dd5189b)
+ o Possible optimization: split event_queue_insert/remove into
+ separate functions. needs testing (efc4dc5)
+ o Make event_count maintenance branchless at the expense of an
+ extra shift. Needs benchmarking (d1cee3b)
+ o In the 2.1 branch, let's try out lazy gettimeofday/clock_gettime
+ comparison (2a83ecc)
+ o Optimization in event_process_active(): ignore maxcb & endtime
+ for highest priority events. (a9866aa Alexander Drozdov)
+ o Bypass event_add when using event_base_once() for a 0-sec timeout (35c5c95)
+ o Remove the eventqueue list and the ev_next pointers. (604569b 066775e)
+
+ Performance: Evbuffers
+ o Roughly 20% speed increase when line-draining a buffer using
+ EVBUFFER_EOL_CRLF (5dde0f0 Mina Naguib)
+ o Try to squeeze a little more speed out of EVBUFFER_EOL_CRLF (7b9d139)
+ o Fix a bug in the improved EOL_CRLF code (d927965)
+ o Remove a needless branch in evbuffer_drain() (d19a326)
+
+ Performance: Linux
+ o Infrastructure for using faster/fewer syscalls when creating
+ sockets (a1c042b)
+ o Minimize syscalls during socket creation in listener.c (7e9e289)
+ o Use a wrapper function to create the notification
+ pipe/socketpair/eventfd (ca76cd9)
+ o Use pipes for telling signals to main thread when possible (a35f396)
+ o Save syscalls when constructing listener sockets for evhttp (af6c9d8)
+ o Save some syscalls when creating evdns sockets (713e570)
+ o Save some syscalls when constructing a socket for a bufferevent (33fca62)
+ o Prefer epoll_create1 on Linuxen that have it (bac906c)
+
+ Performance: Epoll backend
+ o Use current event set rather than current pending change when
+ deciding whether to no-op a del (04ba27e Mike Smellie)
+ o Replace big chain of if/thens in epoll.c with a table lookup (8c83eb6)
+ o Clean up error handling in epoll_apply_one_change() a little (2d55a19)
+
+ Performance: Evport backend
+ o evport: use evmap_io to track fdinfo status. Should save time and
+ RAM. (4687ce4)
+ o evport: Remove a linear search over recent events when
+ reactivating them (0f77efe)
+ o evport: Use portev_user to remember fdinfo struct (276ec0e)
+ o evport: don't scan more events in ed_pending than needed (849a5cf)
+ o evport: Remove artificial low limit on max events per getn call (c04d927)
+ o Reenable main/many_events_slow_add for evport in 2.1 (e903db3)
+
+ Performance: Windows
+ o Use GetSystemTimeAsFileTime to implement gettimeofday on
+ win32. It's faster and more accurate than our old
+ approach. (b8b8aa5)
+
+ New functions and features: debugging
+ o Add event_enable_debug_logging() to control use of debug logs (e30a82f)
+
+ New functions and features: core
+ o Add event_config function to limit time/callbacks between calls
+ to dispatch (fd4de1e, 9fa56bd, a37a0c0, 3c63edd)
+ o New EVLOOP_NO_EXIT_ON_EMPTY option to keep looping even when no
+ events are pending (084e68f)
+ o Add event_base_get_npriorities() function. (ee3a4ee Alexander Drozdov)
+ o Make evbase_priority_init() and evbase_get_npriorities()
+ threadsafe (3c55b5e)
+ o New event_base_update_cache_time() to set cached_tv to current
+ time (212533e Abel Mathew)
+ o Add event_self_cbarg() to be used in conjunction with
+ event_new(). (ed36e6a Ross Lagerwall, fa931bb, 09a1906, 1338e6c,
+ 33e43ef)
+ o Add a new libevent_global_shutdown() to free all globals before
+ exiting. (041ca00 Mark Ellzey, f98c158, 15296d0, 55e991b)
+ o Use getifaddrs to detect our interfaces if possible (7085a45)
+ o Add event_base_get_running_event() to get the event* whose cb we
+ are in (c5732fd, 13dad99)
+
+ New functions and features: building
+ o Implement --enable-gcc-hardening configure option (7550267 Sebastian Hahn)
+
+ New functions and features: evbuffers
+ o Add evbuffer_add_file_segment() so one fd can be used efficiently
+ in more than one evbuffer_add_file at a time (e72afae, c2d9884,
+ 3f405d2, 0aad014)
+ o Fix windows file segment mappings (8254de7)
+ o Allow evbuffer_ptr_set to yield a point just after the end of the
+ buffer. (e6fe1da)
+ o Allow evbuffer_ptr to point to position 0 in an empty evbuffer
+ (7aeb2fd Nir Soffer)
+ o Set the special "not found" evbuffer_ptr consistently. (e3e97ae Nir Soffer)
+ o support adding buffers to other buffers non-destructively
+ (9d7368a Joachim Bauch)
+ o prevent nested multicast references, reworked locking (26041a8
+ Joachim Bauch)
+ o New EVBUFFER_EOL_NUL to read NUL-terminated strings from an
+ evbuffer (d7a8b36 Andrea Montefusco, 54142c9)
+ o Make evbuffer_file_segment_types adaptable (c6bbbf1)
+ o Added evbuffer_add_iovec and unit tests. (aaec5ac Mark Ellzey, 27b5398)
+ o Add evbuffer_copyout_from to copy data from the middle of a
+ buffer (27e2225)
+
+ New functions and features: bufferevents
+ o Allow users to set allow_dirty_shutdown (099d27d Catalin Patulea)
+ o Tweak allow_dirty_shutdown documentation (a44cd2b)
+ o Fix two issues in the allow_dirty_shutdown code. (f3b89de)
+ o Add a bufferevent_getcb() to find a bufferevent's current
+ callbacks (a650394)
+ o bufferevent: Add functions to set/get max_single_read/write
+ values. (998c813 Alexander Drozdov)
+ o bev_ssl: Be more specific in event callbacks. evhttp in particular gets
+ confused without at least one of BEV_EVENT_{READING|WRITING}. (f7eb69a
+ Catalin Patulea)
+
+ New functions and features: evconnlisteners
+ o Support TCP_DEFER_ACCEPT sockopts for listeners (5880e4a Mark Ellzey,
+ a270728)
+ o Add another caveat to the TCP_DEFER_ACCEPT documentation (a270728)
+ o Allow evconnlistener to be created in disabled state. (9593a33
+ Alexander Drozdov)
+ o The LEV_OPT_CLOSE_ON_EXEC flag now applies to accepted listener
+ sockets too (4970329)
+
+ Evhttp:
+ o Add new evhttp_{connection_}set_timeout_tv() functions to set
+ finger-grained http timeouts (6350e6c Constantine Verutin)
+ o Performance tweak to evhttp_parse_request_line. (aee1a97 Mark Ellzey)
+ o Add missing break to evhttp_parse_request_line (0fcc536)
+ o Add evhttp callback for bufferevent creation; this lets evhttp
+ support SSL. (8d3a850)
+ o Remove calls to deprecated bufferevent functions from evhttp.c (4d63758)
+ o evhttp: Add evhttp_foreach_bound_socket. (a2c48e3 Samy Al Bahra)
+
+ Build improvements:
+ o Add AC_USE_SYSTEM_EXTENSIONS to configure.in. Requires follow on
+ patches for correctness and robustness. (1fa7dbe Kevin Bowling)
+ o Filter '# define' statements from autoconf and generate
+ event-private.h (321b558 Kevin Bowling)
+ o Remove internal usage of _GNU_SOURCE (3b26541 Kevin Bowling)
+ o Eliminate a couple more manual internal _GNU_SOURCE defines (c51ef93
+ Kevin Bowling)
+ o Add AC_GNU_SOURCE to the fallback case. (ea8fa4c Kevin Bowling)
+ o Use a Configuration Header Template for evconfig-private.h (868f888
+ Kevin Bowling)
+ o Fix a comment warning and add evconfig-private.h to .gitignore
+ (f6d66bc Kevin Bowling)
+ o Include evconfig-private.h in internal files for great good. (0915ca0
+ Kevin Bowling)
+ o Backport libevent to vanilla Autoconf 2.59 (as used in RHEL5)
+ (ad03952 Kevin Bowling)
+ o Prefer the ./configure evconfig-private.h in MinGW, just in
+ case. (f964b72 Kevin Bowling)
+ o Shell hack for weird mkdir -p commands (fd7b5a8 Kevin Bowling)
+ o Add evconfig-private to remaining files (ded0a09 Kevin Bowling)
+ o Allow use of --enable-silent-rules for quieter compilation with
+ automake 1.11 (f1f8514 Dave Hart)
+ o Use "_WIN32", not WIN32: it's standard and we don't need to fake it
+ (9f560b)
+ o In configure, test for _WIN32 not WIN32. (85078b1 Peter Rosin)
+ o Do not define WIN32 in Makefile.nmake (d41f3ea Peter Rosin)
+ o Provide the autoconf m4 macros for the new OpenSSL via pkg-config
+ stuff. (674dc3d Harlan Stenn)
+ o Use pkg-config (if available) to handle OpenSSL. (1c63860 Harlan Stenn)
+ o We need AM_CPPFLAGS when compiling bufferevent_openssl.c (6d2613b
+ Harlan Stenn)
+ o Fix OSX build: $(OPENSSL_INCS) needs to be after
+ $(AM_CPPFLAGS). (46f1769 Zack Weinberg)
+ o Make gcc warnings on by default, and --enable-gcc-warnings only add
+ -Werror (d46517e Sebastian Hahn)
+ o Split up extra-long AC_CHECK_FUNCS/HEADERS lines in configure.in (88a30ad)
+ o Move libevent 1.x headers to include/, to put all public headers in
+ one place. (bbea8d6)
+ o Put #ifdef around some files to support alternate build
+ systems. (76d4c92 Ross Lagerwall)
+ o Also make win32select.c conditional for IDE users (bf2c5a7)
+
+ Debugging:
+ o Add a magic number to debug_locks to better catch lock-coding
+ errors. (b4a29c0 Dave Hart)
+ o munge the debug_lock signature before freeing it: it might help us
+ catch use-after-free (f28084d)
+ o Added --enable-event-debugging in configure (bc7b4e4, a9c2c9a Mark Ellzey)
+ o Debug addition for printing usec on TIMEOUT debugging. (ac43ce0 Mark Ellzey)
+ o Added usec debug in another area for debug (3baab0d Mark Ellzey)
+ o added timeout debug logs to include event ptr. (4b7d298 Mark Ellzey)
+ o more event dbg updates (6727543 Mark Ellzey)
+ o Clarify event_enable_debug_logging a little (6207826)
+ o Make --enable-verbose-debug option match its help text (10c3450)
+ o Add argument checks to some memory functions in `event.c'. (c8953d1
+ Mansour Moufid)
+
+ Testing:
+ o More abstraction in test.sh (cd74c4e)
+ o Add failing test for evbuffer_search_range. (8e26154 Nir Soffer)
+ o Tweaks to return types with end-of-buf ptrs (9ab8ab8)
+ o Add an (internal) usleep function for use by unit tests (f25d9d3)
+ o Synchronize with upstream tinytest (6c81be7)
+ o Make test-changelist faster (7622d26)
+ o Reduce the timeout in the main/fork test. (ab14f7c)
+ o New evhttp function to adjust initial retry timeout (350a3c4)
+ o Make regression tests run over 3x faster. (67a1763)
+ o Use test_timeval_diff_eq more consistently (b77b43f)
+ o Allow more slop in deferred_cb_skew test; freebsd needs it (b9f7e5f)
+ o When including an -internal.h header outside the main tree, do so
+ early (95e2455)
+ o Add a new test: test-fdleak which tests for fd leaks by creating many
+ sockets. (2ef9278 Ross Lagerwall, f7af194, 1c4288f, etc)
+ o Add a unit test for event_base_dump_events() (7afe48a, 8d08cce)
+ o Test more bufferevent_ratelim features (c24f91a)
+
+ Documentation:
+ o Improve evbuffer_ptr documentation (261ba63)
+ o added comments to describe refcounting of multicast chains (ba24f61
+ Joachim Bauch)
+ o Add doxygen for event_base_dump_events (cad5753)
+
+ OSX:
+ o Use "unlimited select" on OSX so that we can have more than
+ FD_SETSIZE fds (1fb5cc6)
+
+ KQueue:
+ o Use SIG_IGN instead of a do-nothing handler for signal events with
+ kqueue (148458e Zack Weinberg)
+
+ evprc:
+ o event_rpcgen.py now prints status information to stdout and errors to
+ stderr. (ffb0ba0 Ross Lagerwall)
+
+ Code improvement and refactoring:
+ o Make event_reinit() more robust and maintainable (272033e)
+ o Restore fast-path event_reinit() for slower backends (2c4b5de)
+ o Check changelist as part of checking representational integrity (39b3f38)
+ o Fix a compile warning in event_reinit (e4a56ed Sebastian Hahn)
+ o Refactor the functions that run over every event. (c89b4e6)
+ o Remove the last vestiges of _EVENT_USE_EVENTLIST (a3cec90)
+ o Make event-config.h depend on Makefile.am (2958a5c)
+
+ Build fixes:
+ o Don't do clang version detection when disabling some flags (083296b
+ Sebastian Hahn)
+
+ C standards conformance:
+ o Check for NULL return on win32 mm_calloc, and set ENOMEM. (af7ba69)
+ o Convert event-config.h macros to avoid reserved identifiers (68120d9)
+ o Generate event-config.h using the correct macros. (f82c57e)
+ o Convert include-guard macro convention to avoid reserved identifiers
+ (3f8c7cd)
+ o Make event_rpcgen.py output conform to identifier conventions (372bff1)
+ o Stop referring to an obsolete include guard in bench_http.h (5c0f7e0)
+ o Make the generated event-config.h use correct include guards (639383a)
+ o Fix all identifiers with names beginning with underscore. (cb9da0b)
+ o Make event_rpcgen.py output conform to identifier conventions, more
+ (bcefd24)
+ o Fix some problems introduced by automated identifier cleanup script
+ (c963534)
+ o Have all visible internal function names end with an underscore. (8ac3c4c)
+ o Apply the naming convention to our EVUTIL_IS* functions (c7848fa)
+ o Clean up lingering _identifiers. (946b584)
+ o Fix doxygen to use new macro conventions (da455e9)
+
+ Bugfixes:
+ o Do not use system EAI/AI values if we are not using the system
+ getaddrinfo. (7bcac07)
+
+ Sample Code:
+ o Fix up sample/event-test.c to use newer interfaces and make it
+ actually work. (19bab4f Ross Lagerwall)
+ o On Unix, remove event.fifo left by sample/event-test.c. (c0dacd2 Ross
+ Lagerwall)
+ o Rename event-test.c to event-read-fifo.c. (a5b370a Ross Lagerwall)
+ o event-read-fifo: Use EV_PERSIST appropriately (24dab0b)
diff --git a/contrib/libs/libevent/ChangeLog-1.4 b/contrib/libs/libevent/ChangeLog-1.4
index d7f6517b2b..aa6e69b83d 100644
--- a/contrib/libs/libevent/ChangeLog-1.4
+++ b/contrib/libs/libevent/ChangeLog-1.4
@@ -1,231 +1,231 @@
-Changes in 1.4.14b-stable
- o Set the VERSION_INFO correctly for 1.4.14
-
-Changes in 1.4.14-stable
- o Add a .gitignore file for the 1.4 branch. (d014edb)
- o Backport evbuffer_readln(). (b04cc60 Nicholas Marriott)
- o Make the evbuffer_readln backport follow the current API (c545485)
- o Valgrind fix: Clear struct kevent before checking for OSX bug. (5713d5d William Ahern)
- o Fix a crash when reading badly formatted resolve.conf (5b10d00 Yasuoka Masahiko)
- o Fix memory-leak of signal handler array with kqueue. [backport] (01f3775)
- o Update sample/signal-test.c to use newer APIs and not leak. (891765c Evan Jones)
- o Correct all versions in 1.4 branch (ac0d213)
- o Make evutil_make_socket_nonblocking() leave any other flags alone. (81c26ba Jardel Weyrich)
- o Adjusted fcntl() retval comparison on evutil_make_socket_nonblocking(). (5f2e250 Jardel Weyrich)
- o Correct a debug message in evhttp_parse_request_line (35df59e)
- o Merge branch 'readln-backport' into patches-1.4 (8771d5b)
- o Do not send an HTTP error when we've already closed or responded. (4fd2dd9 Pavel Plesov)
- o Re-add event_siglcb; some old code _was_ still using it. :( (bd03d06)
- o Make Libevent 1.4 build on win32 with Unicode enabled. (bce58d6 Brodie Thiesfield)
- o Distribute nmake makefile for 1.4 (20d706d)
- o do not fail while sending on http connections the client closed. (5c8b446)
- o make evhttp_send() safe against terminated connections, too (01ea0c5)
- o Fix a free(NULL) in min_heap.h (2458934)
- o Fix memory leak when setting up priorities; reported by Alexander Drozdov (cb1a722)
- o Clean up properly when adding a signal handler fails. (ae6ece0 Gilad Benjamini)
- o Do not abort HTTP requests missing a reason string. (29d7b32 Pierre Phaneuf)
- o Fix compile warning in http.c (906d573)
- o Define _REENTRANT as needed on Solaris, elsewhere (6cbea13)
-
-
-Changes in 1.4.13-stable:
- o If the kernel tells us that there are a negative number of bytes to read from a socket, do not believe it. Fixes bug 2841177; found by Alexander Pronchenkov.
- o Do not allocate the maximum event queue and fd array for the epoll backend at startup. Instead, start out accepting 32 events at a time, and double the queue's size when it seems that the OS is generating events faster than we're requesting them. Saves up to 512K per epoll-based event_base. Resolves bug 2839240.
- o Fix compilation on Android, which forgot to define fd_mask in its sys/select.h
- o Do not drop data from evbuffer when out of memory; reported by Jacek Masiulaniec
- o Rename our replacement compat/sys/_time.h header to avoid build a conflict on HPUX; reported by Kathryn Hogg.
- o Build kqueue.c correctly on GNU/kFreeBSD platforms. Patch pulled upstream from Debian.
- o Fix a problem with excessive memory allocation when using multiple event priorities.
- o When running set[ug]id, don't check the environment. Based on a patch from OpenBSD.
-
-
-Changes in 1.4.12-stable:
- o Try to contain degree of failure when running on a win32 version so heavily firewalled that we can't fake a socketpair.
- o Fix an obscure timing-dependent, allocator-dependent crash in the evdns code.
- o Use __VA_ARGS__ syntax for varargs macros in event_rpcgen when compiler is not GCC.
- o Activate fd events in a pseudorandom order with O(N) backends, so that we don't systematically favor low fds (select) or earlier-added fds (poll, win32).
- o Fix another pair of fencepost bugs in epoll.c. [Patch from Adam Langley.]
- o Do not break evdns connections to nameservers when our IP changes.
- o Set truncated flag correctly in evdns server replies.
- o Disable strict aliasing with GCC: our code is not compliant with it.
-
-Changes in 1.4.11-stable:
- o Fix a bug when removing a timeout from the heap. [Patch from Marko Kreen]
- o Remove the limit on size of HTTP headers by removing static buffers.
- o Fix a nasty dangling pointer bug in epoll.c that could occur after epoll_recalc(). [Patch from Kevin Springborn]
- o Distribute Win32-Code/event-config.h, not ./event-config.h
-
-Changes in 1.4.10-stable:
- o clean up buffered http connection data on reset; reported by Brian O'Kelley
- o bug fix and potential race condition in signal handling; from Alexander Drozdov
- o rename the Solaris event ports backend to evport
- o support compilation on Haiku
- o fix signal processing when a signal callback delivers a signal; from Alexander Drozdov
- o const-ify some arguments to evdns functions.
- o off-by-one error in epoll_recalc; reported by Victor Goya
- o include Doxyfile in tar ball; from Jeff Garzik
- o correctly parse queries with encoded \r, \n or + characters
-
-Changes in 1.4.9-stable:
- o event_add would not return error for some backends; from Dean McNamee
- o Clear the timer cache on entering the event loop; reported by Victor Chang
- o Only bind the socket on connect when a local address has been provided; reported by Alejo Sanchez
- o Allow setting of local port for evhttp connections to support millions of connections from a single system; from Richard Jones.
- o Clear the timer cache when leaving the event loop; reported by Robin Haberkorn
- o Fix a typo in setting the global event base; reported by lance.
- o Fix a memory leak when reading multi-line headers
- o Fix a memory leak by not running explicit close detection for server connections
-
-Changes in 1.4.8-stable:
- o Match the query in DNS replies to the query in the request; from Vsevolod Stakhov.
- o Fix a merge problem in which name_from_addr returned pointers to the stack; found by Jiang Hong.
- o Do not remove Accept-Encoding header
-
-Changes in 1.4.7-stable:
- o Fix a bug where headers arriving in multiple packets were not parsed; fix from Jiang Hong; test by me.
-
-Changes in 1.4.6-stable:
- o evutil.h now includes <stdarg.h> directly
- o switch all uses of [v]snprintf over to evutil
- o Correct handling of trailing headers in chunked replies; from Scott Lamb.
- o Support multi-line HTTP headers; based on a patch from Moshe Litvin
- o Reject negative Content-Length headers; anonymous bug report
- o Detect CLOCK_MONOTONIC at runtime for evdns; anonymous bug report
- o Fix a bug where deleting signals with the kqueue backend would cause subsequent adds to fail
- o Support multiple events listening on the same signal; make signals regular events that go on the same event queue; problem report by Alexander Drozdov.
- o Deal with evbuffer_read() returning -1 on EINTR|EAGAIN; from Adam Langley.
- o Fix a bug in which the DNS server would incorrectly set the type of a cname reply to a.
- o Fix a bug where setting the timeout on a bufferevent would take not effect if the event was already pending.
- o Fix a memory leak when using signals for some event bases; reported by Alexander Drozdov.
- o Add libevent.vcproj file to distribution to help with Windows build.
- o Fix a problem with epoll() and reinit; problem report by Alexander Drozdov.
- o Fix off-by-one errors in devpoll; from Ian Bell
- o Make event_add not change any state if it fails; reported by Ian Bell.
- o Do not warn on accept when errno is either EAGAIN or EINTR
-
-Changes in 1.4.5-stable:
- o Fix connection keep-alive behavior for HTTP/1.0
- o Fix use of freed memory in event_reinit; pointed out by Peter Postma
- o Constify struct timeval * where possible; pointed out by Forest Wilkinson
- o allow min_heap_erase to be called on removed members; from liusifan.
- o Rename INPUT and OUTPUT to EVRPC_INPUT and EVRPC_OUTPUT. Retain INPUT/OUTPUT aliases on on-win32 platforms for backwards compatibility.
- o Do not use SO_REUSEADDR when connecting
- o Fix Windows build
- o Fix a bug in event_rpcgen when generated fixed-sized entries
-
-Changes in 1.4.4-stable:
- o Correct the documentation on buffer printf functions.
- o Don't warn on unimplemented epoll_create(): this isn't a problem, just a reason to fall back to poll or select.
- o Correctly handle timeouts larger than 35 minutes on Linux with epoll.c. This is probably a kernel defect, but we'll have to support old kernels anyway even if it gets fixed.
- o Fix a potential stack corruption bug in tagging on 64-bit CPUs.
- o expose bufferevent_setwatermark via header files and fix high watermark on read
- o fix a bug in bufferevent read water marks and add a test for them
- o introduce bufferevent_setcb and bufferevent_setfd to allow better manipulation of bufferevents
- o use libevent's internal timercmp on all platforms, to avoid bugs on old platforms where timercmp(a,b,<=) is buggy.
- o reduce system calls for getting current time by caching it.
- o fix evhttp_bind_socket() so that multiple sockets can be bound by the same http server.
- o Build test directory correctly with CPPFLAGS set.
- o Fix build under Visual C++ 2005.
- o Expose evhttp_accept_socket() API.
- o Merge windows gettimeofday() replacement into a new evutil_gettimeofday() function.
- o Fix autoconf script behavior on IRIX.
- o Make sure winsock2.h include always comes before windows.h include.
-
-Changes in 1.4.3-stable:
- o include Content-Length in reply for HTTP/1.0 requests with keep-alive
- o Patch from Tani Hosokawa: make some functions in http.c threadsafe.
- o Do not free the kqop file descriptor in other processes, also allow it to be 0; from Andrei Nigmatulin
- o make event_rpcgen.py generate code include event-config.h; reported by Sam Banks.
- o make event methods static so that they are not exported; from Andrei Nigmatulin
- o make RPC replies use application/octet-stream as mime type
- o do not delete uninitialized timeout event in evdns
-
-Changes in 1.4.2-rc:
- o remove pending timeouts on event_base_free()
- o also check EAGAIN for Solaris' event ports; from W.C.A. Wijngaards
- o devpoll and evport need reinit; tested by W.C.A Wijngaards
- o event_base_get_method; from Springande Ulv
- o Send CRLF after each chunk in HTTP output, for compliance with RFC2626. Patch from "propanbutan". Fixes bug 1894184.
- o Add a int64_t parsing function, with unit tests, so we can apply Scott Lamb's fix to allow large HTTP values.
- o Use a 64-bit field to hold HTTP content-lengths. Patch from Scott Lamb.
- o Allow regression code to build even without Python installed
- o remove NDEBUG ifdefs from evdns.c
- o update documentation of event_loop and event_base_loop; from Tani Hosokawa.
- o detect integer types properly on platforms without stdint.h
- o Remove "AM_MAINTAINER_MODE" declaration in configure.in: now makefiles and configure should get re-generated automatically when Makefile.am or configure.in chanes.
- o do not insert event into list when evsel->add fails
-
-Changes in 1.4.1-beta:
- o free minheap on event_base_free(); from Christopher Layne
- o debug cleanups in signal.c; from Christopher Layne
- o provide event_base_new() that does not set the current_base global
- o bufferevent_write now uses a const source argument; report from Charles Kerr
- o better documentation for event_base_loopexit; from Scott Lamb.
- o Make kqueue have the same behavior as other backends when a signal is caught between event_add() and event_loop(). Previously, it would catch and ignore such signals.
- o Make kqueue restore signal handlers correctly when event_del() is called.
- o provide event_reinit() to reintialize an event_base after fork
- o small improvements to evhttp documentation
- o always generate Date and Content-Length headers for HTTP/1.1 replies
- o set the correct event base for HTTP close events
- o New function, event_{base_}loopbreak. Like event_loopexit, it makes an event loop stop executing and return. Unlike event_loopexit, it keeps subsequent pending events from getting executed. Patch from Scott Lamb
- o Removed obsoleted recalc code
- o pull setters/getters out of RPC structures into a base class to which we just need to store a pointer; this reduces the memory footprint of these structures.
- o fix a bug with event_rpcgen for integers
- o move EV_PERSIST handling out of the event backends
- o support for 32-bit tag numbers in rpc structures; this is wire compatible, but changes the API slightly.
- o prefix {encode,decode}_tag functions with evtag to avoid collisions
- o Correctly handle DNS replies with no answers set (Fixes bug 1846282)
- o The configure script now takes an --enable-gcc-warnings option that turns on many optional gcc warnings. (Nick has been building with these for a while, but they might be useful to other developers.)
- o When building with GCC, use the "format" attribute to verify type correctness of calls to printf-like functions.
- o removed linger from http server socket; reported by Ilya Martynov
- o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.
- o demote most http warnings to debug messages
- o Fix Solaris compilation; from Magne Mahre
- o Add a "Date" header to HTTP responses, as required by HTTP 1.1.
- o Support specifying the local address of an evhttp_connection using set_local_address
- o Fix a memory leak in which failed HTTP connections would not free the request object
- o Make adding of array members in event_rpcgen more efficient, but doubling memory allocation
- o Fix a memory leak in the DNS server
- o Fix compilation when DNS_USE_OPENSSL_FOR_ID is enabled
- o Fix buffer size and string generation in evdns_resolve_reverse_ipv6().
- o Respond to nonstandard DNS queries with "NOTIMPL" rather than by ignoring them.
- o In DNS responses, the CD flag should be preserved, not the TC flag.
- o Fix http.c to compile properly with USE_DEBUG; from Christopher Layne
- o Handle NULL timeouts correctly on Solaris; from Trond Norbye
- o Recalculate pending events properly when reallocating event array on Solaris; from Trond Norbye
- o Add Doxygen documentation to header files; from Mark Heily
- o Add a evdns_set_transaction_id_fn() function to override the default
- transaction ID generation code.
- o Add an evutil module (with header evutil.h) to implement our standard cross-platform hacks, on the theory that somebody else would like to use them too.
- o Fix signals implementation on windows.
- o Fix http module on windows to close sockets properly.
- o Make autogen.sh script run correctly on systems where /bin/sh isn't bash. (Patch from Trond Norbye, rewritten by Hagne Mahre and then Hannah Schroeter.)
- o Skip calling gettime() in timeout_process if we are not in fact waiting for any events. (Patch from Trond Norbye)
- o Make test subdirectory compile under mingw.
- o Fix win32 buffer.c behavior so that it is correct for sockets (which do not like ReadFile and WriteFile).
- o Make the test.sh script run unit tests for the evpoll method.
- o Make the entire evdns.h header enclosed in "extern C" as appropriate.
- o Fix implementation of strsep on platforms that lack it
- o Fix implementation of getaddrinfo on platforms that lack it; mainly, this will make Windows http.c work better. Original patch by Lubomir Marinov.
- o Fix evport implementation: port_disassociate called on unassociated events resulting in bogus errors; more efficient memory management; from Trond Norbye and Prakash Sangappa
- o support for hooks on rpc input and output; can be used to implement rpc independent processing such as compression or authentication.
- o use a min heap instead of a red-black tree for timeouts; as a result finding the min is a O(1) operation now; from Maxim Yegorushkin
- o associate an event base with an rpc pool
- o added two additional libraries: libevent_core and libevent_extra in addition to the regular libevent. libevent_core contains only the event core whereas libevent_extra contains dns, http and rpc support
- o Begin using libtool's library versioning support correctly. If we don't mess up, this will more or less guarantee binaries linked against old versions of libevent continue working when we make changes to libevent that do not break backward compatibility.
- o Fix evhttp.h compilation when TAILQ_ENTRY is not defined.
- o Small code cleanups in epoll_dispatch().
- o Increase the maximum number of addresses read from a packet in evdns to 32.
- o Remove support for the rtsig method: it hasn't compiled for a while, and nobody seems to miss it very much. Let us know if there's a good reason to put it back in.
- o Rename the "class" field in evdns_server_request to dns_question_class, so that it won't break compilation under C++. Use a macro so that old code won't break. Mark the macro as deprecated.
- o Fix DNS unit tests so that having a DNS server with broken IPv6 support is no longer cause for aborting the unit tests.
- o Make event_base_free() succeed even if there are pending non-internal events on a base. This may still leak memory and fds, but at least it no longer crashes.
- o Post-process the config.h file into a new, installed event-config.h file that we can install, and whose macros will be safe to include in header files.
- o Remove the long-deprecated acconfig.h file.
- o Do not require #include <sys/types.h> before #include <event.h>.
- o Add new evutil_timer* functions to wrap (or replace) the regular timeval manipulation functions.
- o Fix many build issues when using the Microsoft C compiler.
- o Remove a bash-ism in autogen.sh
- o When calling event_del on a signal, restore the signal handler's previous value rather than setting it to SIG_DFL. Patch from Christopher Layne.
- o Make the logic for active events work better with internal events; patch from Christopher Layne.
- o We do not need to specially remove a timeout before calling event_del; patch from Christopher Layne.
+Changes in 1.4.14b-stable
+ o Set the VERSION_INFO correctly for 1.4.14
+
+Changes in 1.4.14-stable
+ o Add a .gitignore file for the 1.4 branch. (d014edb)
+ o Backport evbuffer_readln(). (b04cc60 Nicholas Marriott)
+ o Make the evbuffer_readln backport follow the current API (c545485)
+ o Valgrind fix: Clear struct kevent before checking for OSX bug. (5713d5d William Ahern)
+ o Fix a crash when reading badly formatted resolve.conf (5b10d00 Yasuoka Masahiko)
+ o Fix memory-leak of signal handler array with kqueue. [backport] (01f3775)
+ o Update sample/signal-test.c to use newer APIs and not leak. (891765c Evan Jones)
+ o Correct all versions in 1.4 branch (ac0d213)
+ o Make evutil_make_socket_nonblocking() leave any other flags alone. (81c26ba Jardel Weyrich)
+ o Adjusted fcntl() retval comparison on evutil_make_socket_nonblocking(). (5f2e250 Jardel Weyrich)
+ o Correct a debug message in evhttp_parse_request_line (35df59e)
+ o Merge branch 'readln-backport' into patches-1.4 (8771d5b)
+ o Do not send an HTTP error when we've already closed or responded. (4fd2dd9 Pavel Plesov)
+ o Re-add event_siglcb; some old code _was_ still using it. :( (bd03d06)
+ o Make Libevent 1.4 build on win32 with Unicode enabled. (bce58d6 Brodie Thiesfield)
+ o Distribute nmake makefile for 1.4 (20d706d)
+ o do not fail while sending on http connections the client closed. (5c8b446)
+ o make evhttp_send() safe against terminated connections, too (01ea0c5)
+ o Fix a free(NULL) in min_heap.h (2458934)
+ o Fix memory leak when setting up priorities; reported by Alexander Drozdov (cb1a722)
+ o Clean up properly when adding a signal handler fails. (ae6ece0 Gilad Benjamini)
+ o Do not abort HTTP requests missing a reason string. (29d7b32 Pierre Phaneuf)
+ o Fix compile warning in http.c (906d573)
+ o Define _REENTRANT as needed on Solaris, elsewhere (6cbea13)
+
+
+Changes in 1.4.13-stable:
+ o If the kernel tells us that there are a negative number of bytes to read from a socket, do not believe it. Fixes bug 2841177; found by Alexander Pronchenkov.
+ o Do not allocate the maximum event queue and fd array for the epoll backend at startup. Instead, start out accepting 32 events at a time, and double the queue's size when it seems that the OS is generating events faster than we're requesting them. Saves up to 512K per epoll-based event_base. Resolves bug 2839240.
+ o Fix compilation on Android, which forgot to define fd_mask in its sys/select.h
+ o Do not drop data from evbuffer when out of memory; reported by Jacek Masiulaniec
+ o Rename our replacement compat/sys/_time.h header to avoid build a conflict on HPUX; reported by Kathryn Hogg.
+ o Build kqueue.c correctly on GNU/kFreeBSD platforms. Patch pulled upstream from Debian.
+ o Fix a problem with excessive memory allocation when using multiple event priorities.
+ o When running set[ug]id, don't check the environment. Based on a patch from OpenBSD.
+
+
+Changes in 1.4.12-stable:
+ o Try to contain degree of failure when running on a win32 version so heavily firewalled that we can't fake a socketpair.
+ o Fix an obscure timing-dependent, allocator-dependent crash in the evdns code.
+ o Use __VA_ARGS__ syntax for varargs macros in event_rpcgen when compiler is not GCC.
+ o Activate fd events in a pseudorandom order with O(N) backends, so that we don't systematically favor low fds (select) or earlier-added fds (poll, win32).
+ o Fix another pair of fencepost bugs in epoll.c. [Patch from Adam Langley.]
+ o Do not break evdns connections to nameservers when our IP changes.
+ o Set truncated flag correctly in evdns server replies.
+ o Disable strict aliasing with GCC: our code is not compliant with it.
+
+Changes in 1.4.11-stable:
+ o Fix a bug when removing a timeout from the heap. [Patch from Marko Kreen]
+ o Remove the limit on size of HTTP headers by removing static buffers.
+ o Fix a nasty dangling pointer bug in epoll.c that could occur after epoll_recalc(). [Patch from Kevin Springborn]
+ o Distribute Win32-Code/event-config.h, not ./event-config.h
+
+Changes in 1.4.10-stable:
+ o clean up buffered http connection data on reset; reported by Brian O'Kelley
+ o bug fix and potential race condition in signal handling; from Alexander Drozdov
+ o rename the Solaris event ports backend to evport
+ o support compilation on Haiku
+ o fix signal processing when a signal callback delivers a signal; from Alexander Drozdov
+ o const-ify some arguments to evdns functions.
+ o off-by-one error in epoll_recalc; reported by Victor Goya
+ o include Doxyfile in tar ball; from Jeff Garzik
+ o correctly parse queries with encoded \r, \n or + characters
+
+Changes in 1.4.9-stable:
+ o event_add would not return error for some backends; from Dean McNamee
+ o Clear the timer cache on entering the event loop; reported by Victor Chang
+ o Only bind the socket on connect when a local address has been provided; reported by Alejo Sanchez
+ o Allow setting of local port for evhttp connections to support millions of connections from a single system; from Richard Jones.
+ o Clear the timer cache when leaving the event loop; reported by Robin Haberkorn
+ o Fix a typo in setting the global event base; reported by lance.
+ o Fix a memory leak when reading multi-line headers
+ o Fix a memory leak by not running explicit close detection for server connections
+
+Changes in 1.4.8-stable:
+ o Match the query in DNS replies to the query in the request; from Vsevolod Stakhov.
+ o Fix a merge problem in which name_from_addr returned pointers to the stack; found by Jiang Hong.
+ o Do not remove Accept-Encoding header
+
+Changes in 1.4.7-stable:
+ o Fix a bug where headers arriving in multiple packets were not parsed; fix from Jiang Hong; test by me.
+
+Changes in 1.4.6-stable:
+ o evutil.h now includes <stdarg.h> directly
+ o switch all uses of [v]snprintf over to evutil
+ o Correct handling of trailing headers in chunked replies; from Scott Lamb.
+ o Support multi-line HTTP headers; based on a patch from Moshe Litvin
+ o Reject negative Content-Length headers; anonymous bug report
+ o Detect CLOCK_MONOTONIC at runtime for evdns; anonymous bug report
+ o Fix a bug where deleting signals with the kqueue backend would cause subsequent adds to fail
+ o Support multiple events listening on the same signal; make signals regular events that go on the same event queue; problem report by Alexander Drozdov.
+ o Deal with evbuffer_read() returning -1 on EINTR|EAGAIN; from Adam Langley.
+ o Fix a bug in which the DNS server would incorrectly set the type of a cname reply to a.
+ o Fix a bug where setting the timeout on a bufferevent would take not effect if the event was already pending.
+ o Fix a memory leak when using signals for some event bases; reported by Alexander Drozdov.
+ o Add libevent.vcproj file to distribution to help with Windows build.
+ o Fix a problem with epoll() and reinit; problem report by Alexander Drozdov.
+ o Fix off-by-one errors in devpoll; from Ian Bell
+ o Make event_add not change any state if it fails; reported by Ian Bell.
+ o Do not warn on accept when errno is either EAGAIN or EINTR
+
+Changes in 1.4.5-stable:
+ o Fix connection keep-alive behavior for HTTP/1.0
+ o Fix use of freed memory in event_reinit; pointed out by Peter Postma
+ o Constify struct timeval * where possible; pointed out by Forest Wilkinson
+ o allow min_heap_erase to be called on removed members; from liusifan.
+ o Rename INPUT and OUTPUT to EVRPC_INPUT and EVRPC_OUTPUT. Retain INPUT/OUTPUT aliases on on-win32 platforms for backwards compatibility.
+ o Do not use SO_REUSEADDR when connecting
+ o Fix Windows build
+ o Fix a bug in event_rpcgen when generated fixed-sized entries
+
+Changes in 1.4.4-stable:
+ o Correct the documentation on buffer printf functions.
+ o Don't warn on unimplemented epoll_create(): this isn't a problem, just a reason to fall back to poll or select.
+ o Correctly handle timeouts larger than 35 minutes on Linux with epoll.c. This is probably a kernel defect, but we'll have to support old kernels anyway even if it gets fixed.
+ o Fix a potential stack corruption bug in tagging on 64-bit CPUs.
+ o expose bufferevent_setwatermark via header files and fix high watermark on read
+ o fix a bug in bufferevent read water marks and add a test for them
+ o introduce bufferevent_setcb and bufferevent_setfd to allow better manipulation of bufferevents
+ o use libevent's internal timercmp on all platforms, to avoid bugs on old platforms where timercmp(a,b,<=) is buggy.
+ o reduce system calls for getting current time by caching it.
+ o fix evhttp_bind_socket() so that multiple sockets can be bound by the same http server.
+ o Build test directory correctly with CPPFLAGS set.
+ o Fix build under Visual C++ 2005.
+ o Expose evhttp_accept_socket() API.
+ o Merge windows gettimeofday() replacement into a new evutil_gettimeofday() function.
+ o Fix autoconf script behavior on IRIX.
+ o Make sure winsock2.h include always comes before windows.h include.
+
+Changes in 1.4.3-stable:
+ o include Content-Length in reply for HTTP/1.0 requests with keep-alive
+ o Patch from Tani Hosokawa: make some functions in http.c threadsafe.
+ o Do not free the kqop file descriptor in other processes, also allow it to be 0; from Andrei Nigmatulin
+ o make event_rpcgen.py generate code include event-config.h; reported by Sam Banks.
+ o make event methods static so that they are not exported; from Andrei Nigmatulin
+ o make RPC replies use application/octet-stream as mime type
+ o do not delete uninitialized timeout event in evdns
+
+Changes in 1.4.2-rc:
+ o remove pending timeouts on event_base_free()
+ o also check EAGAIN for Solaris' event ports; from W.C.A. Wijngaards
+ o devpoll and evport need reinit; tested by W.C.A Wijngaards
+ o event_base_get_method; from Springande Ulv
+ o Send CRLF after each chunk in HTTP output, for compliance with RFC2626. Patch from "propanbutan". Fixes bug 1894184.
+ o Add a int64_t parsing function, with unit tests, so we can apply Scott Lamb's fix to allow large HTTP values.
+ o Use a 64-bit field to hold HTTP content-lengths. Patch from Scott Lamb.
+ o Allow regression code to build even without Python installed
+ o remove NDEBUG ifdefs from evdns.c
+ o update documentation of event_loop and event_base_loop; from Tani Hosokawa.
+ o detect integer types properly on platforms without stdint.h
+ o Remove "AM_MAINTAINER_MODE" declaration in configure.in: now makefiles and configure should get re-generated automatically when Makefile.am or configure.in chanes.
+ o do not insert event into list when evsel->add fails
+
+Changes in 1.4.1-beta:
+ o free minheap on event_base_free(); from Christopher Layne
+ o debug cleanups in signal.c; from Christopher Layne
+ o provide event_base_new() that does not set the current_base global
+ o bufferevent_write now uses a const source argument; report from Charles Kerr
+ o better documentation for event_base_loopexit; from Scott Lamb.
+ o Make kqueue have the same behavior as other backends when a signal is caught between event_add() and event_loop(). Previously, it would catch and ignore such signals.
+ o Make kqueue restore signal handlers correctly when event_del() is called.
+ o provide event_reinit() to reintialize an event_base after fork
+ o small improvements to evhttp documentation
+ o always generate Date and Content-Length headers for HTTP/1.1 replies
+ o set the correct event base for HTTP close events
+ o New function, event_{base_}loopbreak. Like event_loopexit, it makes an event loop stop executing and return. Unlike event_loopexit, it keeps subsequent pending events from getting executed. Patch from Scott Lamb
+ o Removed obsoleted recalc code
+ o pull setters/getters out of RPC structures into a base class to which we just need to store a pointer; this reduces the memory footprint of these structures.
+ o fix a bug with event_rpcgen for integers
+ o move EV_PERSIST handling out of the event backends
+ o support for 32-bit tag numbers in rpc structures; this is wire compatible, but changes the API slightly.
+ o prefix {encode,decode}_tag functions with evtag to avoid collisions
+ o Correctly handle DNS replies with no answers set (Fixes bug 1846282)
+ o The configure script now takes an --enable-gcc-warnings option that turns on many optional gcc warnings. (Nick has been building with these for a while, but they might be useful to other developers.)
+ o When building with GCC, use the "format" attribute to verify type correctness of calls to printf-like functions.
+ o removed linger from http server socket; reported by Ilya Martynov
+ o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.
+ o demote most http warnings to debug messages
+ o Fix Solaris compilation; from Magne Mahre
+ o Add a "Date" header to HTTP responses, as required by HTTP 1.1.
+ o Support specifying the local address of an evhttp_connection using set_local_address
+ o Fix a memory leak in which failed HTTP connections would not free the request object
+ o Make adding of array members in event_rpcgen more efficient, but doubling memory allocation
+ o Fix a memory leak in the DNS server
+ o Fix compilation when DNS_USE_OPENSSL_FOR_ID is enabled
+ o Fix buffer size and string generation in evdns_resolve_reverse_ipv6().
+ o Respond to nonstandard DNS queries with "NOTIMPL" rather than by ignoring them.
+ o In DNS responses, the CD flag should be preserved, not the TC flag.
+ o Fix http.c to compile properly with USE_DEBUG; from Christopher Layne
+ o Handle NULL timeouts correctly on Solaris; from Trond Norbye
+ o Recalculate pending events properly when reallocating event array on Solaris; from Trond Norbye
+ o Add Doxygen documentation to header files; from Mark Heily
+ o Add a evdns_set_transaction_id_fn() function to override the default
+ transaction ID generation code.
+ o Add an evutil module (with header evutil.h) to implement our standard cross-platform hacks, on the theory that somebody else would like to use them too.
+ o Fix signals implementation on windows.
+ o Fix http module on windows to close sockets properly.
+ o Make autogen.sh script run correctly on systems where /bin/sh isn't bash. (Patch from Trond Norbye, rewritten by Hagne Mahre and then Hannah Schroeter.)
+ o Skip calling gettime() in timeout_process if we are not in fact waiting for any events. (Patch from Trond Norbye)
+ o Make test subdirectory compile under mingw.
+ o Fix win32 buffer.c behavior so that it is correct for sockets (which do not like ReadFile and WriteFile).
+ o Make the test.sh script run unit tests for the evpoll method.
+ o Make the entire evdns.h header enclosed in "extern C" as appropriate.
+ o Fix implementation of strsep on platforms that lack it
+ o Fix implementation of getaddrinfo on platforms that lack it; mainly, this will make Windows http.c work better. Original patch by Lubomir Marinov.
+ o Fix evport implementation: port_disassociate called on unassociated events resulting in bogus errors; more efficient memory management; from Trond Norbye and Prakash Sangappa
+ o support for hooks on rpc input and output; can be used to implement rpc independent processing such as compression or authentication.
+ o use a min heap instead of a red-black tree for timeouts; as a result finding the min is a O(1) operation now; from Maxim Yegorushkin
+ o associate an event base with an rpc pool
+ o added two additional libraries: libevent_core and libevent_extra in addition to the regular libevent. libevent_core contains only the event core whereas libevent_extra contains dns, http and rpc support
+ o Begin using libtool's library versioning support correctly. If we don't mess up, this will more or less guarantee binaries linked against old versions of libevent continue working when we make changes to libevent that do not break backward compatibility.
+ o Fix evhttp.h compilation when TAILQ_ENTRY is not defined.
+ o Small code cleanups in epoll_dispatch().
+ o Increase the maximum number of addresses read from a packet in evdns to 32.
+ o Remove support for the rtsig method: it hasn't compiled for a while, and nobody seems to miss it very much. Let us know if there's a good reason to put it back in.
+ o Rename the "class" field in evdns_server_request to dns_question_class, so that it won't break compilation under C++. Use a macro so that old code won't break. Mark the macro as deprecated.
+ o Fix DNS unit tests so that having a DNS server with broken IPv6 support is no longer cause for aborting the unit tests.
+ o Make event_base_free() succeed even if there are pending non-internal events on a base. This may still leak memory and fds, but at least it no longer crashes.
+ o Post-process the config.h file into a new, installed event-config.h file that we can install, and whose macros will be safe to include in header files.
+ o Remove the long-deprecated acconfig.h file.
+ o Do not require #include <sys/types.h> before #include <event.h>.
+ o Add new evutil_timer* functions to wrap (or replace) the regular timeval manipulation functions.
+ o Fix many build issues when using the Microsoft C compiler.
+ o Remove a bash-ism in autogen.sh
+ o When calling event_del on a signal, restore the signal handler's previous value rather than setting it to SIG_DFL. Patch from Christopher Layne.
+ o Make the logic for active events work better with internal events; patch from Christopher Layne.
+ o We do not need to specially remove a timeout before calling event_del; patch from Christopher Layne.
diff --git a/contrib/libs/libevent/ChangeLog-2.0 b/contrib/libs/libevent/ChangeLog-2.0
index 16f36008cd..e67c66f929 100644
--- a/contrib/libs/libevent/ChangeLog-2.0
+++ b/contrib/libs/libevent/ChangeLog-2.0
@@ -1,1280 +1,1280 @@
-Changes in version 2.0.21-stable (18 Nov 2012)
-BUGFIXES:
- o ssl: Don't discard SSL read event when timeout and read come close together (576b29f)
- o ssl: Stop looping in "consider_reading" if reading is suspended. (f719b8a Joachim Bauch)
- o ssl: No need to reserve space if reading is suspended. (1acf2eb Joachim Bauch)
- o dns: Avoid a memory-leak on OOM in evdns. (73e85dd, f2bff75 George Danchev)
- o build: Use python2 rather than python (0eb0109 Ross Lagerwall)
- o build: Compile without warnings on mingw64 (94866c2)
- o build: Fix compilation on mingw64 with -DUSE_DEBUG (62bd2c4)
- o build: Make rpcgen_wrapper.sh work on systems without a "python2" binary (f3009e4)
- o iocp: Close IOCP listener socket on free when LEV_OPT_CLOSE_ON_FREE is set (cb853ea Juan Pablo Fernandez)
- o core: Avoid crash when event_pending() called with no event_base set on event (e3cccf3)
- o misc: remove stray 'x' so print_err will compile when uncommented (ac35650 Patrick Pelletier)
- o tests: Fix renegotiation test to work around openssl 1.0.1 bug (c2f3086)
- o tests: Warn when openssl version in unit test mismatches compiled version. (ac009f9)
-
-
-Changes in version 2.0.20-stable (23 Aug 2012)
-BUGFIXES:
- o core: Make event_pending() threadsafe. (be7a95c Simon Liu)
- o win32: avoid crash when waiting forever on zero fds. (160e58b)
- o evhttp: Fix a memory leak on error in evhttp_uriencode (11c8b31)
- o evbuffer: Avoid possible needless call to writev. Found by coverity. (6a4ec5c)
- o evdns: memset sockaddr_in before using it. Found by coverity. (a1a0e67)
- o evhttp: Check more setsockopt return values when binding sockets. Found by coverity (a0912e3)
- o evdns: Avoid segfault on weird timeout during name lookup. (dc32077 Greg Hazel)
- o bufferevent_ssl: Correctly invoke callbacks when a SSL bufferevent reads some and then blocks. (606ac43)
-
-
-PORTABILITY FIXES:
- o check for arc4random_buf at runtime, on OS X (bff5f94 Greg Hazel)
- o Correctly check for arc4random_buf (fcec3e8 Sebastian Hahn)
- o Add explicit AC_PROG_SED to configure.in so all autoconfs will expose $(SED) (ca80ea6)
-
-BUILD FIXES:
- o Add GCC annotations so that the vsprintf functions get checked properly (117e327)
- o Fix an unused variable warning on *BSD. (c0720c1)
-
-UNIT TEST FIXES:
- o Fix a couple of memory leaks (found with Valgrind). (3b2529a Ross Lagerwall)
- o Remove deadcode in http regression tests. Found by coverity. (5553346)
- o Fix possible uninitialized read in dns regression tests. Found by coverity. (2259777)
- o Set umask before calling mkstemp in unit tests. Found by coverity (f1ce15d)
- o Fix various check-after-dereference issues in unit tests: found by coverity (4f3732d)
- o Fix resource leaks in the unit tests; found by coverity (270f279)
- o Add some missing null checks to unit tests; found by coverity (f021c3d)
- o Avoid more crashes/bad calls in unit tests; found by coverity (3cde5bf)
- o Remove unused variable; spotted by coverity (6355b2a)
- o Add checks to various return values in unit tests. Found by coverity (b9e7329)
- o Move assignment outside tt_assert in ssl unit tests. Appeases coverity. (a2006c0)
-
-
-
-Changes in version 2.0.19-stable (3 May 2012)
-BUGFIXES (CORE):
- o Refactor event_persist_closure: raise and extract some common logic (bec22b4)
- o If time has jumped so we'd reschedule a periodic event in the past, schedule it for the future instead (dfd808c)
- o If a higher-priority event becomes active, don't continue running events of the current priority. (2bfda40)
-
-BUGFIXES (SSL):
- o Fixed potential double-readcb execution with openssl bufferevents. (4e62cd1 Mark Ellzey)
-
-BUGFIXES (DNS):
- o Cancel a probe request when the server is freed, and ignore cancelled probe callbacks (94d2336 Greg Hazel)
- o Remove redundant DNS_ERR_CANCEL check, move comment (46b8060 Greg Hazel)
- o When retransmitting a timed-out DNS request, pick a fresh nameserver. (3d9e52a)
-
-DOCUMENTATION FIXES:
- o Fix a typo in the bufferevent documentation (98e9119)
- o Add missing ) to changelog; spotted by rransom (4c7ee6b)
- o Fix the website URL in the readme (f775521)
-
-COMPILATION FIXES:
- o Fix a compilation error with MSVC 2005 due to use of mode_t (336dcae)
- o Configure with gcc older than 2.95 (4a6fd43 Sebastian Hahn)
- o Generate event-config.h with a single sed script (30b6f88 Zack Weinberg)
-
-FORWARD-COMPATIBILITY:
- o Backport: provide EVENT_LOG_* names, and deprecate _EVENT_LOG_* (d1a03b2)
-
-TESTING/DEBUGGING SUPPORT:
- o dns-example.c can now take a resolv.conf file on the commandline (6610fa5)
- o Make some evdns.c debug logs more verbose (d873d67)
- o Work-around a stupid gcov-breaking bug in OSX 10.6 (b3887cd)
-
-
-
-Changes in version 2.0.18-stable (22 Mar 2012)
-BUGFIXES (core):
- o Make uses of open() close-on-exec safe by introducing an internal evutil_open_closeonexec. (d2b5f72 Ross Lagerwall, 03dce42)
-
-BUGFIXES (kqueue):
- o Properly zero the kevent in kq_setup_kevent() (c2c7b39 Sebastian Hahn)
-
-BUILD FIXES:
- o Added OPENSSL_LDFLAGS env variable which is appended to SSL checks. (9278196 Mark Ellzey)
- o Changed OPENSSL_LDFLAGS to OPENSSL_LIBADD (2d67b63 Mark Ellzey)
- o Don't do clang version detection when disabling some flags (083296b Sebastian Hahn)
-
-BUGFIXES (dns):
- o Stop crashing in evdns when nameserver probes give a weird error (bec5068)
-
-
-Changes in version 2.0.17-stable (10 Feb 2012)
-
-BUGFIXES (core):
- o Be absolutely sure to clear pncalls before leaving event_signal_closure (11f36a5)
- o check for sysctl before we use it (358c745 Mike Frysinger)
- o Remove bogus casts of socket to int before calling ev_callback (f032516)
- o Make evconnlistener work around bug in older Linux when getting nmapped (ecfc720)
- o Fix a list corruption bug when using event_reinit() with signals present (6e41cdc)
- o Fix a fd leak in event_reinit() (3f18ad1)
- o Do a memberwise comparison of threading function tables (c94a5f2 Nate R)
- o Use C-style comments in C source files (for compatibility with compilers such as xlc on AIX). (d84d917 Greg Hewgill)
- o Avoid crash when freeing event_iocp and using event_set_mem_functions (19715a6)
- o In the kqueue backend, do not report EBADF as an EV_READ (5d7bfa1 Nicholas Marriott)
-
-BUGFIXES (evbuffer and bufferevents):
- o Fix behavior of evbuffer_peek(buf,-1,NULL,NULL,0) (c986f23 Zack Weinberg)
- o Loop on filtering SSL reads until we are blocked or exhausted. (5b4b812)
-
-BUGFIXES (evhttp):
- o Force strict validation of HTTP version in response. (790f6b3 Catalin Patulea)
-
-BUGFIXES (evdns):
- o evdns: fix a bug in circular-queue implementation (d6094b1)
-
-BUILD FIXES:
- o Fix a silly compilation error with the sun compiler (1927776 Colin Watt)
- o Suppress a gcc warning from ignoring fwrite return in http-sample.c (7206e8c)
-
-DOCUMENTATION FIXES:
- o Slightly clarify evbuffer_peek documentation (7bbf6ca)
- o Update copyright notices to 2012 (e49e289)
-
-NEW APIS:
- o Backport evhttp_connection_get_bufferevent to Libevent 2.0 (da70fa7 Arno Bakker)
-
-TESTS AND TEST FIXES:
- o Fix a race condition in the dns/bufferevent_connect_hostname test. (cba48c7)
- o Add function to check referential integrity of an event_base (27737d5)
- o Check event_base correctness at end of each unit test (3312b02)
- o Workaround in the unit tests for an apparent epoll bug in Linux 3.2 (dab9187)
- o Better workaround for Linux 3.2 edge-triggered epoll bug (9f9e259)
-
-Changes in version 2.0.16-stable (18 Nov 2011)
-BUGFIXES (core):
- o More detailed message in case of libevent self-debugging failure. (9e6a4ef Leonid Evdokimov)
- o epoll: close fd on alloc fail at initialization (1aee718 Jamie Iles)
- o Fix compile warning from saying event2/*.h inside a comment (447b0ba)
- o Warn when unable to construct base because of failing make_base_notifiable (4e797f3)
- o Don't try to make notifiable event_base when no threading fns are configured (e787413)
-
-BUGFIXES (evbuffer):
- o unit test for remove_buffer bug (90bd620 Greg Hazel)
- o Fix an evbuffer crash in evbuffer_remove_buffer() (c37069c)
-
-BUGFIXES (bufferevent_openssl):
- o Refactor amount-to-read calculations in buffervent_ssl consider_reading() (a186e73 Mark Ellzey)
- o Move SSL rate-limit enforcement into bytes_to_read() (96c562f)
- o Avoid spinning on OpenSSL reads (2aa036f Mark Ellzey)
-
-BUGFIXES (dns)
- o Empty DNS reply with OK status is another way to say NODATA. (21a08d6 Leonid Evdokimov)
-
-TESTING:
- o Tests for 94fba5b and f72e8f6 (d58c15e Leonid Evdokimov)
- o Test for commit aff6ba1 (f7841bf Leonid Evdokimov)
- o Style and comment tweaks for dns/leak* tests (5e42202)
- o improve test to remove at least one buffer from src (7eb52eb Greg Hazel)
-
-DOCUMENTATION:
- o Add note about evhttp_send_reply_end to its doxygen (724bfb5)
- o Update copyright dates to 2011. (3c824bd)
- o Fix typo in whatsnew-2.0.txt (674bc6a Mansour Moufid)
- o Improve win32 behavior of dns-sample.c code (a3f320e Gisle Vanem)
-
-
-
-Changes in version 2.0.15-stable (12 Oct 2011)
-BUGFIXES (DNS):
- o DNS: add ttl for negative answers using RFC 2308 idea. (f72e8f6 Leonid Evdokimov)
- o Add DNS_ERR_NODATA error code to handle empty replies. (94fba5b Leonid Evdokimov)
-
-BUFGIXES (bufferevents and evbuffers):
- o Make evbuffer callbacks get the right n_added value after evbuffer_add (1ef1f68 Alex)
- o Prefer mmap to sendfile unless a DRAINS_TO_FD flag is set. Allows add_file to work with SSL. (0ba0af9)
-
-BUGFIXES (event loop):
- o When a signal callback is activated to run multiple times, allow event_base_loopbreak to work even before they all have run. (4e8eb6a)
-
-DOCUMENTATION FIXES:
- o Fix docstring in dns.h (2b6eae5 Leonid Evdokimov)
- o refer to non-deprecated evdns functions in comments (ba5c27d Greg Hazel)
-
-BUILD AND TESTING FIXES:
- o le-proxy and regress depend on openssl directly (9ae061a Sergey Avseyev)
- o Use _SOURCES, not _sources, in sample/Makefile.am (7f82382)
- o Fixed compiler warnings for unchecked read/write calls. (c3b62fd Mark Ellzey)
- o Make write-checking fixes use tt_fail_perror (2b76847)
- o Fix some "value never used" warnings with gcc 4.6.1 (39c0cf7)
-
-
-
-Changes in version 2.0.14-stable (31 Aug 2011)
-BUGFIXES (bufferevents and evbuffers):
- o Propagate errors on the underlying bufferevent to the user. (4a34394 Joachim Bauch)
- o Ignore OpenSSL deprecation warnings on OS X (5d1b255 Sebastian Hahn)
- o Fix handling of group rate limits under 64 bytes of burst (6d5440e)
- o Solaris sendfile: correctly detect amount of data sent (643922e Michael Herf)
- o Make rate limiting work with common_timeout logic (5b18f13)
- o clear read watermark on underlying bufferevent when creating filtering bev to fix potentially failing fragmented ssl handshakes (54f7e61 Joachim Bauch)
-
-BUGFIXES (IOCP):
- o IOCP: don't launch reads or writes on an unconnected socket (495c227)
- o Make IOCP rate-limiting group support stricter and less surprising. (a98da7b)
- o Have test-ratelim.c support IOCP (0ff2c5a)
- o Make overlapped reads result in evbuffer callbacks getting invoked (6acfbdd)
- o Correctly terminate IO on an async bufferevent on bufferevent_free (e6af35d)
-
-BUGFIXES (other):
- o Fix evsig_dealloc memory leak with debugging turned on. (9b724b2 Leonid Evdokimov)
- o Fix request_finished memory leak with debugging turned on. (aff6ba1 Leonid Evdokimov)
-
-BUILD AND TESTING FIXES:
- o Allow OS-neutral builds for platforms where some versions have arc4random_buf (b442302 Mitchell Livingston)
- o Try to fix 'make distcheck' errors when building out-of-tree (04656ea Dave Hart)
- o Clean up some problems identified by Coverity. (7c11e51 Harlan Stenn)
-
-
-Changes in version 2.0.13-stable (18 Jul 2011)
-BUGFIXES
- o Avoid race-condition when initializing global locks (b683cae)
- o Fix bug in SSL bufferevents backed by a bev with a write high-watermarks (e050703 Joachim Bauch)
- o Speed up invoke_callbacks on evbuffers when there are no callbacks (f87f568 Mark Ellzey)
- o Avoid a segfault when all methods are disabled or broken (27ce38b)
- o Fix incorrect results from evbuffer_search_eol(EOL_LF) (4461f1a)
- o Add some missing checks for mm_calloc failures (89d5e09)
- o Replace an assertion for event_base_free(NULL) with a check-and-warn (09fe97d)
- o Report kqueue ebadf, epipe, and eperm as EV_READ events (1fd34ab)
- o Check if the `evhttp_new_object' function in `http.c' returns NULL. (446cc7a Mansour Moufid)
- o Use the correct printf args when formatting size_t (3203f88)
- o Complain if the caller tries to change threading cbs after setting them (cb6ecee)
-
-DOCUMENTATION FIXES AND IMPROVEMENTS
- o Revise the event/evbuffer/bufferevent doxygen for clarity and accuracy (2888fac)
- o Update Doxyfile to produce more useful output (aea0555)
-
-TEST FIXES
- o Fix up test_evutil_snprintf (caf695a)
- o Fix tinytest invocation from windows shell (57def34 Ed Day)
-
-BUILD FIXES
- o Use AM_CPPFLAGS in sample/Makefile.am, not AM_CFLAGS (4a5c82d)
- o Fix select.c compilation on systems with no NFDBITS (49d1136)
- o Fix a few warnings on OpenBSD (8ee9f9c Nicholas Marriott)
- o Don't break when building tests from git without python installed (b031adf)
- o Don't install event_rpcgen.py when --disable-libevent-install is used (e23cda3 Harlan Stenn)
- o Fix AIX build issue with TAILQ_FOREACH definition (e934096)
-
-
-Changes in version 2.0.12-stable (4 Jun 2011)
-BUGFIXES
- o Fix a warn-and-fail bug in kqueue by providing kevent() room to report errors (28317a0)
- o Fix an assert-inducing fencepost bug in the select backend (d90149d)
- o Fix failing http assertion introducd in commit 0d6622e (0848814 Kevin Ko)
- o Fix a bug that prevented us from configuring IPv6 nameservers. (74760f1)
- o Prevent size_t overflow in evhttp_htmlescape. (06c51cd Mansour Moufid)
- o Added several checks for under/overflow conditions in evhttp_handle_chunked_read (a279272 Mark Ellzey)
- o Added overflow checks in evhttp_read_body and evhttp_get_body (84560fc Mark Ellzey)
-
-DOCUMENTATION:
- o Add missing words to EVLOOP_NONBLOCK documentation (9556a7d)
-
-BUILD FIXES
- o libssl depends on libcrypto, not the other way around. (274dd03 Peter Rosin)
- o Libtool brings in the dependencies of libevent_openssl.la automatically (7b819f2 Peter Rosin)
- o Use OPENSSL_LIBS in Makefile.am (292092e Sebastian Hahn)
- o Move the win32 detection in configure.in (ceb03b9 Sebastian Hahn)
- o Correctly detect openssl on windows (6619385 Sebastian Hahn)
- o Fix a compile warning with zlib 1.2.4 and 1.2.5 (5786b91 Sebastian Hahn)
- o Fix compilation with GCC 2, which had no __builtin_expect (09d39a1 Dave Hart)
- o Fix new warnings from GCC 4.6 (06a714f)
- o Link with -lshell32 and -ladvapi32 on Win32. (86090ee Peter Rosin)
- o Make the tests build when OpenSSL is not available. (07c41be Peter Rosin)
- o Bring in the compile script from automake, if needed. (f3c7a4c Peter Rosin)
- o MSVC does not provide S_ISDIR, so provide it manually. (70be7d1 Peter Rosin)
- o unistd.h and sys/time.h might not exist. (fe93022 Peter Rosin)
- o Make sure TINYTEST_LOCAL is defined when building tinytest.c (8fa030c Peter Rosin)
- o Fix winsock2.h #include issues with MSVC (3d768dc Peter Rosin)
- o Use evutil_gettimeofday instead of relying on the system gettimeofday. (0de87fe Peter Rosin)
- o Always use evutil_snprintf, even if OS provides it (d1b2d11 Sebastian Hahn)
- o InitializeCriticalSectionAndSpinCount requires _WIN32_WINNT >= 0x0403. (816115a Peter Rosin)
- o cygwin: make it possible to build DLLs (d54d3fc)
-
-
-
-Changes in version 2.0.11-stable (27 Apr 2011)
- [Autogenerated from the Git log, sorted and cleaned by hand.]
-BUGFIXES:
- o Fix evport handling of POLLHUP and POLLERR (b42ce4b)
- o Fix compilation on Windows with NDEBUG (cb8059d)
- o Check for POLLERR, POLLHUP and POLLNVAL for Solaris event ports (0144886 Trond Norbye)
- o Detect and handle more allocation failures. (666b096 Jardel Weyrich)
- o Use event_err() only if the failure is truly unrecoverable. (3f8d22a Jardel Weyrich)
- o Handle resize failures in the select backend better. (83e805a)
- o Correctly free selectop fields when select_resize fails in select_init (0c0ec0b)
- o Make --enable-gcc-warnings a no-op if not using gcc (3267703)
- o Fix a type error in our (unused) arc4random_stir() (f736198)
- o Correctly detect and stop non-chunked http requests when the body is too long (63a715e)
- o Have event_base_gettimeofday_cached() always return wall-clock time (a459ef7)
- o Workaround for http crash bug 3078187 (5dc5662 Tomash Brechko)
- o Fix incorrect assertions and possible use-after-free in evrpc_free() (4b8f02f Christophe Fillot)
- o Reset outgoing http connection when read data in idle state. (272823f Tomash Brechko)
- o Fix subtle recursion in evhttp_connection_cb_cleanup(). (218cf19 Tomash Brechko)
- o Fix the case when failed evhttp_make_request() leaved request in the queue. (0d6622e Tomash Brechko)
- o Fix a crash bug in evdns server circular list code (00e91b3)
- o Handle calloc failure in evdns. (Found by Dave Hart) (364291e)
- o Fix a memory leak on win32 socket->event map. (b4f89f0)
- o Add a forgotten NULL check to evhttp_parse_headers (12311ff Sebastian Hahn)
- o Fix possible NULL-deref in evdns_cancel_request (5208544 Sebastian Hahn)
-
-PORTABILITY:
- o Fall back to sscanf if we have no other way to implement strtoll (453317b)
- o Build correctly on platforms without sockaddr_storage (9184563)
- o Try to build correctly on platforms with no IPv6 support (713c254)
- o Build on systems without AI_PASSIVE (cb92113)
- o Fix http unit test on non-windows platforms without getaddrinfo (6092f12)
- o Do not check for gethostbyname_r versions if we have getaddrinfo (c1260b0)
- o Include arpa/inet.h as needed on HPUX (10c834c Harlan Stenn)
- o Include util-internal.h as needed to build on platforms with no sockaddr_storage (bbf5515 Harlan Stenn)
- o Check for getservbyname even if not on win32. (af08a94 Harlan Stenn)
- o Add -D_OSF_SOURCE to fix hpux builds (0b33479 Harlan Stenn)
- o Check for allocation failures in apply_socktype_protocol_hack (637d17a)
- o Fix the check for multicast or broadcast addresses in evutil_check_interfaces (1a21d7b)
- o Avoid a free(NULL) if out-of-memory in evdns_getaddrinfo. Found by Dave Hart (3417f68)
-
-DEFENSIVE PROGRAMMING:
- o Add compile-time check for AF_UNSPEC==PF_UNSPEC (3c8f4e7)
-
-BUGS IN TESTS:
- o Fix test.sh output on solaris (b4f89b6 Dave Hart)
- o Make test-eof fail with a timeout if we never get an eof. (05a2c22 Harlan Stenn)
- o Use %s with printf in test.sh (039b9bd)
- o Add an assert to appease clang's static analyzer (b0ff7eb Sebastian Hahn)
- o Add a forgotten return value check in the unit tests (3819b62 Sebastian Hahn)
- o Actually send NULL request in http_bad_request_test (b693c32 Sebastian Hahn)
- o add some (void) casts for unused variables (65707d7 Sebastian Hahn)
- o Refactor test_getaddrinfo_async_cancel_stress() (48c44a6 Sebastian Hahn)
- o Be nice and "handle" error return values in sample code (4bac793 Sebastian Hahn)
- o Check return value of evbuffer_add_cb in tests (93a1abb Sebastian Hahn)
- o Remote some dead code from dns-example.c (744c745 Sebastian Hahn)
- o Zero a struct sockaddr_in before using it (646f9fe Sebastian Hahn)
-
-BUILD FIXES:
- o Fix warnings about AC_LANG_PROGRAM usage (f663112 Sebastian Hahn)
- o Skip check for zlib if we have no zlib.h (a317c06 Harlan Stenn)
- o Fix autoconf bracket issues; make check for getaddrinfo include netdb.h (833e5e9 Harlan Stenn)
- o Correct an AM_CFLAGS to an AM_CPPFLAGS in test/Makefile.am (9c469db Dave Hart)
- o Fix make distcheck & installation of libevent 1 headers (b5a1f9f Dave Hart)
- o Fix compilation under LLVM/clang with --enable-gcc-warnings (ad9ff58 Sebastian Hahn)
-
-FEATURES:
- o Make URI parser able to tolerate nonconformant URIs. (95060b5)
-
-DOCUMENTATION:
- o Clarify event_set_mem_functions doc (926f816)
- o Correct evhttp_del_accept_socket documentation on whether socket is closed (f665924)
- o fix spelling mistake in whatsnew-2.0.txt (deb2f73)
- o Fix sample/http-server ipv6 fixes (eb692be)
- o Comment internal headers used in sample code. (4eb281c)
- o Be explicit about how long event loops run in event.h documentation (f95bafb)
- o Add comment to configure.in to explain gc-sections test logic (c621359)
- o Fix a couple of memory leaks in samples/http-server.c. Found by Dave Hart. (2e9f665)
-
-BUILD IMPROVEMENTS:
- o Use the gcc -ffunction-segments feature to allow gc when linking with static libevent (0965c56 Dave Hart)
- o Add configure options to disable installation, regression tests (49e9bb7 Dave Hart)
-
-
-
-Changes in version 2.0.10-stable (16 Dec 2010)
- [Autogenerated from the Git log, sorted and cleaned by hand.]
-BUGFIXES
- o Minor fix for IOCP shutdown handling fix (2599b2d Kelly Brock)
- o Correctly notify the main thread when activating an event from a subthread (5beeec9)
- o Reject overlong http requests early when Expect:100-continue is set (d23839f Constantine Verutin)
- o EVUTIL_ASSERT: Use sizeof() to avoid "unused variable" warnings with -DNDEBUG. (b63ab17 Evan Jones)
-
-CODE CLEANUPS
- o bufferevent-internal.h: Use the new event2/util.h header, not evutil.h (ef5e65a Evan Jones)
- o Use relative includes instead of system includes consistently. (fbe64f2 Evan Jones)
- o Make whitespace more consistent
-
-TESTING
- o tests: Use new event2 headers instead of old compatibility headers. (4f33209 Evan Jones)
-
-DOCUMENTATION
- o Document that the cpu_hint is only used on Windows with IOCP for now (57689c4)
- o Add stuff to "whats new in 2.0" based on reading include changes since August. (18adc3f)
-
-
-Changes in 2.0.9-rc (30 Nov 2010):
- [Autogenerated from the Git log, sorted and cleaned by hand.]
-NEW AND MODIFIED APIs
- o Add a function to change a listener's callback. (46ee061)
- o Make evbuffer_add_file take ev_off_t, not off_t (ac7e52d)
- o Make rate-limits go up to SIZE_MAX/EV_SSIZE_MAX, not just INT32_MAX (2cbb1a1)
- o Add a bufferevent_get_base function (aab49b6)
-
-MAJOR BUGFIXES
- o Disable changelist for epoll by default because of Linux dup() bug; add an option and/or an envvar to reenable it for speed. (9531763)
- o Fix a 100%-CPU bug where an SSL connection would sometimes never stop trying to write (1213d3d)
- o Fix a nasty bug related to use of dup() with epoll on Linux (c281aba)
- o Fix bugs in posix thread-id calculation when sizeof(pthread_t) != sizeof(long) (fbaf077)
- o Fix some ints to evutil_socket_t; make tests pass on win64. (f817bfa Dimitre Piskyulev)
- o Set _EVENT_SIZEOF_VOID_P correctly on win32 and win64 (1ae82cd Dimitre Piskyulev)
- o Avoid double-invocation of user callback with EVUTIL_EAI_CANCEL (abf01ed)
- o Set SO_UPDATE_ACCEPT_CONTEXT on sockets from AcceptEx so that shutdown() can work (52aa419)
- o When closing a filtering bufferevent, clear callbacks on the underlying bufferevent (fc7b1b0)
-
-NEW AND MODIFIED HTTP APIs
- o Add evhttp_parse_query_str to be used with evhttp_uri_parse. (2075fbc)
- o Add evhttp_response_code to remove one more reason to include http_struct.h (22e0a9b)
- o Define enumerators for all HTTP methods, including PATCH from RFC5789 (75a7341 Felix Nawothnig)
- o Functions to actually use evhttp_bound_socket with/as evconnlistener. (006efa7)
- o Add evhttp_request_get_command so code can tell GET from POST without peeking at the struct. (49f4bf7)
- o Introduce absolute URI parsing helpers. (86dd720 Pavel Plesov)
- o Revise evhttp_uri_parse implementation to handle more of RFC3986 (eaa5f1d)
- o Add evhttp_connection_get_base() to get the event_base from an http connection (cd00079)
- o Let evhttp_parse_query return -1 on failure (b1756d0)
- o New evhttp_uri(encode|decode) functions to handle + and NUL characters right (a8148ce)
- o Add evhttp_response_code to remove one more reason to include http_struct.h (22e0a9b)
- o Tweak interface for allowed methods (f5b391e)
- o Add evhttp server alias interface, correct flagging of proxy requests. (aab8c38 Christopher Davis)
-
-HTTP BUGFIXES
- o Add some comments to http.c and make a few functions static. (90b3ed5)
- o Fix Content-Length when trying send more than 100GB of data (!) on an evhttp. (525da3e)
- o Fix a bug where we would read too much data in HTTP bodies or requests. (58a1cc6)
- o Correctly count req->body_size on http usage without Content-Length (8e342e5)
- o Avoid missed-request bug when entire http request arrives before data is flushed (74c0e86)
- o reset "chunked" flag when sending non-chunked reply (aa5f55f Joachim Bauch)
- o evhttp_encode_uri encodes all reserved characters, including !$'()*+,/:=@ (2e63a60)
- o Replace exact-version checks for HTTP/1.1 with >= or < checks (647e094)
- o evhttp: Return 501 when we get an unrecognized method, not 400. (536311a)
- o Don't disable reading from the HTTP connection after sending the request to be notified of connection-close in time (c76640b Felix Nawothnig)
- o Never call evhttp_readcb while writing. (0512487)
- o Try to fix an assertion failure related to close detection (0faaa39)
- o Correctly detect timeouts during http connects (04861d5)
- o Preliminary support for Continue expectation in evhttp. (fa9305f Christopher Davis)
-
-OTHER BUGFIXES
- o Correct logic for realigning a chain in evbuffer_add (e4f34e8)
- o Fix a minor syntax error that most compilers didn't care about (e56ff65)
- o Fix some uses of int for socket in regress (5d389dc)
- o Check return value for ioctlsocket on win32 (f5ad31c Trond Norbye)
- o Fix som event_warns that should have been event_warnx (19c71e7)
- o Fix signal handler types for win64. (b81217f)
- o Try to clear up more size_t vs int/long issues. (598d133)
- o Make sure IOCP evconnlistener uses virtual events. (7b40a00 Christopher Davis)
- o Don't free evdns_request handles until after the callback is invoked (9ed30de)
- o Fix some more cancel-related bugs in getaddrinfo_async (c7cfbcf)
- o Make evdns_getaddrinfo_cancel threadsafe (d51b2fc)
- o Only clear underlying callbacks when the user hasn't reset them. (1ac5b23)
- o Fix bug in bufferevent_connect on an openssl bufferevent that already had an fd (4f228a1)
- o Resolve an evport bug in the thread/forking test (3a67d0b)
- o Make sure the CLOEXEC flag is set on fds we open for base notification (3ab578f)
- o Fix IRIX build. sa_family collides with a #define in sys/socket.h on IRIX. (e874982 Kevin Bowling)
- o If not WIN32, include <sys/socket.h> in event2/util.h. (1cd45e5 Kevin Bowling)
- o Fix some C99-style comments to work with the xlC compiler. (c2e5e22 Kevin Bowling)
- o Add some checks since lack of TAILQ_FOREACH doesn't imply lack of FIRST, END, NEXT, or INSERT_BEFORE. Quiet some warnings in XL C. (c4dc335 Kevin Bowling)
- o Reworked AIX __ss_family workaround to use AC_STRUCT_MEMBER. (2e2a3d7 Kevin Bowling)
- o Take select from <sys/select.h> when testing in autoconf. AIX build fix. (a3a9f6b Kevin Bowling)
- o Fix snprintf related failures on IRIX. (3239073 Kevin Bowling)
- o Remove _event_initialized(); make event_initialized() a function(); make it consistent on windows and non-windows (652024b)
- o Do not let EVLOOP_ONCE exit the loop until all deferred callbacks have run (2d5e1bd)
- o Make EVLOOP_ONCE ignore internal events (0617a81)
- o Possible crash fix when freeing an underlying bufferevent of an openssl bufferevent (29f7623)
-
-HTTP CLEANUPS
- o Stop using Libevent-1 headers in regress_http (1f507d7)
- o Modernize header usage in bench_http.c (e587069)
- o fix signed/unsigned warnings in http.c (74a91e5)
- o Update the HTTP regression tests to use Libevent2 apis for non-http stuff (d9ffa89)
- o Start porting http tests to not use legacy interfaces (8505a74)
- o Convert the rest of the http tests to be non-legacy unit tests. (9bb8239)
- o Rename the confusing "base" static variable in regress_http.c (353402a)
- o Stop accessing http request struct directly from in the unit tests. (0b137f4)
- o Refactor http version parsing into a single function (a38140b)
-
-TESTING
- o Improvements to tinytest_macros.h (ad923a1)
- o Add a huge pile of tests for the new URI functions, and make them pass. (a5a76e6)
- o Unit tests for evhttp_uri_set* (bc98f5e)
- o Increase the skew tolerance to 2 seconds in thread/deferred_cb_skew (f806476 Christopher Davis)
- o Reorder backends in test.sh to match preference order in event.c (ece974f)
- o Add a stress test for getaddrinfo_cancel (da1bf52)
- o Units test for unexpected evhttp methods. (75e3320)
-
-DOCUMENTATION
- o Document behavior of URI parsing more thoroughly. (3a33462)
- o Document that two bufferevent functions only work on socket bufferevents (70e1b60)
- o add a requested docstring for event_rpcgen.CommandLine.__init__ (f1250eb)
- o Fix a mistake in http documentation found by Julien Blache (229714d)
- o Add a basic example of how to write a static HTTP server. (4e794d5)
- o Document event_get_assignment (88be27d)
- o Note that reentrant calls to libevent from logging cbs may fail badly (e431bcd)
- o Clarify EVLOOP_* documentation to be more precise. (057a514)
-
-CLEANUPS
- o Simplify the logic for choosing EPOLL_CTL_ADD vs EPOLL_CTL_MOD (2c66983)
- o Rename "size" variables in win32select that were really fd counts. (b6a158c)
- o Fix even more win64 warnings (7484df6)
- o Fix even more win64 warnings: buffer, event_tagging, http, evdns, evrpc (545a611)
- o Fix more wn64 warnings. (34b84b9 Christopher Davis)
- o Use the label_len local variable in evdns instead of recalculating it over and over (ba01456)
- o Fix some irix compilation warnings spotted by Kevin Bowling (7bcace2)
-
-
-
-Changes in 2.0.8-rc (14 Oct 2010):
- [Autogenerated from the Git log, sorted and cleaned by hand.]
-NEW APIS
- o Add error callback to evconnlistener (c4be8d8 Simon Perreault)
- o Add a LEV_OPT_THREADSAFE option for threadsafe evconnlisteners (127d4f2)
-
-CHANGED BEHAVIOR
- o Correct logic on disabling underlying bufferevents when disabling a filter (ac27eb8)
-
-BUGFIXES
- o Obey enabled status when unsuspending (040a019 Simon Perreault)
- o Warn when using the error-prone EV_SIGNAL interface in an error-prone way. Also, fix a couple of race conditions in signal.c (720bd93)
- O Make default signal backend fully threadsafe (95a7d41)
- o Put internal events at highest priority (90651b3)
- o Fix warnings in the main codebase flagged by -Wsigned-compare (9c8db0, 5e4bafb, 5c214a, 6be589a, e06f514)
- o Fix compile in kqueue.c (b395392 Sebastian Hahn)
- o Do not search outside of the system directory for windows DLLs (d49b5e3)
- o Fix a spurious-call bug on epoll.c (0faaee0)
- o Send a shutdown(SHUT_WR) before closing an http connection (e0fd870 Christopher Davis)
- o Fix warnings on mingw with gcc 4.5 (5b7a370)
- o Fix an EINVAL on evbuffer_write_iovec on OpenSolaris. (fdc640b)
- o Fix allocation error for IOCP listeners. Probably harmless, since struct event is big (481ef92)
- o Make iocp/listener/error work; don't accept again if lev is disabled. (62b429a Christopher Davis)
- o Handle rate-limiting for reading on OpenSSL bufferevents correctly. (819b171)
- o Fix serious bugs in per-bufferevent rate-limiting code (34d64f8)
- o Avoid spurious reads from just-created open openssl bufferevents (223ee40)
- o Fix a case where an ssl bufferevent with CLOSE_ON_FREE didn't close its fd (93bb7d8)
- o The corrected bufferevent filter semantics let us fix our openssl tests (34331e4)
-
-TESTING
- o Make SSL tests cover enabling/disabling EV_READ. (a5ce9ad)
- o Bump to the latest version of tinytest (f0bd83e)
- o Unit tests for listener error callbacks (045eef4)
- o New unit test for ssl bufferevents starting with connected SSLs. (02f6259)
-
-DEBUGGABILITY
- o Make debugging output for epoll backend more comprehensive (ec2b05e)
- o Make event.c debugging messages report fds (e119899)
- o Make the --enable-gcc-warnings option include signed comparison warnings (d3b096c)
-
-DEADCODE REMOVAL
- o Remove the now-useless evsig_caught and evsig_process (4858b79)
- o Remove event_base.evsigbase; nothing used it. (38d0960)
-
-
-
-Changes in 2.0.7-rc (9 Sep 2010):
- [Autogenerated from the Git log, sorted and cleaned by hand.]
-NEW APIS
- o Expose a evdns_base_nameserver_sockaddr_add() function to add a nameserver by sockaddr (1952143)
- o Add event_config_set_num_cpus_hint() for tuning win32 IOCP thread pools, etc. (2447fe8 Christopher Davis)
-
-BUGFIXES
- o Fix a nasty dangling-event bug when using rate-limiting groups (0bffe43)
- o Clean up syntax on TAILQ_ENTRY() usage to build correctly with recent MSVC (60433a0 Gilad Benjamini)
- o Make definition of WIN32_LEAN_AND_MEAN in event.h conditional (3920172 Gilad Benjamini)
- o Correctly detect failure to delete bufferevent read-timeout event (da6e7cd)
- o Set close-on-exec bit for filedescriptors created by dns subsystem (d0b8843)
- o Fix kqueue correctness test on x84_64 (6123d12)
- o Detect events with no ev_base; warn instead of crashing (f1074b7)
- o Fix an issue with forking and signal socketpairs in select/poll backends (d61b2f3)
- o Stop using global arrays to implement the EVUTIL_ctype functions (1fdec20)
- o On windows, make lock/thread function tables static (5de2bcb)
- o Close th_notify_fds and open a new pair on reinit (495ed66)
- o Declare signal handler function as "__cdecl" on Windows (f0056d0)
- o Use the _func() replacements for open, fstat, etc in evutil.c on win32 (e50c0fc)
- o Only process up to MAX_DEFERRED deferred_cbs at a time (17a14f1 Christopher Davis)
-
-THREADING BUGFIXES
- o Avoid deadlock when activating signals (970e6ad)
- o Add a condition variable backend, with implementations for pthreads and win32 (d4977b5)
- o Use conditions instead of current_event_lock to fix a deadlock (e0972c2)
- o Fix logic error in win32 TRY_LOCK that caused problems with rate-limiting (4c32b9d)
- o Avoid needlessly calling evthread_notify_base() when the loop is not running (c7a06bf)
- o Minimize calls to base_notify implementation functions, thereby avoiding needless syscalls (4632b78)
-
-IOCP BUGFIXES
- o IOCP-related evbuffer fixes (03afa20 Christopher Davis)
- o Stop IOCP when freeing the event_base (d844242 Christopher Davis)
- o Some IOCP bufferevent tweaks (76f7e7a Christopher Davis)
-
-TESTS
- o Make the regress_pthread.c tests work on windows with current test APIs (d74ae38)
- o Add a unit test for conditions (5fb1095)
- o Allow more than one copy of regression tests to run at once (a97320a)
- o Fix event_del(0) instance in bench.c (b0f284c Shuo Chen)
- o Fix a few memory leaks in the tests (1115366)
- o IOCP-related unit test tweaks (499452f Christopher Davis)
- o Improve testing of when thread-notification occurs (ce85280)
-
-BUILD AND DISTRIBUTION
- o Add pkgconfig files for libevent_{openssl,pthreads} (ebcb1f0)
- o Change include order in Makefile.nmake (4022b28)
- o Make include/event2/event-config.h not included in source dist (a4af9be)
- o Honor NDEBUG; build without warnings with NDEBUG; make NDEBUG always-off in unit test code (743f866)
- o Declare evkeyvalq and event_list even if event_struct.h comes before sys/queue.h (d3ceca8)
- o Move evkeyvalq into a separate header for evhttp_parse_query users (ca9048f)
- o Prefer autoreconf -ivf to manual autogen.sh (7ea8e89)
-
-CLEANUP
- o Completely remove the (mostly-removed) obsolete thread functions (3808168)
- o Rename regress_pthread.c to regress_thread.c (041989f)
- o Make defer-internal.h use lock macros, not direct calls to lock fns (5218d2a)
-
-DOCUMENTATION
- o Document that DNS_NO_SEARCH is an obsolete alias for DNS_QUERY_NO_SEARCH (33200e7)
- o Update the whatsnew-2.0.txt document (4991669)
-
-
-
-Changes in 2.0.6-rc (6 Aug 2010):
- [Autogenerated from the Git log, sorted by hand.]
-DOCUMENTATION
- o Document a change in the semantics of event_get_struct_event_size() (e21f5d1)
- o Add a comment to describe our plan for library versioning (9659ece)
- o Fix sentence fragment in docs for event_get_struct_event_size() (7b259b6)
-
-NEW FEATURES AND INTERFACE CHANGES
- o Remove the obsolete evthread interfaces (c5bab56)
- o Let evhttp_send_error infer the right error reasons (3990669)
- o Add a function to retrieve the other side of a bufferevent pair (17a8e2d)
- o Add bufferevent_lock()/bufferevent_unlock() (215e629)
- o Stop asserting when asked for a (unsupported) TCP dns port. Just return NULL. (7e87a59)
- o Replace (unused,always 0) is_tcp argument to evdns_add_server_port*() with flags (e1c1167)
- o Constify a couple of arguments to evdns_server_request_add_*_reply (cc2379d)
- o Add an interface to expose min_share in ratelimiting groups (6ae53d6)
-
-BUGFIXES
- o Avoid event_del on uninitialized event in event_base_free (6d19510)
- o Add some missing includes to fix Linux build again (75701e8)
- o Avoid close of uninitialized socket in evbuffer unit test (bda21e7)
- o Correctly recognize .255 addresses as link-local when looking for interfaces (8c3452b)
- o If no evdns request can be launched, return NULL, not a handle (b14f151)
- o Use generic win32 interfaces, not ASCII-only ones, where possible. (899b0a3)
- o Fix the default HTTP error template (06bd056 Felix Nawothnig)
- o Close the file in evutil_read_file whether there's an error or not. (0798dd1 Pierre Phaneuf)
- o Fix possible nullptr dereference in evhttp_send_reply_end() (29b2e23 Felix Nawothnig)
- o never let bufferevent_rlim functions return negative (0859870)
- o Make sample/hello_world work on windows (d89fdba)
- o Fix a deadlock related to event-base notification. Diagnosed by Zhou Li, Avi Bab, and Scott Lamb. (17522d2)
- o Possible fix to 100% cpu usage with epoll and openssl (cf249e7 Mike Smellie)
- o Don't race when calling event_active/event_add on a running signal event (fc5e0a2)
- o Suppress a spurious EPERM warning in epoll.c (e73cbde)
- o Fix wrong size calculation of iovec buffers when exact=1 (65abdc2 niks)
- o Change bufferevent_openssl::do_write so it doesn't call SSL_write with a 0 length buffer (c991317 Mike Smellie)
- o Fixed compilation of sample/le-proxy.c on win32 (13b912e Trond Norbye)
- o Fix rate-limit calculation on openssl bufferevents. (009f300)
- o Remember to initialize timeout events for bufferevent_async (de1f5d6 Christopher Davis)
-
-BUILD AND DISTRIBUTION CHANGES
- o Test the unlocked-deferred callback case of bufferevents (dfb75ab)
- o Remove the now-unusable EVTHREAD_LOCK/UNLOCK constants (fdfc3fc)
- o Use -Wlogical-op on gcc 4.5 or higher (d14bb92)
- o Add the libtool-generated /m4/* stuff to .gitignore (c21c663)
- o Remove some automake-generated files from version control. (9b14911)
- o Have autogen.sh pass --force-missing to automake (8a44062)
- o Set library version for libevent_pthreads correctly (b2d7440)
- o Really only add libevent_core.la to LIBADD on mingw (1425003 Sebastian Hahn)
- o Build more cleanly with NetBSDs that dislike toupper(char) (42a8c71)
- o Fix unit tests with -DUSE_DEBUG enabled (28f31a4)
- o Fix evdns build with -DUNICODE (5fa30d2)
- o Move event-config.h to include/event2 (ec347b9)
-
-TESTING
- o Add options to test-ratelim.c to check its results (2b44dcc)
- o Make test-ratelim clean up after itself better. (b5bfc44)
- o Remove the now-obsolete setup_test() and cleanup_test() functions (e73f1d7)
- o Remove all non-error prints from test/regress.c (8bc1e3d)
- o Make test.sh exit with nonzero status if tests fail (faf2a04)
- o Have the unit tests report errors from test.sh (3689bd2)
- o Fix logic in correcting high values from FIONREAD (3467f2f)
- o Add test for behavior on remote socket close (44d57ee)
- o Unit test for event_get_struct_event_size() (7510aac)
- o Make test/test.sh call test-changelist (7c92691)
- o Fix badly-behaved subtest of dns/bufferevent_connect_hostname (840a72f Joachim Bauch)
- o Add option to test-ratelim to test min_share (42f6b62)
- o Fix an assertion bug in test-ratelim (b2c6202)
- o Make tests quieter on local dns resolver failure (e996b3d)
- o Increase the tolerance in our unit tests for sloppy clocks. (170ffd2)
- o Use AF_INET socketpair to test sendfile on Solaris (9b60209)
- o Make test-changelist count cpu usage right on win32 (ea1ea3d)
-
-INTERNALS, PERFORMANCE, AND CODE CLEANUPS
- o Mark the event_err() functions as __attribute__((noreturn)) (33bbbed)
- o Do not check that event_base is set in EVBASE_ACQUIRE_LOCK (218a3c3)
- o Replace (safe) use of strcpy with memcpy to appease OpenBSD (caca2f4)
- o Remove some dead assignments (47c5dfb)
- o Fix a pedantic gcc 4.4 warning in event2/event.h (276e7ee)
- o Drain th_notify_fd[0] more bytes at a time. (a5bc15b)
- o Tidy up the code in evthread_make_base_notifiable a little (61e1eee)
- o Pass flags to fcntl(F_SETFL) and fcntl(F_SETFD) as int, not long (7c2dea1)
- o Remove unused variables in test/test-changelist.c (b00d4c0)
- o Fix whitespace. (cb927a5)
- o Improve error message for failed epoll to make debugging easier. (9e725f7)
- o Turn our socketpair() replacement into its own function (57b30cd)
-
-
-
-Changes in 2.0.5-beta (10 May 2010):
- [Autogenerated from the Git log, sorted by hand.]
-DOCUMENTATION
- o Update all our copyright notices to say "2010" (17efc1c)
- o Add Christopher Clark and Maxim Yegorushkin to the LICENSE file (38b7b57)
- o Clarify Christopher Clark's status as writer of original ht code. (78772c3)
- o Try to comment some of the event code more (cdd4c49)
- o Add a few more evmap/changelist comments (c247adc)
- o Add a comment to explain why evdns_request is now separte from request (ceefbe8)
- o Document evutil_secure_rng_init() and evutil_secure_rng_add_bytes() (a5bf43a)
- o Stop distributing and installing manpages: they were too inaccurate (7731ec8)
-
-NEW FEATURES AND INTERFACE CHANGES
- o Remove signal_assign() and signal_new() macros. (2fac0f7)
- o Make evdns use the regular logging system by default (b2f2be6)
- o Allow evbuffer_read() to split across more than 2 iovecs (e470ad3)
- o Functions to manipulate existing rate limiting groups. (ee41aca)
- o Functions to track the total bytes sent over a rate limit group. (fb366c1)
- o Detect and refuse reentrant event_base_loop() calls (b557b17)
- o Limit the maximum number of events on each socket to 65535 (819f949)
- o Add evbuffer_copyout to copy data from an evbuffer without draining (eb86c8c)
- o Expose the request and reply members of rpc_req_generic() (07edf78 Shuo Chen)
- o Add void* arguments to request_new and reply_new evrpc hooks (755fbf1 Shuo Chen)
- o Seed the RNG using sysctl() as well as /dev/urandom (71fc3eb)
- o Make evutil_secure_rng_init() work even with builtin arc4random (f980716)
- o Report DNS error when lookup fails during bufferevent_socket_connect_hostname. (0ef4070 Christopher Davis)
- o Release locks on bufferevents while executing callbacks (a5208fe Joachim Bauch) o Make debug mode catch mixed ET and non-ET events on an fd (cb67074)
- o Catch attempts to enable debug_mode too late (9ecf0d4)
- o Refuse null keys in evhttp_parse_query() (953e229 Frank Denis)
-
-BUGFIXES
- o Avoid a spurious close(-1) on Linux (70a44b6)
- o Do not close(-1) when freeing an uninitialized socket bufferevent (b34abf3)
- o Free evdns_base->req_heads on evdns_base_free (859af67)
- o Avoid an (untriggerable so far) crash bug in bufferevent_free() (0cf1431)
- o Set mem_offset for every bufferevent type (657d1b6)
- o Fix infrequent memory leak in bufferevent_init_common(). (8398641 Jardel Weyrich)
- o Make evutil_signal_active() match declaration. (e1e703d Patrick Galbraith)
- o Fix minheap code to use replacement malloc functions (a527618)
- o Fix a free(NULL) in minheap-internal.h (6f20492)
- o Fix critical bug in evbuffer_write when writev is not available (cda56ab)
- o Make the no_iovecs case of write_atmost compile (8e227b0)
- o Fix a memory leak when appending/prepending to a buffer with unused space. (45068a3)
- o Clean up a mistake in pointer manipulation in evbuffer_remove (28bfed4 Christopher Davis)
- o Always round up when there's a fractional number of msecs. (8f9e60c Christopher Davis)
- o Fix compiler warnings under WIN32 (d469c50 Giuseppe Scrivano)
- o Clean up properly when adding a signal handler fails. (b84b598 Gilad Benjamini) o Ensure that evdns_request is a persistent handle. (15bb82d Christopher Davis)
- o Free search state when finished searching to avoid an infinite loop. (a625840 Christopher Davis)
- o Assert for valid requests as necessary. (67072f3 Christopher Davis)
- o do not leak the request object on persistent connections (9d8edf2)
- o Make evdns logging threadsafe (b1c7950)
- o Fix a couple of bugs in the BSD sysctl arc4seed logic (a47a4b7)
- o Remove one last bug in last_with_datap logic. Found with valgrind (d49b92a)
- o fix a leak when unpausing evrpc requests (94ee125)
- o Fix a memory leak when unmarshalling RPC object arrays (f6ab2a2)
- o Fix compilation when openssl support is disabled (40c301b)
- o Allow empty reason line in HTTP status (739e688 Pierre Phaneuf)
- o Fix a compile warning introduced in 739e688 (bd1ed5f Sebastian Hahn)
- o Fix nonstandard TAILQ_FOREACH_REVERSE() definition (71afc52 Frank Denis)
- o Try /proc on Linux as entropy fallback; use sysctl as last resort (20fda29)
- o Fix symbol conflict between mm_*() macros and libmm (99e50e9)
- o Fix some crazy macro mistakes in arc4random.c (90d4225)
- o Make evbuffer_add_file() work on windows (dcdae6b)
- o Fix unused-variable warning when building with threads disabled (ad811cd)
- o Numerous opensolaris compilation fixes (c44de06)
- o Fix getaddrinfo with protocol unset on Solaris 9. Found by Dagobert Michelsen (2cf2a28)
- o Fix another nasty solaris getaddrinfo() behavior (3557071)
- o Define _REENTRANT as needed on Solaris, elsewhere (c1cd32a)
- o Fix some autoconf issues on OpenBSD (7c519df)
-
-BUILD AND DISTRIBUTION CHANGES
- o Distribute libevent.pc.in, not libevent.pc (22aff04)
- o Avoid errors in evutil.c when building with _UNICODE defined (b677032 Brodie Thiesfield)
- o Avoid errors in http.c when building with VC 2003 .NET (13e4f3b Brodie Thiesfield)
- o Support the standard 'make check' target in place of 'make verify' (426c8fb)
- o Remove redundant stuff from EXTRA_DIST (b660edf)
- o Switch to using AM conditionals in place of AC_LIBOBJ (2e898f5)
- o Remove an orphaned RELEASE flag in Makefile.am (0794b0d)
- o Give a better warning for bad automake versions. (77c917d)
- o Use dist_bin_SCRIPTS, not EXTRA_DIST, to distribute scripts (9eb2fd7)
- o Never test for select() on windows (3eb044d Trond Norbye)
- o Do not inhibit automake dependencies generation (10c4c90 Giuseppe Scrivano)
- o Create shared libraries under Windows (3cbca86 Giuseppe Scrivano)
- o Add ctags/etags files to .gitignore (0861d17)
- o Only specify -no-undefined on mingw (25433b9)
- o Only add libevent_core.la to LIBADD on mingw (fdc6297)
-
-TESTING
- o Get bench_http to work on Windows; add a switch to enable IOCP. (4ac38a5 Christopher Davis)
- o VC has no getopt(), so do without in bench_http. (1273d2f Christopher Davis)
- o Fix an obnoxious typo in the bufferevent_timeout_filter test (0d047c3)
- o Fix a write of uninitialized RAM in regression tests (68dc742)
- o Fix some memory leaks in the unit tests (274a7bd)
- o Make 'main/many_events' test 70 fds, not 64. (33874b0)
- o Unit-test every evbuffer_add_file() implementation. (06a4443)
- o Add more unit tests for evbuffer_expand (8c83e99)
- o Test another case of evbuffer_prepend (1234b95)
- o Fix a possible double-free bug in SSL bufferevents with CLOSE_ON_FREE (7501895) o Add dns/search_cancel unit test. (39b870b Christopher Davis)
- o Make http_base_test stop leaking an event_base. (96730d3)
- o Detect broken unsetenv at unit-test runtime (f37cd4c)
- o Implement regress_make_tempfile on win32 to test evbuffer_add_file (b4f12a1)
- o add more (currently skipped) add_file tests on win32 (05de45d)
- o Fix bench_http build on win32. (384d124)
- o Make unit test for add_file able to tell "error" from "done" (88a543f)
- o Make test for bufferevent_connect_hostname system-neutral (f89168e)
- o Make test.sh support mingw/msys on win32 (0ee6f6c)
- o Fix test.sh on freebsd (3d9e05b)
-
-INTERNALS, PERFORMANCE, AND AND CODE CLEANUPS
- o Improve the speed of evbuffer_readln() (cc1600a)
- o more whitespace normalization (2c2618d)
- o Revise evbuffer to add last_with_data (2a6d2a1)
- o Use last_with_data in place of previous_to_last (c8ac57f)
- o Remove previous_to_last from evbuffer (6f47bd1)
- o Fix last_with_data compilation on windows (1e7b986)
- o Add some glass-box tests for the last_with_data code. (17da042)
- o Improve robustness for refcounting (f1bc125)
- o Remove a needless min_heap_shift_up_() call (7204b91)
- o Increase MIN_BUFFER_SIZE to 512 (1024 on 64-bit) (2014ae4)
- o Do not use evbuffer_expand() to add the first chain to a buffer (5c0ebb3)
- o Make evbuffer_prepend handle empty buffers better (c87272b)
- o Replace last_with_data with a slightly smarter version (b7442f8)
- o Turn the increasingly complex *_CHAIN() macros into functions (96865c4)
- o Rewrite evbuffer_expand and its users (d5ebcf3)
- o Add evutil_tv_to_msec for safe conversion of timevals to milliseconds. (850c3ff Christopher Davis)
- o Initialize last_with_datap correctly in evbuffer_overlapped (a0983b6)
- o Replace EVUTIL_CLOSESOCKET macro with a function (899c1dc Sebastian Sjöberg)
- o Move domain search state to evdns_request. (beaa14a Christopher Davis)
- o Remove redundant checks for lock!=NULL before calling EVLOCK_LOCK (50ec59f)
- o Rename current_base symbol to event_global_current_base_ (c16e684)
- o Fix whitespace in evutil.c (935e150)
- o Replace users of "int fd" with "evutil_socket_t fd" in portable code (c7cf6f0)
-
-
-
-Changes in 2.0.4-alpha (28 Feb 2010):
- [Autogenerated from the Git log, sorted by hand.]
-DOCUMENTATION
- o Add stub header for 2.0.4-alpha changelog. (94d0065)
- o Improve the README with more information and links. (0b42726)
- o Add more people who wrote patches to the acknowledgments (0af10d5)
- o Add a warning about the use of event_initialized. (f32b575)
- o Add a LICENSE file so people can find our license easily (7067006)
- o Add a new "hello world" sample program (becb9f9)
- o Clarify status of example programs (d60a1bd)
- o Update time-test.c to use event2 (f4190bf)
- o Add the arc4random.c license to the LICENSE file. (e15e1e9)
-
-NEW FEATURES AND INTERFACE CHANGES
- o Improved optional lock debugging. (0cd3bb9)
- o Rate-limiting for bufferevents; group and individual limits are supported. (737c9cd)
- o Testing code for bufferevent rate-limiting. (f0c0124)
- o Make the initial nameserver probe timeout configurable. (1e56a32)
- o Revise the locking API: deprecate the old locking callbacks and add trylock. (347952f)
- o Do not make bufferevent_setfd implicitly disable EV_READ and EV_WRITE. (8274379)
- o Do not ignore bufferevent_enable(EV_READ) before bufferevent_connect(). (4a5b534)
- o Introduced evutil_make_socket_closeonexec() to preserve fd flags for F_SETFD. (d0939d2 Jardel Weyrich)
- o evdns_getaddrinfo() now supports the /etc/hosts file. (72dd666)
- o Look at the proper /etc/hosts file on windows. (66c02c7)
- o Allow http connections to use evdns for hostname looksups. (c698b77)
- o Changelist code to defer event changes until just before dispatch (27308aa)
- o do not use a function to assign the evdns base; instead assign it via evhttp_connection_base_new() which is a new function introduced in 2.0 (5032e52)
- o Functions to access more fields of struct event. (0683950)
- o Make kqueue use changelists. (45e5ae3)
- o Remove kqueue->pend_changes. (3225dfb)
- o Minimize epoll_ctl calls by using changelist (c8c6a89)
- o Add support for a "debug mode" to try to catch common errors. (cd17c3a)
- o Note a missing ratelim function (361da8f)
- o Add ev_[u]intptr_t to include/event2/util.h (1fa4c81)
- o const-ify a few more functions in event.h (d38a7a1)
- o Deprecate EVENT_FD and EVENT_SIGNAL. (f6b2694)
- o Remove EVUTIL_CHECK_FMT. (6c21c89)
- o Add EV_*_MAX macros to event2/util.h to expose limits for ev_* types. (aba1fff) o Functions to view and manipulate rate-limiting buckets. (85047a6)
- o Add the rest of the integer limits, and add a test for them. (60742d5)
- o Remove the 'flags' argument from evdns_base_set_option() (1dd7e6d)
- o Add an arc4random implementation for use by evdns (d4de062)
- o Use off_t for the length parameter of evbuffer_add_file (3fe60fd)
- o Construct Windows locks using InitializeCriticalSectionAndSpinCount (32c6f1b)
- o Expose view of current rate limit as constrained by group limit (162ce8a)
- o Provide consistent, tested semantics for bufferevent timeouts (d328829)
-
-BUGFIXES AND TESTS
- o Tolerate code that returns from a fatal_cb. (91fe23f)
- o Parenthesize macro arguments more aggressively (07e9e9b)
- o Fix memory-leak of signal handler array with kqueue. (e1ffbb8)
- o Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks. (76cd2b7)
- o Fix two use-after-free bugs in unit tests spoted by lock debugging (d84d838)
- o Fix a locking bug in event_base_loop() (da1718b)
- o Fix an evdns lock violation. (2df1f82 Zhuang Yuyao)
- o Valgrind fix: Clear struct kevent before checking for OSX bug. (56771a3 William Ahern)
- o Fix up evthread compilation on windows (bd6f1ba Roman Puls)
- o Fix regress_iocp.c usage of old lock allocation macros. (31687b4 unknown)
- o Update nmake makefile to build evthread.c (b62d979 unknown)
- o Fix a crash when reading badly formatted resolve.conf; from Yasuoka Masahiko (6c7c579 Yasuoka Masahiko)
- o Fix a snow leopard compile warning in the unit tests. (7ae9445)
- o Fix compile on Snow Leopard with gcc warnings enabled (70cdfe4 Sebastian Hahn)
- o Only define _GNU_SOURCE if it is not already defined. (ea6b1df Joachim Bauch)
- o Update sample/signal-test.c to use newer APIs and not leak. (f6430ac Evan Jones)
- o Fix a segfault when writing a very fragmented evbuffer onto an SSL (a6adeca Joachim Bauch)
- o Fix a segfault when freeing SSL bufferevents in an unusual order (a773df5 Joachim Bauch)
- o Drop install-sh from our git repo: a mismatched version could break "make dist" (6799527)
- o Set all instances of the version number correctly. (5a112d3)
- o Fix a few locking issues on windows. (c51bb3c unknown)
- o Use evutil_socket_t, not int, when logging socket errors. (292467c)
- o Fix up behavior of never-defered callbacks a little (390e056)
- o Replace some cases of uint32_t with ev_uint32_t. (a47d88d)
- o Fix compilation of devpoll.c by adding missing thread includes. (fee2c77 Dagobert Michelsen)
- o Make evutil_make_socket_nonblocking() leave any other flags alone. (4c8b7cd Jardel Weyrich)
- o Fix an fd leak in evconnlistener_new_bind(). (24fb502 Jardel Weyrich)
- o Fix a bogus free in evutil_new_addrinfo() (0d64051 Jardel Weyrich)
- o Adjusted fcntl() retval comparison on evutil_make_socket_nonblocking(). (4df7dbc Jardel Weyrich)
- o Fix the code that allowed DNS options to not end with : (ee4953f)
- o Fix crash bugs when a bufferevent's eventcb is not set. (2e8eeea)
- o Fix test-ratelim compilation on Linux. (885b427)
- o Fix compilation of rate-limiting code on win32. (165d30e)
- o Eradicated the last free() call. Let mm_free() take care of deallocation. (0546ce1 Jardel Weyrich)
- o Fix byte counts when mixing deferred and non-deferred evbuffer callbacks. (29151e6)
- o Fixed a memory leak on windows threads implementation. The CRITICAL_SECTION was not being free'd in evthread_win32_lock_free(). (2f33e00 Jardel Weyrich)
- o Fixed a fd leak in start_accepting(), plus cosmetic changes (4367a33 Jardel Weyrich)
- o Improved error handling in evconnlistener_new_async(). Also keeping the fd open because it is not opened by this function, so the caller is responsible for closing it. Additionally, since evconnlistener_new_bind() creates a socket and passes it to the function above, it required error checking to close the same socket. (fec66f9 Jardel Weyrich)
- o Don't use a bind address for nameservers on loopback (8d4aaf9)
- o Fix compilation of rate-limit code when threading support is disabled (97a8c79)
- o Detect setenv/unsetenv; skip main/base_environ test if we can't fake them. (7296971)
- o Check more internal event_add() calls for failure (ff3f6cd)
- o Fix windows and msvc build (5c7a7bc)
- o Call event_debug_unassign on internal events (a19b4a0)
- o Try to fix a warning in hash_debug_entry (137f2c6)
- o Fix a dumb typo in ev_intptr_t definitions. (27c9a40)
- o do not fail while sending on http connections the client closed. (93d7369)
- o make evhttp_send() safe against terminated connections, too (3978180)
- o Make Libevent 1.4.12 build on win32 with Unicode enabled. (000a33e Brodie Thiesfield)
- o Fix some additional -DUNICODE issues on win32. (a7a9431)
- o Add a check to make soure our EVUTIL_AI flags do not conflict with the native ones (c18490e)
- o Always use our own gai_strerror() replacement. (6810bdb)
- o Make RNG work when we have arc4random() but not arc4random_buf() (4ec8fea)
- o validate close cb on server when client connection closes (2f782af)
- o Fix two unlocked reads in evbuffer. (7116bf2)
- o When working without a current event base, don't try to use IOCP listeners (cb52838)
- o Fix getpid() usage on Windows (ff2a134)
- o Add a unit test for secure rng. (48a29b6)
- o Add some headers to fix freebsd compilation (b72be50)
- o When connect() succeeds immediately, don't invoke the callback immediately. (7515de9)
- o Suspend read/write on bufferevents during hostname lookup (db08f64)
- o Make bufferevent_free() clear all callbacks immediately. (b2fbeb3)
- o Fix some race conditions in persistent events and event_reinit (e2642f0)
- o Fix a bug in resetting timeouts on persistent events when IO triggers. (38ec0a7)
- o Add a test for timeouts on filtering bufferevents. (c02bfe1)
- o Add test for periodic timers that get activated for other reasons (8fcb7a1)
- o Use new timeval diff comparison function in bufferevent test (f3dfe46)
- o Delete stack-alloced event in new unit test before returning. (7ffd387)
- o Fix mingw compilation (23170a6)
- o Try to define a sane _EVENT_SIZEOF_SIZE_T for msvc compilation (1e14f82)
- o Fix arc4random compilation on MSVC. (98edb89)
- o deal with connect() failing immediately (7bc48bf)
- o Small cleanups on freebsd-connect-refused patch. (57b7248)
-
-BUILD AND DISTRIBUTION CHANGES
- o Remove the contents of WIN32-Prj as unmaintained. (c69d5a5)
- o Allow the user to redirect the verbose output of test/test.sh to a file (c382de6)
- o Allow test.sh to be run as ./test/test.sh (7dfbe94)
- o Never believe that we have pthreads on win32, even if gcc thinks we do. (78ed097)
- o Make it compile under gcc --std=c89. (e2ca403)
- o Fix a number of warnings from gcc -pedantic (918e9c5)
- o Add the msvc-generated .lib files to .gitignore. (e244a2e)
- o Add the "compile" script to gitignore. (1ba6bed)
-
-INTERNALS AND CODE CLEANUPS
- o Add a .gitignore file. (ba34071)
- o New EVTHREAD_TRY_LOCK function to try to grab a lock. (689fc09)
- o Add the abilitity to mark some buffer callbacks as never-deferred. (438f9ed)
- o Refactor our 'suspend operation' logic on bufferevents. (0d744aa)
- o Simplify the read high-watermark checking. (5846bf6)
- o Improve readability of evutil_unparse_protoname() (5a43df8 Jardel Weyrich)
- o Expose our cached gettimeofday value with a new interface (47854a8)
- o Whitespace fixes in test.sh (0b151a9)
- o Enable branch-prediction hints with EVUTIL_UNLIKELY. (eaaf27f)
- o Refactor code from evdns into a new internal "read a file" function. (0f7144f)
- o Comestic changes in evconnlistener_new(), new_accepting_socket(), accepted_socket_invoke_user_cb() and iocp_listener_enable(). (510ab6b Jardel Weyrich)
- o Add unit-test for bad_request bug fixed in 1.4 recently. (6cc79c6 Pavel Plesov) o Add a comment on evthread_enable_lock_debuging. (b9f43b2)
- o Fix test.sh on shells without echo -n (94131e9)
- o More unit tests for getaddrinfo_async: v4timeout and cancel. (a334b31)
- o Make http use evconnlistener. (ec34533)
- o move dns utility functions into a separate file so that we can use them for http testing (b822639)
- o add a test for evhttp_connection_base_new with a dns_base (26714ca)
- o forgot to add void to test function (78a50fe)
- o Add a forgotten header (changelist-internal.h) (4b9f307)
- o Remove some commented-out code in evutil (26e1b6f)
- o Remove a needless include of rpc_compat.h (70a4a3e)
- o Use less memory for each entry in a hashtable (a66e947)
- o Try to untangle the logic in server_port_flush(). (439aea0)
- o Use ev_[u]intptr_t types in place of [u]intptr_t (cef61a2)
- o Reduce windows header includes in our own headers. (da6135e)
- o clean up terminate_chunked test (e8a9782)
- o Increment the submicro version number. (63e868e)
- o Update event-config.h version number to match configure.in (aae7db5)
- o Clean up formatting: Disallow space-before-tab. (8fdf09c)
- o Clean up formatting: use tabs, not 8-spaces, to indent. (e5bbd40)
- o Clean up formatting: remove trailing spaces (e5cf987)
- o Clean up formatting: function/keyword spacing consistency. (4faeaea)
-
-
-
-Changes in 2.0.3-alpha (20 Nov 2009):
- o Add a new code to support SSL/TLS on bufferevents, using the OpenSSL library (where available).
- o Fix a bug where we didn't allocate enough memory in event_get_supported_methods().
- o Avoid segfault during failed allocation of locked evdns_base. (Found by Rocco Carbone.)
- o Export new evutil_ascii_* functions to perform locale-independent character type operations.
- o Try to compile better with MSVC: patches from Brodie Thiesfield
- o New evconnlistener_get_fd function to expose a listener's associated socket.
- o Expose an ev_socklen_t type for consistent use across platforms.
- o Make bufferevent_socket_connect() work when the original fd was -1.
- o Fix a bug in bufferevent_socket_connect() when the connection succeeds too quickly.
- o Export an evutil_sockaddr_cmp() to compare to sockaddr objects for equality.
- o Add a bufferevent_get_enabled() to tell what a bufferevent has been configured to do.
- o Add an evbuffer_search_eol() function to locate the end of a line nondestructively.
- o Add an evbuffer_search_range() function to search a bounded range of a buffer.
- o Fix a rare crash bug in evdns.
- o Have bufferevent_socket_connect() with no arguments put a bufferevent into connecting mode.
- o Support sendfile on Solaris: patch from Caitlin Mercer.
- o New functions to explicitly reference a socket used by an evhttp object. Patches from David Reiss.
- o When we send a BEV_EVENT_CONNECTED to indicate connected status, we no longer invoke the write callback as well unless we actually wrote data too.
- o If the kernel tells us that there are a negative number of bytes to read from a socket, do not believe it. Fixes bug 2841177; found by Alexander Pronchenkov.
- o Do not detect whether we have monotonic clock support every time a new event base is created: instead do it only once. Patch taken from Chromium.
- o Do not allocate the maximum event queue for the epoll backend at startup. Instead, start out accepting 32 events at a time, and double the queue's size when it seems that the OS is generating events faster than we're requesting them. Saves up to 374K per epoll-based event_base. Resolves bug 2839240.
- o Treat an event with a negative fd as valid but untriggerable by Libevent. This is useful for applications that want to manually activate events.
- o Fix compilation on Android, which forgot to define fd_mask in its sys/select.h
- o Do not drop data from evbuffer when out of memory; reported by Jacek Masiulaniec
- o New event_base_got_exit() and event_base_got_break() functions to tell whether an event loop exited because of an event_base_loopexit() or an event_base_loopbreak(). Patch from Ka-Hing Cheung.
- o When adding or deleting an event from a non-main thread, only wake up the main thread when its behavior actually needs to change.
- o Fix some bugs when using the old evdns interfaces to initialize the evdns module.
- o Detect errors during bufferevent_connect(). Patch from Christopher Davis.
- o Fix compilation for listener.h for C++ - missing extern "C". Patch from Ferenc Szalai.
- o Make the event_base_loop() family of functions respect thread-safety better. This should clear up a few hard-to-debug race conditions.
- o Fix a bug when using a specialized memory allocator on win32.
- o Have the win32 select() backend label TCP-socket-connected events as EV_WRITE, not EV_READ. This should bring it in line with the other backends, and improve portability. Patch from Christopher Davis.
- o Stop using enums as arguments or return values when what we mean is a bitfield of enum values. C++ doesn't believe that you can OR two enum values together and get another enum, and C++ takes its typing seriously. Patch from Christopher Davis.
- o Add an API to replace all fatal calls to exit() with a user-provided panic function.
- o Replace all assert() calls with a variant that is aware of the user-provided logging and panic functions.
- o Add a return value to event_assign so that it can fail rather than asserting when the user gives it bad input. event_set still dies on bad input.
- o The event_base_new() and event_base_new_with_config() functions now never call exit() on failure. For backward "compatibility", event_init() still does, but more consistently.
- o Remove compat/sys/_time.h. It interfered with system headers on HPUX, and its functionality has been subsumed by event2/util.h and util-internal.h.
- o Add a new bufferevent_socket_connect_hostname() to encapsulate the resolve-then-connect operation.
- o Build kqueue.c correctly on GNU/kFreeBSD platforms. Patch pulled upstream from Debian.
- o Alternative queue-based timeout algorithm for programs that use a large number of timeouts with the same value.
- o New event_base_config option to disable the timeval cache entirely.
- o Make EV_PERSIST timeouts more accurate: schedule the next event based on the scheduled time of the previous event, not based on the current time.
- o Allow http.c to handle cases where getaddrinfo returns an IPv6 address. Patch from Ryan Phillips.
- o Fix a problem with excessive memory allocation when using multiple event priorities.
- o Default to using arc4random for DNS transaction IDs on systems that have it; from OpenBSD.
- o Never check the environment when we're running setuid or setgid; from OpenBSD.
- o Options passed to evdns_set_option() no longer need to end with a colon.
- o Add an evutil_getaddrinfo() function to clone getaddrinfo on platforms that don't have it.
- o Add an evdns_getaddrinfo() function to provide a nonblocking getaddrinfo using evdns, so programs can perform useful hostname lookup.
- o Finally expose the IOCP-based bufferevent backend. It passes its unit tests, but probably still has some bugs remaining. Code by Nick Mathewson and Christopher Davis.
- o Numerous other bugfixes.
- o On FreeBSD and other OSes, connect can return ECONREFUSED immediately; instead of failing the function call, pretend with faileld in the callback.
- o Fix a race condition in the pthreads test case; found by Nick Mathewson
- o Remove most calls to event_err() in http and deal with memory errors instead
-
-
-
-Changes in 2.0.2-alpha (25 Jul 2009):
- o Add a new flag to bufferevents to make all callbacks automatically deferred.
- o Make evdns functionality locked, and automatically defer dns callbacks.
- o Fix a possible free(NULL) when freeing an event_base with no signals.
- o Add a flag to disable checking environment varibles when making an event_base
- o Disallow setting less than 1 priority.
- o Fix a bug when removing a timeout from the heap. [Patch from Marko Kreen]
- o Use signal.h, not sys/signal.h. [Patch from mmadia]
- o Try harder to build with certain older c99 compilers.
- o Make sure that an event_config's flags field is always initialized to 0. [Bug report from Victor Goya]
- o Avoid data corruption when reading data entirely into the second-to-last chain of an evbuffer. [Bug report from Victor Goya]
- o Make sendfile work on FreeBSD
- o Do not use vararg macros for accessing evrpc structures; this is not backwards compatible, but we did not promise any backwards compatibility for the rpc code.
- o Actually define the event_config_set_flag() function.
- o Try harder to compile with Visual C++.
- o Move event_set() and its allies to event2/event_compat.h where they belong.
- o Remove the event_gotsig code, which has long been deprecated and unused.
- o Add an event_get_base() function to return the base assigned to an event.
- o New function to automate connecting on a socket-based bufferevent.
- o New functions to automate listening for incoming TCP connections.
- o Do case-insensitive checks with a locale-independent comparison function.
- o Rename the evbuffercb and everrorcb callbacks to bufferevent_data_cb and bufferevent_event_cb respectively. The old names are available in bufferevent_compat.h.
- o Rename the EVBUFFER_* codes used by bufferevent event callbacks to BEV_EVENT_*, to avoid namespace collision with evbuffer flags. The old names are available in bufferevent_compat.h.
- o Move the EVBUFFER_INPUT and EVBUFFER_OUTPUT macros to bufferevent_compat.h
- o Add a bufferevent_getfd() function to mirror bufferevent_setfd()
- o Make bufferevent_setfd() return an error code if the operation is not successful.
- o Shave 22 bytes off struct event on 32-bit platforms by shrinking and re-ordering fields. The savings on 64-bit platforms is likely higher.
- o Cap the maximum number of priorities at 256.
- o Change the semantics of evbuffer_cb_set_flags() to be set-flag only; add a new evbuffer_cb_clear_flags() to remove set flags.
- o Change the interface of evbuffer_add_reference so that the cleanup callback gets more information
- o Revise the new evbuffer_reserve_space/evbuffer_commit_space() interfaces so that you can use them without causing extraneous copies or leaving gaps in the evbuffer.
- o Add a new evbuffer_peek() interface to inspect data in an evbuffer without removing it.
- o Fix a deadlock when suspending reads in a bufferevent due to a full buffer. (Spotted by Joachim Bauch.)
- o Fix a memory error when freeing a thread-enabled event base with registered events. (Spotted by Joachim Bauch.)
- o Try to contain degree of failure when running on a win32 version so heavily firewalled that we can't fake a socketpair.
- o Activate fd events in a pseudorandom order with O(N) backends, so that we don't systematically favor low fds (select) or earlier-added fds (poll, win32).
- o Replace some read()/write() instances with send()/recv() to work properly on win32.
- o Set truncated flag correctly in evdns server replies.
- o Raise RpcGenError in event_rpcgen.py; from jmanison and Zack Weinberg
- o Fix preamble of rpcgen-generated files to rely on event2 includes; based on work by jmansion; patch from Zack Weinberg.
- o Allow specifying the output filename for rpcgen; based on work by jmansion; patch from Zack Weinberg.
- o Allow C identifiers as struct names; allow multiple comments in .rpc files; from Zack Weinberg
- o Mitigate a race condition when using socket bufferevents in multiple threads.
- o Use AC_SEARCH_LIBS, not AC_CHECK_LIB to avoid needless library use.
- o Do not allow event_del(ev) to return while that event's callback is executing in another thread. This fixes a nasty race condition.
- o event_get_supported_methods() now lists methods that have been disabled with the EVENT_NO* environment options.
- o Rename encode_int[64] to evtag_encode_int[64] to avoid polluting the global namespace. The old method names are still available as macros in event2/tag_compat.h.
-
-
-
-Changes in 2.0.1-alpha (17 Apr 2009):
- o free minheap on event_base_free(); from Christopher Layne
- o debug cleanups in signal.c; from Christopher Layne
- o provide event_base_new() that does not set the current_base global
- o bufferevent_write now uses a const source argument; report from Charles Kerr
- o improve documentation on event_base_loopexit; patch from Scott Lamb
- o New function, event_{base_}loopbreak. Like event_loopexit, it makes an event loop stop executing and return. Unlike event_loopexit, it keeps subsequent pending events from getting executed. Patch from Scott Lamb
- o Check return value of event_add in signal.c
- o provide event_reinit() to reintialize an event_base after fork
- o New function event_set_mem_functinons. It allows the user to give libevent replacement functions to use for memory management in place of malloc(), free(), etc. This should be generally useful for memory instrumentation, specialized allocators, and so on.
- o The kqueue implementation now catches signals that are raised after event_add() is called but before the event_loop() call. This makes it match the other implementations.
- o The kqueue implementation now restores original signal handlers correctly when its signal events are removed.
- o Check return value of event_add in signal.c
- o Add a more powerful evbuffer_readln as a replacement for evbuffer_readline. The new function handles more newline styles, and is more useful with buffers that may contain a nul characters.
- o Do not mangle socket handles on 64-bit windows.
- o The configure script now takes an --enable-gcc-warnings option that turns on many optional gcc warnings. (Nick has been building with these for a while, but they might be useful to other developers.)
- o move EV_PERSIST handling out of the event backends
- o small improvements to evhttp documentation
- o always generate Date and Content-Length headers for HTTP/1.1 replies
- o set the correct event base for HTTP close events
- o When building with GCC, use the "format" attribute to verify type correctness of calls to printf-like functions.
- o Rewrite win32.c backend to be O(n lg n) rather than O(n^2).
- o Removed obsoleted recalc code
- o support for 32-bit tag numbers in rpc structures; this is wire compatible, but changes the API slightly.
- o pull setters/getters out of RPC structures into a base class to which we just need to store a pointer; this reduces the memory footprint of these structures.
- o prefix {encode,decode}_tag functions with evtag to avoid collisions
- o fix a bug with event_rpcgen for integers
- o Correctly handle DNS replies with no answers set (Fixes bug 1846282)
- o add -Wstrict-aliasing to warnings and more cleanup
- o removed linger from http server socket; reported by Ilya Martynov
- o event_rpcgen now allows creating integer arrays
- o support string arrays in event_rpcgen
- o change evrpc hooking to allow pausing of RPCs; this will make it possible for the hook to do some meaning ful work; this is not backwards compatible.
- o allow an http request callback to take ownership of a request structure
- o allow association of meta data with RPC requests for hook processing
- o associate more context for hooks to query such as the connection object
- o remove pending timeouts on event_base_free()
- o also check EAGAIN for Solaris' event ports; from W.C.A. Wijngaards
- o devpoll and evport need reinit; tested by W.C.A Wijngaards
- o event_base_get_method; from Springande Ulv
- o Send CRLF after each chunk in HTTP output, for compliance with RFC2626. Patch from "propanbutan". Fixes bug 1894184.
- o Add a int64_t parsing function, with unit tests, so we can apply Scott Lamb's fix to allow large HTTP values.
- o Use a 64-bit field to hold HTTP content-lengths. Patch from Scott Lamb.
- o Allow regression code to build even without Python installed
- o remove NDEBUG ifdefs from evdns.c
- o detect integer types properly on platforms without stdint.h
- o udpate documentation of event_loop and event_base_loop; from Tani Hosokawa.
- o simplify evbuffer by removing orig_buffer
- o do not insert event into list when evsel->add fails
- o add support for PUT/DELETE requests; from Josh Rotenberg
- o introduce evhttp_accept_socket() to accept from an already created socket
- o include Content-Length in reply for HTTP/1.0 requests with keep-alive
- o increase listen queue for http sockets to 128; if that is not enough the evhttp_accpet_socket() api can be used with a prepared socket.
- o Patch from Tani Hosokawa: make some functions in http.c threadsafe.
- o test support for PUT/DELETE requests; from Josh Rotenberg
- o rewrite of the evbuffer code to reduce memory copies
- o Some older Solaris versions demand that _REENTRANT be defined to get strtok_r(); do so.
- o Do not free the kqop file descriptor in other processes, also allow it to be 0; from Andrei Nigmatulin
- o Provide OpenSSL style support for multiple threads accessing the same event_base
- o make event_rpcgen.py generate code include event-config.h; reported by Sam Banks.
- o switch thread support so that locks get allocated as they are needed.
- o make event methods static so that they are not exported; from Andrei Nigmatulin
- o make RPC replies use application/octet-stream as mime type
- o do not delete uninitialized timeout event in evdns
- o Correct the documentation on buffer printf functions.
- o Don't warn on unimplemented epoll_create(): this isn't a problem, just a reason to fall back to poll or select.
- o Correctly handle timeouts larger than 35 minutes on Linux with epoll.c. This is probably a kernel defect, but we'll have to support old kernels anyway even if it gets fixed.
- o Make name_from_addr() threadsafe in http.c
- o Add new thread-safe interfaces to evdns functions.
- o Make all event_tagging interfaces threadsafe.
- o Rename internal memory management functions.
- o New functions (event_assign, event_new, event_free) for use by apps that want to be safely threadsafe, or want to remain ignorant of the contents of struct event.
- o introduce bufferevent_read_buffer; allows reading without memory copy.
- o expose bufferevent_setwatermark via header files and fix high watermark on read
- o fix a bug in buffrevent read water marks and add a test for them
- o fix a bug in which bufferevent_write_buffer would not schedule a write event
- o provide bufferevent_input and bufferevent_output without requiring knowledge of the structure
- o introduce bufferevent_setcb and bufferevent_setfd to allow better manipulation of bufferevents
- o convert evhttp_connection to use bufferevents.
- o use libevent's internal timercmp on all platforms, to avoid bugs on old platforms where timercmp(a,b,<=) is buggy.
- o Remove the never-exported, never-used evhttp_hostportfile function.
- o Support input/output filters for bufferevents; somewhat similar to libio's model. This will allow us to implement SSL, compression, etc, transparently to users of bufferevents such as the http layer.
- o allow connections to be removed from an rpc pool
- o add new evtimer_assign, signal_assign, evtimer_new, and signal_new functions to manipulate timer and signal events, analagous to the now-recommended event_assign and event_new
- o switch internal uses of event_set over to use event_assign.
- o introduce evbuffer_contiguous_space() api that tells a user how much data is available in the first buffer chain
- o introduce evbuffer_reserve_space() and evbuffer_commit_space() to make processing in filters more efficient.
- o reduce system calls for getting current time by caching it.
- o separate signal events from io events; making the code less complex.
- o support for periodic timeouts
- o support for virtual HTTP hosts.
- o turn event_initialized() into a function, and add function equivalents to EVENT_SIGNAL and EVENT_FD so that people don't need to include event_struct.h
- o Build test directory correctly with CPPFLAGS set.
- o Provide an API for retrieving the supported event mechanisms.
- o event_base_new_with_config() and corresponding config APIs.
- o migrate the evhttp header to event2/ but accessors are still missing.
- o deprecate timeout_* event functions by moving them to event_compat.h
- o Move windows gettimeofday replacement into a new evutil_gettimeofday().
- o Make configure script work on IRIX.
- o provide a method for canceling ongoing http requests.
- o Make vsnprintf() returns consistent on win32.
- o Fix connection keep-alive behavior for HTTP/1.0
- o Fix use of freed memory in event_reinit; pointed out by Peter Postma
- o constify struct timeval * where possible
- o make event_get_supported_methods obey environment variables
- o support for edge-triggered events on epoll and kqueue backends: patch from Valery Kholodkov
- o support for selecting event backends by their features, and for querying the features of a backend.
- o change failing behavior of event_base_new_with_config: if a config is provided and no backend is selected, return NULL instead of aborting.
- o deliver partial data to request callbacks when chunked callback is set even if there is no chunking on the http level; allows cancelation of requests from within the chunked callback; from Scott Lamb.
- o allow min_heap_erase to be called on removed members; from liusifan.
- o Rename INPUT and OUTPUT to EVRPC_INPUT and EVRPC_OUTPUT. Retain INPUT/OUTPUT aliases on on-win32 platforms for backwards compatibility.
- o Do not use SO_REUSEADDR when connecting
- o Support 64-bit integers in RPC structs
- o Correct handling of trailing headers in chunked replies; from Scott Lamb.
- o Support multi-line HTTP headers; based on a patch from Moshe Litvin
- o Reject negative Content-Length headers; anonymous bug report
- o Detect CLOCK_MONOTONIC at runtime for evdns; anonymous bug report
- o Various HTTP correctness fixes from Scott Lamb
- o Fix a bug where deleting signals with the kqueue backend would cause subsequent adds to fail
- o Support multiple events listening on the same signal; make signals regular events that go on the same event queue; problem report by Alexander Drozdov.
- o Fix a problem with epoll() and reinit; problem report by Alexander Drozdov.
- o Fix off-by-one errors in devpoll; from Ian Bell
- o Make event_add not change any state if it fails; reported by Ian Bell.
- o Fix a bug where headers arriving in multiple packets were not parsed; fix from Jiang Hong; test by me.
- o Match the query in DNS replies to the query in the request; from Vsevolod Stakhov.
- o Add new utility functions to correctly observe and log winsock errors.
- o Do not remove Accept-Encoding header
- o Clear the timer cache on entering the event loop; reported by Victor Chang
- o Only bind the socket on connect when a local address has been provided; reported by Alejo Sanchez
- o Allow setting of local port for evhttp connections to support millions of connections from a single system; from Richard Jones.
- o Clear the timer cache when leaving the event loop; reported by Robin Haberkorn
- o Fix a typo in setting the global event base; reported by lance.
- o Set the 0x20 bit on outgoing alphabetic characters in DNS requests randomly, and insist on a match in replies. This helps resist DNS poisoning attacks.
- o Make the http connection close detection work properly with bufferevents and fix a potential memory leak associated with it.
- o Restructure the event backends so that they do not need to keep track of events themselves, as a side effect multiple events can use the same fd or signal.
- o Add generic implementations for parsing and emiting IPv6 addresses on platforms that do not have inet_ntop and/or inet_pton.
- o Allow DNS servers that have IPv6 addresses.
- o Add an evbuffer_write_atmost() function to write a limited number of bytes to an fd.
- o Refactor internal notify-main-thread logic to prefer eventfd to pipe, then pipe to socketpair, and only use socketpairs as a last resort.
- o Try harder to pack all evbuffer reads into as few chains as possible, using readv/WSARecv as appropriate.
- o New evthread_use_windows_threads() and evthread_use_pthreads() functions to set up the evthread callbacks with reasonable defaults.
- o Change the semantics of timeouts in conjunction with EV_PERSIST; timeouts in that case will now repeat until deleted.
- o sendfile, mmap and memory reference support for evbuffers.
- o New evutil_make_listen_socket_reuseable() to abstract SO_REUSEADDR.
- o New bind-to option to allow DNS clients to bind to an arbitrary port for outgoing requests.
- o evbuffers can now be "frozen" to prevent operations at one or both ends.
- o Bufferevents now notice external attempts to add data to an inbuf or remove it from an outbuf, and stop them.
- o Fix parsing of queries where the encoded queries contained \r, \n or +
- o Do not allow internal events to starve lower-priority events.
-
+Changes in version 2.0.21-stable (18 Nov 2012)
+BUGFIXES:
+ o ssl: Don't discard SSL read event when timeout and read come close together (576b29f)
+ o ssl: Stop looping in "consider_reading" if reading is suspended. (f719b8a Joachim Bauch)
+ o ssl: No need to reserve space if reading is suspended. (1acf2eb Joachim Bauch)
+ o dns: Avoid a memory-leak on OOM in evdns. (73e85dd, f2bff75 George Danchev)
+ o build: Use python2 rather than python (0eb0109 Ross Lagerwall)
+ o build: Compile without warnings on mingw64 (94866c2)
+ o build: Fix compilation on mingw64 with -DUSE_DEBUG (62bd2c4)
+ o build: Make rpcgen_wrapper.sh work on systems without a "python2" binary (f3009e4)
+ o iocp: Close IOCP listener socket on free when LEV_OPT_CLOSE_ON_FREE is set (cb853ea Juan Pablo Fernandez)
+ o core: Avoid crash when event_pending() called with no event_base set on event (e3cccf3)
+ o misc: remove stray 'x' so print_err will compile when uncommented (ac35650 Patrick Pelletier)
+ o tests: Fix renegotiation test to work around openssl 1.0.1 bug (c2f3086)
+ o tests: Warn when openssl version in unit test mismatches compiled version. (ac009f9)
+
+
+Changes in version 2.0.20-stable (23 Aug 2012)
+BUGFIXES:
+ o core: Make event_pending() threadsafe. (be7a95c Simon Liu)
+ o win32: avoid crash when waiting forever on zero fds. (160e58b)
+ o evhttp: Fix a memory leak on error in evhttp_uriencode (11c8b31)
+ o evbuffer: Avoid possible needless call to writev. Found by coverity. (6a4ec5c)
+ o evdns: memset sockaddr_in before using it. Found by coverity. (a1a0e67)
+ o evhttp: Check more setsockopt return values when binding sockets. Found by coverity (a0912e3)
+ o evdns: Avoid segfault on weird timeout during name lookup. (dc32077 Greg Hazel)
+ o bufferevent_ssl: Correctly invoke callbacks when a SSL bufferevent reads some and then blocks. (606ac43)
+
+
+PORTABILITY FIXES:
+ o check for arc4random_buf at runtime, on OS X (bff5f94 Greg Hazel)
+ o Correctly check for arc4random_buf (fcec3e8 Sebastian Hahn)
+ o Add explicit AC_PROG_SED to configure.in so all autoconfs will expose $(SED) (ca80ea6)
+
+BUILD FIXES:
+ o Add GCC annotations so that the vsprintf functions get checked properly (117e327)
+ o Fix an unused variable warning on *BSD. (c0720c1)
+
+UNIT TEST FIXES:
+ o Fix a couple of memory leaks (found with Valgrind). (3b2529a Ross Lagerwall)
+ o Remove deadcode in http regression tests. Found by coverity. (5553346)
+ o Fix possible uninitialized read in dns regression tests. Found by coverity. (2259777)
+ o Set umask before calling mkstemp in unit tests. Found by coverity (f1ce15d)
+ o Fix various check-after-dereference issues in unit tests: found by coverity (4f3732d)
+ o Fix resource leaks in the unit tests; found by coverity (270f279)
+ o Add some missing null checks to unit tests; found by coverity (f021c3d)
+ o Avoid more crashes/bad calls in unit tests; found by coverity (3cde5bf)
+ o Remove unused variable; spotted by coverity (6355b2a)
+ o Add checks to various return values in unit tests. Found by coverity (b9e7329)
+ o Move assignment outside tt_assert in ssl unit tests. Appeases coverity. (a2006c0)
+
+
+
+Changes in version 2.0.19-stable (3 May 2012)
+BUGFIXES (CORE):
+ o Refactor event_persist_closure: raise and extract some common logic (bec22b4)
+ o If time has jumped so we'd reschedule a periodic event in the past, schedule it for the future instead (dfd808c)
+ o If a higher-priority event becomes active, don't continue running events of the current priority. (2bfda40)
+
+BUGFIXES (SSL):
+ o Fixed potential double-readcb execution with openssl bufferevents. (4e62cd1 Mark Ellzey)
+
+BUGFIXES (DNS):
+ o Cancel a probe request when the server is freed, and ignore cancelled probe callbacks (94d2336 Greg Hazel)
+ o Remove redundant DNS_ERR_CANCEL check, move comment (46b8060 Greg Hazel)
+ o When retransmitting a timed-out DNS request, pick a fresh nameserver. (3d9e52a)
+
+DOCUMENTATION FIXES:
+ o Fix a typo in the bufferevent documentation (98e9119)
+ o Add missing ) to changelog; spotted by rransom (4c7ee6b)
+ o Fix the website URL in the readme (f775521)
+
+COMPILATION FIXES:
+ o Fix a compilation error with MSVC 2005 due to use of mode_t (336dcae)
+ o Configure with gcc older than 2.95 (4a6fd43 Sebastian Hahn)
+ o Generate event-config.h with a single sed script (30b6f88 Zack Weinberg)
+
+FORWARD-COMPATIBILITY:
+ o Backport: provide EVENT_LOG_* names, and deprecate _EVENT_LOG_* (d1a03b2)
+
+TESTING/DEBUGGING SUPPORT:
+ o dns-example.c can now take a resolv.conf file on the commandline (6610fa5)
+ o Make some evdns.c debug logs more verbose (d873d67)
+ o Work-around a stupid gcov-breaking bug in OSX 10.6 (b3887cd)
+
+
+
+Changes in version 2.0.18-stable (22 Mar 2012)
+BUGFIXES (core):
+ o Make uses of open() close-on-exec safe by introducing an internal evutil_open_closeonexec. (d2b5f72 Ross Lagerwall, 03dce42)
+
+BUGFIXES (kqueue):
+ o Properly zero the kevent in kq_setup_kevent() (c2c7b39 Sebastian Hahn)
+
+BUILD FIXES:
+ o Added OPENSSL_LDFLAGS env variable which is appended to SSL checks. (9278196 Mark Ellzey)
+ o Changed OPENSSL_LDFLAGS to OPENSSL_LIBADD (2d67b63 Mark Ellzey)
+ o Don't do clang version detection when disabling some flags (083296b Sebastian Hahn)
+
+BUGFIXES (dns):
+ o Stop crashing in evdns when nameserver probes give a weird error (bec5068)
+
+
+Changes in version 2.0.17-stable (10 Feb 2012)
+
+BUGFIXES (core):
+ o Be absolutely sure to clear pncalls before leaving event_signal_closure (11f36a5)
+ o check for sysctl before we use it (358c745 Mike Frysinger)
+ o Remove bogus casts of socket to int before calling ev_callback (f032516)
+ o Make evconnlistener work around bug in older Linux when getting nmapped (ecfc720)
+ o Fix a list corruption bug when using event_reinit() with signals present (6e41cdc)
+ o Fix a fd leak in event_reinit() (3f18ad1)
+ o Do a memberwise comparison of threading function tables (c94a5f2 Nate R)
+ o Use C-style comments in C source files (for compatibility with compilers such as xlc on AIX). (d84d917 Greg Hewgill)
+ o Avoid crash when freeing event_iocp and using event_set_mem_functions (19715a6)
+ o In the kqueue backend, do not report EBADF as an EV_READ (5d7bfa1 Nicholas Marriott)
+
+BUGFIXES (evbuffer and bufferevents):
+ o Fix behavior of evbuffer_peek(buf,-1,NULL,NULL,0) (c986f23 Zack Weinberg)
+ o Loop on filtering SSL reads until we are blocked or exhausted. (5b4b812)
+
+BUGFIXES (evhttp):
+ o Force strict validation of HTTP version in response. (790f6b3 Catalin Patulea)
+
+BUGFIXES (evdns):
+ o evdns: fix a bug in circular-queue implementation (d6094b1)
+
+BUILD FIXES:
+ o Fix a silly compilation error with the sun compiler (1927776 Colin Watt)
+ o Suppress a gcc warning from ignoring fwrite return in http-sample.c (7206e8c)
+
+DOCUMENTATION FIXES:
+ o Slightly clarify evbuffer_peek documentation (7bbf6ca)
+ o Update copyright notices to 2012 (e49e289)
+
+NEW APIS:
+ o Backport evhttp_connection_get_bufferevent to Libevent 2.0 (da70fa7 Arno Bakker)
+
+TESTS AND TEST FIXES:
+ o Fix a race condition in the dns/bufferevent_connect_hostname test. (cba48c7)
+ o Add function to check referential integrity of an event_base (27737d5)
+ o Check event_base correctness at end of each unit test (3312b02)
+ o Workaround in the unit tests for an apparent epoll bug in Linux 3.2 (dab9187)
+ o Better workaround for Linux 3.2 edge-triggered epoll bug (9f9e259)
+
+Changes in version 2.0.16-stable (18 Nov 2011)
+BUGFIXES (core):
+ o More detailed message in case of libevent self-debugging failure. (9e6a4ef Leonid Evdokimov)
+ o epoll: close fd on alloc fail at initialization (1aee718 Jamie Iles)
+ o Fix compile warning from saying event2/*.h inside a comment (447b0ba)
+ o Warn when unable to construct base because of failing make_base_notifiable (4e797f3)
+ o Don't try to make notifiable event_base when no threading fns are configured (e787413)
+
+BUGFIXES (evbuffer):
+ o unit test for remove_buffer bug (90bd620 Greg Hazel)
+ o Fix an evbuffer crash in evbuffer_remove_buffer() (c37069c)
+
+BUGFIXES (bufferevent_openssl):
+ o Refactor amount-to-read calculations in buffervent_ssl consider_reading() (a186e73 Mark Ellzey)
+ o Move SSL rate-limit enforcement into bytes_to_read() (96c562f)
+ o Avoid spinning on OpenSSL reads (2aa036f Mark Ellzey)
+
+BUGFIXES (dns)
+ o Empty DNS reply with OK status is another way to say NODATA. (21a08d6 Leonid Evdokimov)
+
+TESTING:
+ o Tests for 94fba5b and f72e8f6 (d58c15e Leonid Evdokimov)
+ o Test for commit aff6ba1 (f7841bf Leonid Evdokimov)
+ o Style and comment tweaks for dns/leak* tests (5e42202)
+ o improve test to remove at least one buffer from src (7eb52eb Greg Hazel)
+
+DOCUMENTATION:
+ o Add note about evhttp_send_reply_end to its doxygen (724bfb5)
+ o Update copyright dates to 2011. (3c824bd)
+ o Fix typo in whatsnew-2.0.txt (674bc6a Mansour Moufid)
+ o Improve win32 behavior of dns-sample.c code (a3f320e Gisle Vanem)
+
+
+
+Changes in version 2.0.15-stable (12 Oct 2011)
+BUGFIXES (DNS):
+ o DNS: add ttl for negative answers using RFC 2308 idea. (f72e8f6 Leonid Evdokimov)
+ o Add DNS_ERR_NODATA error code to handle empty replies. (94fba5b Leonid Evdokimov)
+
+BUFGIXES (bufferevents and evbuffers):
+ o Make evbuffer callbacks get the right n_added value after evbuffer_add (1ef1f68 Alex)
+ o Prefer mmap to sendfile unless a DRAINS_TO_FD flag is set. Allows add_file to work with SSL. (0ba0af9)
+
+BUGFIXES (event loop):
+ o When a signal callback is activated to run multiple times, allow event_base_loopbreak to work even before they all have run. (4e8eb6a)
+
+DOCUMENTATION FIXES:
+ o Fix docstring in dns.h (2b6eae5 Leonid Evdokimov)
+ o refer to non-deprecated evdns functions in comments (ba5c27d Greg Hazel)
+
+BUILD AND TESTING FIXES:
+ o le-proxy and regress depend on openssl directly (9ae061a Sergey Avseyev)
+ o Use _SOURCES, not _sources, in sample/Makefile.am (7f82382)
+ o Fixed compiler warnings for unchecked read/write calls. (c3b62fd Mark Ellzey)
+ o Make write-checking fixes use tt_fail_perror (2b76847)
+ o Fix some "value never used" warnings with gcc 4.6.1 (39c0cf7)
+
+
+
+Changes in version 2.0.14-stable (31 Aug 2011)
+BUGFIXES (bufferevents and evbuffers):
+ o Propagate errors on the underlying bufferevent to the user. (4a34394 Joachim Bauch)
+ o Ignore OpenSSL deprecation warnings on OS X (5d1b255 Sebastian Hahn)
+ o Fix handling of group rate limits under 64 bytes of burst (6d5440e)
+ o Solaris sendfile: correctly detect amount of data sent (643922e Michael Herf)
+ o Make rate limiting work with common_timeout logic (5b18f13)
+ o clear read watermark on underlying bufferevent when creating filtering bev to fix potentially failing fragmented ssl handshakes (54f7e61 Joachim Bauch)
+
+BUGFIXES (IOCP):
+ o IOCP: don't launch reads or writes on an unconnected socket (495c227)
+ o Make IOCP rate-limiting group support stricter and less surprising. (a98da7b)
+ o Have test-ratelim.c support IOCP (0ff2c5a)
+ o Make overlapped reads result in evbuffer callbacks getting invoked (6acfbdd)
+ o Correctly terminate IO on an async bufferevent on bufferevent_free (e6af35d)
+
+BUGFIXES (other):
+ o Fix evsig_dealloc memory leak with debugging turned on. (9b724b2 Leonid Evdokimov)
+ o Fix request_finished memory leak with debugging turned on. (aff6ba1 Leonid Evdokimov)
+
+BUILD AND TESTING FIXES:
+ o Allow OS-neutral builds for platforms where some versions have arc4random_buf (b442302 Mitchell Livingston)
+ o Try to fix 'make distcheck' errors when building out-of-tree (04656ea Dave Hart)
+ o Clean up some problems identified by Coverity. (7c11e51 Harlan Stenn)
+
+
+Changes in version 2.0.13-stable (18 Jul 2011)
+BUGFIXES
+ o Avoid race-condition when initializing global locks (b683cae)
+ o Fix bug in SSL bufferevents backed by a bev with a write high-watermarks (e050703 Joachim Bauch)
+ o Speed up invoke_callbacks on evbuffers when there are no callbacks (f87f568 Mark Ellzey)
+ o Avoid a segfault when all methods are disabled or broken (27ce38b)
+ o Fix incorrect results from evbuffer_search_eol(EOL_LF) (4461f1a)
+ o Add some missing checks for mm_calloc failures (89d5e09)
+ o Replace an assertion for event_base_free(NULL) with a check-and-warn (09fe97d)
+ o Report kqueue ebadf, epipe, and eperm as EV_READ events (1fd34ab)
+ o Check if the `evhttp_new_object' function in `http.c' returns NULL. (446cc7a Mansour Moufid)
+ o Use the correct printf args when formatting size_t (3203f88)
+ o Complain if the caller tries to change threading cbs after setting them (cb6ecee)
+
+DOCUMENTATION FIXES AND IMPROVEMENTS
+ o Revise the event/evbuffer/bufferevent doxygen for clarity and accuracy (2888fac)
+ o Update Doxyfile to produce more useful output (aea0555)
+
+TEST FIXES
+ o Fix up test_evutil_snprintf (caf695a)
+ o Fix tinytest invocation from windows shell (57def34 Ed Day)
+
+BUILD FIXES
+ o Use AM_CPPFLAGS in sample/Makefile.am, not AM_CFLAGS (4a5c82d)
+ o Fix select.c compilation on systems with no NFDBITS (49d1136)
+ o Fix a few warnings on OpenBSD (8ee9f9c Nicholas Marriott)
+ o Don't break when building tests from git without python installed (b031adf)
+ o Don't install event_rpcgen.py when --disable-libevent-install is used (e23cda3 Harlan Stenn)
+ o Fix AIX build issue with TAILQ_FOREACH definition (e934096)
+
+
+Changes in version 2.0.12-stable (4 Jun 2011)
+BUGFIXES
+ o Fix a warn-and-fail bug in kqueue by providing kevent() room to report errors (28317a0)
+ o Fix an assert-inducing fencepost bug in the select backend (d90149d)
+ o Fix failing http assertion introducd in commit 0d6622e (0848814 Kevin Ko)
+ o Fix a bug that prevented us from configuring IPv6 nameservers. (74760f1)
+ o Prevent size_t overflow in evhttp_htmlescape. (06c51cd Mansour Moufid)
+ o Added several checks for under/overflow conditions in evhttp_handle_chunked_read (a279272 Mark Ellzey)
+ o Added overflow checks in evhttp_read_body and evhttp_get_body (84560fc Mark Ellzey)
+
+DOCUMENTATION:
+ o Add missing words to EVLOOP_NONBLOCK documentation (9556a7d)
+
+BUILD FIXES
+ o libssl depends on libcrypto, not the other way around. (274dd03 Peter Rosin)
+ o Libtool brings in the dependencies of libevent_openssl.la automatically (7b819f2 Peter Rosin)
+ o Use OPENSSL_LIBS in Makefile.am (292092e Sebastian Hahn)
+ o Move the win32 detection in configure.in (ceb03b9 Sebastian Hahn)
+ o Correctly detect openssl on windows (6619385 Sebastian Hahn)
+ o Fix a compile warning with zlib 1.2.4 and 1.2.5 (5786b91 Sebastian Hahn)
+ o Fix compilation with GCC 2, which had no __builtin_expect (09d39a1 Dave Hart)
+ o Fix new warnings from GCC 4.6 (06a714f)
+ o Link with -lshell32 and -ladvapi32 on Win32. (86090ee Peter Rosin)
+ o Make the tests build when OpenSSL is not available. (07c41be Peter Rosin)
+ o Bring in the compile script from automake, if needed. (f3c7a4c Peter Rosin)
+ o MSVC does not provide S_ISDIR, so provide it manually. (70be7d1 Peter Rosin)
+ o unistd.h and sys/time.h might not exist. (fe93022 Peter Rosin)
+ o Make sure TINYTEST_LOCAL is defined when building tinytest.c (8fa030c Peter Rosin)
+ o Fix winsock2.h #include issues with MSVC (3d768dc Peter Rosin)
+ o Use evutil_gettimeofday instead of relying on the system gettimeofday. (0de87fe Peter Rosin)
+ o Always use evutil_snprintf, even if OS provides it (d1b2d11 Sebastian Hahn)
+ o InitializeCriticalSectionAndSpinCount requires _WIN32_WINNT >= 0x0403. (816115a Peter Rosin)
+ o cygwin: make it possible to build DLLs (d54d3fc)
+
+
+
+Changes in version 2.0.11-stable (27 Apr 2011)
+ [Autogenerated from the Git log, sorted and cleaned by hand.]
+BUGFIXES:
+ o Fix evport handling of POLLHUP and POLLERR (b42ce4b)
+ o Fix compilation on Windows with NDEBUG (cb8059d)
+ o Check for POLLERR, POLLHUP and POLLNVAL for Solaris event ports (0144886 Trond Norbye)
+ o Detect and handle more allocation failures. (666b096 Jardel Weyrich)
+ o Use event_err() only if the failure is truly unrecoverable. (3f8d22a Jardel Weyrich)
+ o Handle resize failures in the select backend better. (83e805a)
+ o Correctly free selectop fields when select_resize fails in select_init (0c0ec0b)
+ o Make --enable-gcc-warnings a no-op if not using gcc (3267703)
+ o Fix a type error in our (unused) arc4random_stir() (f736198)
+ o Correctly detect and stop non-chunked http requests when the body is too long (63a715e)
+ o Have event_base_gettimeofday_cached() always return wall-clock time (a459ef7)
+ o Workaround for http crash bug 3078187 (5dc5662 Tomash Brechko)
+ o Fix incorrect assertions and possible use-after-free in evrpc_free() (4b8f02f Christophe Fillot)
+ o Reset outgoing http connection when read data in idle state. (272823f Tomash Brechko)
+ o Fix subtle recursion in evhttp_connection_cb_cleanup(). (218cf19 Tomash Brechko)
+ o Fix the case when failed evhttp_make_request() leaved request in the queue. (0d6622e Tomash Brechko)
+ o Fix a crash bug in evdns server circular list code (00e91b3)
+ o Handle calloc failure in evdns. (Found by Dave Hart) (364291e)
+ o Fix a memory leak on win32 socket->event map. (b4f89f0)
+ o Add a forgotten NULL check to evhttp_parse_headers (12311ff Sebastian Hahn)
+ o Fix possible NULL-deref in evdns_cancel_request (5208544 Sebastian Hahn)
+
+PORTABILITY:
+ o Fall back to sscanf if we have no other way to implement strtoll (453317b)
+ o Build correctly on platforms without sockaddr_storage (9184563)
+ o Try to build correctly on platforms with no IPv6 support (713c254)
+ o Build on systems without AI_PASSIVE (cb92113)
+ o Fix http unit test on non-windows platforms without getaddrinfo (6092f12)
+ o Do not check for gethostbyname_r versions if we have getaddrinfo (c1260b0)
+ o Include arpa/inet.h as needed on HPUX (10c834c Harlan Stenn)
+ o Include util-internal.h as needed to build on platforms with no sockaddr_storage (bbf5515 Harlan Stenn)
+ o Check for getservbyname even if not on win32. (af08a94 Harlan Stenn)
+ o Add -D_OSF_SOURCE to fix hpux builds (0b33479 Harlan Stenn)
+ o Check for allocation failures in apply_socktype_protocol_hack (637d17a)
+ o Fix the check for multicast or broadcast addresses in evutil_check_interfaces (1a21d7b)
+ o Avoid a free(NULL) if out-of-memory in evdns_getaddrinfo. Found by Dave Hart (3417f68)
+
+DEFENSIVE PROGRAMMING:
+ o Add compile-time check for AF_UNSPEC==PF_UNSPEC (3c8f4e7)
+
+BUGS IN TESTS:
+ o Fix test.sh output on solaris (b4f89b6 Dave Hart)
+ o Make test-eof fail with a timeout if we never get an eof. (05a2c22 Harlan Stenn)
+ o Use %s with printf in test.sh (039b9bd)
+ o Add an assert to appease clang's static analyzer (b0ff7eb Sebastian Hahn)
+ o Add a forgotten return value check in the unit tests (3819b62 Sebastian Hahn)
+ o Actually send NULL request in http_bad_request_test (b693c32 Sebastian Hahn)
+ o add some (void) casts for unused variables (65707d7 Sebastian Hahn)
+ o Refactor test_getaddrinfo_async_cancel_stress() (48c44a6 Sebastian Hahn)
+ o Be nice and "handle" error return values in sample code (4bac793 Sebastian Hahn)
+ o Check return value of evbuffer_add_cb in tests (93a1abb Sebastian Hahn)
+ o Remote some dead code from dns-example.c (744c745 Sebastian Hahn)
+ o Zero a struct sockaddr_in before using it (646f9fe Sebastian Hahn)
+
+BUILD FIXES:
+ o Fix warnings about AC_LANG_PROGRAM usage (f663112 Sebastian Hahn)
+ o Skip check for zlib if we have no zlib.h (a317c06 Harlan Stenn)
+ o Fix autoconf bracket issues; make check for getaddrinfo include netdb.h (833e5e9 Harlan Stenn)
+ o Correct an AM_CFLAGS to an AM_CPPFLAGS in test/Makefile.am (9c469db Dave Hart)
+ o Fix make distcheck & installation of libevent 1 headers (b5a1f9f Dave Hart)
+ o Fix compilation under LLVM/clang with --enable-gcc-warnings (ad9ff58 Sebastian Hahn)
+
+FEATURES:
+ o Make URI parser able to tolerate nonconformant URIs. (95060b5)
+
+DOCUMENTATION:
+ o Clarify event_set_mem_functions doc (926f816)
+ o Correct evhttp_del_accept_socket documentation on whether socket is closed (f665924)
+ o fix spelling mistake in whatsnew-2.0.txt (deb2f73)
+ o Fix sample/http-server ipv6 fixes (eb692be)
+ o Comment internal headers used in sample code. (4eb281c)
+ o Be explicit about how long event loops run in event.h documentation (f95bafb)
+ o Add comment to configure.in to explain gc-sections test logic (c621359)
+ o Fix a couple of memory leaks in samples/http-server.c. Found by Dave Hart. (2e9f665)
+
+BUILD IMPROVEMENTS:
+ o Use the gcc -ffunction-segments feature to allow gc when linking with static libevent (0965c56 Dave Hart)
+ o Add configure options to disable installation, regression tests (49e9bb7 Dave Hart)
+
+
+
+Changes in version 2.0.10-stable (16 Dec 2010)
+ [Autogenerated from the Git log, sorted and cleaned by hand.]
+BUGFIXES
+ o Minor fix for IOCP shutdown handling fix (2599b2d Kelly Brock)
+ o Correctly notify the main thread when activating an event from a subthread (5beeec9)
+ o Reject overlong http requests early when Expect:100-continue is set (d23839f Constantine Verutin)
+ o EVUTIL_ASSERT: Use sizeof() to avoid "unused variable" warnings with -DNDEBUG. (b63ab17 Evan Jones)
+
+CODE CLEANUPS
+ o bufferevent-internal.h: Use the new event2/util.h header, not evutil.h (ef5e65a Evan Jones)
+ o Use relative includes instead of system includes consistently. (fbe64f2 Evan Jones)
+ o Make whitespace more consistent
+
+TESTING
+ o tests: Use new event2 headers instead of old compatibility headers. (4f33209 Evan Jones)
+
+DOCUMENTATION
+ o Document that the cpu_hint is only used on Windows with IOCP for now (57689c4)
+ o Add stuff to "whats new in 2.0" based on reading include changes since August. (18adc3f)
+
+
+Changes in 2.0.9-rc (30 Nov 2010):
+ [Autogenerated from the Git log, sorted and cleaned by hand.]
+NEW AND MODIFIED APIs
+ o Add a function to change a listener's callback. (46ee061)
+ o Make evbuffer_add_file take ev_off_t, not off_t (ac7e52d)
+ o Make rate-limits go up to SIZE_MAX/EV_SSIZE_MAX, not just INT32_MAX (2cbb1a1)
+ o Add a bufferevent_get_base function (aab49b6)
+
+MAJOR BUGFIXES
+ o Disable changelist for epoll by default because of Linux dup() bug; add an option and/or an envvar to reenable it for speed. (9531763)
+ o Fix a 100%-CPU bug where an SSL connection would sometimes never stop trying to write (1213d3d)
+ o Fix a nasty bug related to use of dup() with epoll on Linux (c281aba)
+ o Fix bugs in posix thread-id calculation when sizeof(pthread_t) != sizeof(long) (fbaf077)
+ o Fix some ints to evutil_socket_t; make tests pass on win64. (f817bfa Dimitre Piskyulev)
+ o Set _EVENT_SIZEOF_VOID_P correctly on win32 and win64 (1ae82cd Dimitre Piskyulev)
+ o Avoid double-invocation of user callback with EVUTIL_EAI_CANCEL (abf01ed)
+ o Set SO_UPDATE_ACCEPT_CONTEXT on sockets from AcceptEx so that shutdown() can work (52aa419)
+ o When closing a filtering bufferevent, clear callbacks on the underlying bufferevent (fc7b1b0)
+
+NEW AND MODIFIED HTTP APIs
+ o Add evhttp_parse_query_str to be used with evhttp_uri_parse. (2075fbc)
+ o Add evhttp_response_code to remove one more reason to include http_struct.h (22e0a9b)
+ o Define enumerators for all HTTP methods, including PATCH from RFC5789 (75a7341 Felix Nawothnig)
+ o Functions to actually use evhttp_bound_socket with/as evconnlistener. (006efa7)
+ o Add evhttp_request_get_command so code can tell GET from POST without peeking at the struct. (49f4bf7)
+ o Introduce absolute URI parsing helpers. (86dd720 Pavel Plesov)
+ o Revise evhttp_uri_parse implementation to handle more of RFC3986 (eaa5f1d)
+ o Add evhttp_connection_get_base() to get the event_base from an http connection (cd00079)
+ o Let evhttp_parse_query return -1 on failure (b1756d0)
+ o New evhttp_uri(encode|decode) functions to handle + and NUL characters right (a8148ce)
+ o Add evhttp_response_code to remove one more reason to include http_struct.h (22e0a9b)
+ o Tweak interface for allowed methods (f5b391e)
+ o Add evhttp server alias interface, correct flagging of proxy requests. (aab8c38 Christopher Davis)
+
+HTTP BUGFIXES
+ o Add some comments to http.c and make a few functions static. (90b3ed5)
+ o Fix Content-Length when trying send more than 100GB of data (!) on an evhttp. (525da3e)
+ o Fix a bug where we would read too much data in HTTP bodies or requests. (58a1cc6)
+ o Correctly count req->body_size on http usage without Content-Length (8e342e5)
+ o Avoid missed-request bug when entire http request arrives before data is flushed (74c0e86)
+ o reset "chunked" flag when sending non-chunked reply (aa5f55f Joachim Bauch)
+ o evhttp_encode_uri encodes all reserved characters, including !$'()*+,/:=@ (2e63a60)
+ o Replace exact-version checks for HTTP/1.1 with >= or < checks (647e094)
+ o evhttp: Return 501 when we get an unrecognized method, not 400. (536311a)
+ o Don't disable reading from the HTTP connection after sending the request to be notified of connection-close in time (c76640b Felix Nawothnig)
+ o Never call evhttp_readcb while writing. (0512487)
+ o Try to fix an assertion failure related to close detection (0faaa39)
+ o Correctly detect timeouts during http connects (04861d5)
+ o Preliminary support for Continue expectation in evhttp. (fa9305f Christopher Davis)
+
+OTHER BUGFIXES
+ o Correct logic for realigning a chain in evbuffer_add (e4f34e8)
+ o Fix a minor syntax error that most compilers didn't care about (e56ff65)
+ o Fix some uses of int for socket in regress (5d389dc)
+ o Check return value for ioctlsocket on win32 (f5ad31c Trond Norbye)
+ o Fix som event_warns that should have been event_warnx (19c71e7)
+ o Fix signal handler types for win64. (b81217f)
+ o Try to clear up more size_t vs int/long issues. (598d133)
+ o Make sure IOCP evconnlistener uses virtual events. (7b40a00 Christopher Davis)
+ o Don't free evdns_request handles until after the callback is invoked (9ed30de)
+ o Fix some more cancel-related bugs in getaddrinfo_async (c7cfbcf)
+ o Make evdns_getaddrinfo_cancel threadsafe (d51b2fc)
+ o Only clear underlying callbacks when the user hasn't reset them. (1ac5b23)
+ o Fix bug in bufferevent_connect on an openssl bufferevent that already had an fd (4f228a1)
+ o Resolve an evport bug in the thread/forking test (3a67d0b)
+ o Make sure the CLOEXEC flag is set on fds we open for base notification (3ab578f)
+ o Fix IRIX build. sa_family collides with a #define in sys/socket.h on IRIX. (e874982 Kevin Bowling)
+ o If not WIN32, include <sys/socket.h> in event2/util.h. (1cd45e5 Kevin Bowling)
+ o Fix some C99-style comments to work with the xlC compiler. (c2e5e22 Kevin Bowling)
+ o Add some checks since lack of TAILQ_FOREACH doesn't imply lack of FIRST, END, NEXT, or INSERT_BEFORE. Quiet some warnings in XL C. (c4dc335 Kevin Bowling)
+ o Reworked AIX __ss_family workaround to use AC_STRUCT_MEMBER. (2e2a3d7 Kevin Bowling)
+ o Take select from <sys/select.h> when testing in autoconf. AIX build fix. (a3a9f6b Kevin Bowling)
+ o Fix snprintf related failures on IRIX. (3239073 Kevin Bowling)
+ o Remove _event_initialized(); make event_initialized() a function(); make it consistent on windows and non-windows (652024b)
+ o Do not let EVLOOP_ONCE exit the loop until all deferred callbacks have run (2d5e1bd)
+ o Make EVLOOP_ONCE ignore internal events (0617a81)
+ o Possible crash fix when freeing an underlying bufferevent of an openssl bufferevent (29f7623)
+
+HTTP CLEANUPS
+ o Stop using Libevent-1 headers in regress_http (1f507d7)
+ o Modernize header usage in bench_http.c (e587069)
+ o fix signed/unsigned warnings in http.c (74a91e5)
+ o Update the HTTP regression tests to use Libevent2 apis for non-http stuff (d9ffa89)
+ o Start porting http tests to not use legacy interfaces (8505a74)
+ o Convert the rest of the http tests to be non-legacy unit tests. (9bb8239)
+ o Rename the confusing "base" static variable in regress_http.c (353402a)
+ o Stop accessing http request struct directly from in the unit tests. (0b137f4)
+ o Refactor http version parsing into a single function (a38140b)
+
+TESTING
+ o Improvements to tinytest_macros.h (ad923a1)
+ o Add a huge pile of tests for the new URI functions, and make them pass. (a5a76e6)
+ o Unit tests for evhttp_uri_set* (bc98f5e)
+ o Increase the skew tolerance to 2 seconds in thread/deferred_cb_skew (f806476 Christopher Davis)
+ o Reorder backends in test.sh to match preference order in event.c (ece974f)
+ o Add a stress test for getaddrinfo_cancel (da1bf52)
+ o Units test for unexpected evhttp methods. (75e3320)
+
+DOCUMENTATION
+ o Document behavior of URI parsing more thoroughly. (3a33462)
+ o Document that two bufferevent functions only work on socket bufferevents (70e1b60)
+ o add a requested docstring for event_rpcgen.CommandLine.__init__ (f1250eb)
+ o Fix a mistake in http documentation found by Julien Blache (229714d)
+ o Add a basic example of how to write a static HTTP server. (4e794d5)
+ o Document event_get_assignment (88be27d)
+ o Note that reentrant calls to libevent from logging cbs may fail badly (e431bcd)
+ o Clarify EVLOOP_* documentation to be more precise. (057a514)
+
+CLEANUPS
+ o Simplify the logic for choosing EPOLL_CTL_ADD vs EPOLL_CTL_MOD (2c66983)
+ o Rename "size" variables in win32select that were really fd counts. (b6a158c)
+ o Fix even more win64 warnings (7484df6)
+ o Fix even more win64 warnings: buffer, event_tagging, http, evdns, evrpc (545a611)
+ o Fix more wn64 warnings. (34b84b9 Christopher Davis)
+ o Use the label_len local variable in evdns instead of recalculating it over and over (ba01456)
+ o Fix some irix compilation warnings spotted by Kevin Bowling (7bcace2)
+
+
+
+Changes in 2.0.8-rc (14 Oct 2010):
+ [Autogenerated from the Git log, sorted and cleaned by hand.]
+NEW APIS
+ o Add error callback to evconnlistener (c4be8d8 Simon Perreault)
+ o Add a LEV_OPT_THREADSAFE option for threadsafe evconnlisteners (127d4f2)
+
+CHANGED BEHAVIOR
+ o Correct logic on disabling underlying bufferevents when disabling a filter (ac27eb8)
+
+BUGFIXES
+ o Obey enabled status when unsuspending (040a019 Simon Perreault)
+ o Warn when using the error-prone EV_SIGNAL interface in an error-prone way. Also, fix a couple of race conditions in signal.c (720bd93)
+ O Make default signal backend fully threadsafe (95a7d41)
+ o Put internal events at highest priority (90651b3)
+ o Fix warnings in the main codebase flagged by -Wsigned-compare (9c8db0, 5e4bafb, 5c214a, 6be589a, e06f514)
+ o Fix compile in kqueue.c (b395392 Sebastian Hahn)
+ o Do not search outside of the system directory for windows DLLs (d49b5e3)
+ o Fix a spurious-call bug on epoll.c (0faaee0)
+ o Send a shutdown(SHUT_WR) before closing an http connection (e0fd870 Christopher Davis)
+ o Fix warnings on mingw with gcc 4.5 (5b7a370)
+ o Fix an EINVAL on evbuffer_write_iovec on OpenSolaris. (fdc640b)
+ o Fix allocation error for IOCP listeners. Probably harmless, since struct event is big (481ef92)
+ o Make iocp/listener/error work; don't accept again if lev is disabled. (62b429a Christopher Davis)
+ o Handle rate-limiting for reading on OpenSSL bufferevents correctly. (819b171)
+ o Fix serious bugs in per-bufferevent rate-limiting code (34d64f8)
+ o Avoid spurious reads from just-created open openssl bufferevents (223ee40)
+ o Fix a case where an ssl bufferevent with CLOSE_ON_FREE didn't close its fd (93bb7d8)
+ o The corrected bufferevent filter semantics let us fix our openssl tests (34331e4)
+
+TESTING
+ o Make SSL tests cover enabling/disabling EV_READ. (a5ce9ad)
+ o Bump to the latest version of tinytest (f0bd83e)
+ o Unit tests for listener error callbacks (045eef4)
+ o New unit test for ssl bufferevents starting with connected SSLs. (02f6259)
+
+DEBUGGABILITY
+ o Make debugging output for epoll backend more comprehensive (ec2b05e)
+ o Make event.c debugging messages report fds (e119899)
+ o Make the --enable-gcc-warnings option include signed comparison warnings (d3b096c)
+
+DEADCODE REMOVAL
+ o Remove the now-useless evsig_caught and evsig_process (4858b79)
+ o Remove event_base.evsigbase; nothing used it. (38d0960)
+
+
+
+Changes in 2.0.7-rc (9 Sep 2010):
+ [Autogenerated from the Git log, sorted and cleaned by hand.]
+NEW APIS
+ o Expose a evdns_base_nameserver_sockaddr_add() function to add a nameserver by sockaddr (1952143)
+ o Add event_config_set_num_cpus_hint() for tuning win32 IOCP thread pools, etc. (2447fe8 Christopher Davis)
+
+BUGFIXES
+ o Fix a nasty dangling-event bug when using rate-limiting groups (0bffe43)
+ o Clean up syntax on TAILQ_ENTRY() usage to build correctly with recent MSVC (60433a0 Gilad Benjamini)
+ o Make definition of WIN32_LEAN_AND_MEAN in event.h conditional (3920172 Gilad Benjamini)
+ o Correctly detect failure to delete bufferevent read-timeout event (da6e7cd)
+ o Set close-on-exec bit for filedescriptors created by dns subsystem (d0b8843)
+ o Fix kqueue correctness test on x84_64 (6123d12)
+ o Detect events with no ev_base; warn instead of crashing (f1074b7)
+ o Fix an issue with forking and signal socketpairs in select/poll backends (d61b2f3)
+ o Stop using global arrays to implement the EVUTIL_ctype functions (1fdec20)
+ o On windows, make lock/thread function tables static (5de2bcb)
+ o Close th_notify_fds and open a new pair on reinit (495ed66)
+ o Declare signal handler function as "__cdecl" on Windows (f0056d0)
+ o Use the _func() replacements for open, fstat, etc in evutil.c on win32 (e50c0fc)
+ o Only process up to MAX_DEFERRED deferred_cbs at a time (17a14f1 Christopher Davis)
+
+THREADING BUGFIXES
+ o Avoid deadlock when activating signals (970e6ad)
+ o Add a condition variable backend, with implementations for pthreads and win32 (d4977b5)
+ o Use conditions instead of current_event_lock to fix a deadlock (e0972c2)
+ o Fix logic error in win32 TRY_LOCK that caused problems with rate-limiting (4c32b9d)
+ o Avoid needlessly calling evthread_notify_base() when the loop is not running (c7a06bf)
+ o Minimize calls to base_notify implementation functions, thereby avoiding needless syscalls (4632b78)
+
+IOCP BUGFIXES
+ o IOCP-related evbuffer fixes (03afa20 Christopher Davis)
+ o Stop IOCP when freeing the event_base (d844242 Christopher Davis)
+ o Some IOCP bufferevent tweaks (76f7e7a Christopher Davis)
+
+TESTS
+ o Make the regress_pthread.c tests work on windows with current test APIs (d74ae38)
+ o Add a unit test for conditions (5fb1095)
+ o Allow more than one copy of regression tests to run at once (a97320a)
+ o Fix event_del(0) instance in bench.c (b0f284c Shuo Chen)
+ o Fix a few memory leaks in the tests (1115366)
+ o IOCP-related unit test tweaks (499452f Christopher Davis)
+ o Improve testing of when thread-notification occurs (ce85280)
+
+BUILD AND DISTRIBUTION
+ o Add pkgconfig files for libevent_{openssl,pthreads} (ebcb1f0)
+ o Change include order in Makefile.nmake (4022b28)
+ o Make include/event2/event-config.h not included in source dist (a4af9be)
+ o Honor NDEBUG; build without warnings with NDEBUG; make NDEBUG always-off in unit test code (743f866)
+ o Declare evkeyvalq and event_list even if event_struct.h comes before sys/queue.h (d3ceca8)
+ o Move evkeyvalq into a separate header for evhttp_parse_query users (ca9048f)
+ o Prefer autoreconf -ivf to manual autogen.sh (7ea8e89)
+
+CLEANUP
+ o Completely remove the (mostly-removed) obsolete thread functions (3808168)
+ o Rename regress_pthread.c to regress_thread.c (041989f)
+ o Make defer-internal.h use lock macros, not direct calls to lock fns (5218d2a)
+
+DOCUMENTATION
+ o Document that DNS_NO_SEARCH is an obsolete alias for DNS_QUERY_NO_SEARCH (33200e7)
+ o Update the whatsnew-2.0.txt document (4991669)
+
+
+
+Changes in 2.0.6-rc (6 Aug 2010):
+ [Autogenerated from the Git log, sorted by hand.]
+DOCUMENTATION
+ o Document a change in the semantics of event_get_struct_event_size() (e21f5d1)
+ o Add a comment to describe our plan for library versioning (9659ece)
+ o Fix sentence fragment in docs for event_get_struct_event_size() (7b259b6)
+
+NEW FEATURES AND INTERFACE CHANGES
+ o Remove the obsolete evthread interfaces (c5bab56)
+ o Let evhttp_send_error infer the right error reasons (3990669)
+ o Add a function to retrieve the other side of a bufferevent pair (17a8e2d)
+ o Add bufferevent_lock()/bufferevent_unlock() (215e629)
+ o Stop asserting when asked for a (unsupported) TCP dns port. Just return NULL. (7e87a59)
+ o Replace (unused,always 0) is_tcp argument to evdns_add_server_port*() with flags (e1c1167)
+ o Constify a couple of arguments to evdns_server_request_add_*_reply (cc2379d)
+ o Add an interface to expose min_share in ratelimiting groups (6ae53d6)
+
+BUGFIXES
+ o Avoid event_del on uninitialized event in event_base_free (6d19510)
+ o Add some missing includes to fix Linux build again (75701e8)
+ o Avoid close of uninitialized socket in evbuffer unit test (bda21e7)
+ o Correctly recognize .255 addresses as link-local when looking for interfaces (8c3452b)
+ o If no evdns request can be launched, return NULL, not a handle (b14f151)
+ o Use generic win32 interfaces, not ASCII-only ones, where possible. (899b0a3)
+ o Fix the default HTTP error template (06bd056 Felix Nawothnig)
+ o Close the file in evutil_read_file whether there's an error or not. (0798dd1 Pierre Phaneuf)
+ o Fix possible nullptr dereference in evhttp_send_reply_end() (29b2e23 Felix Nawothnig)
+ o never let bufferevent_rlim functions return negative (0859870)
+ o Make sample/hello_world work on windows (d89fdba)
+ o Fix a deadlock related to event-base notification. Diagnosed by Zhou Li, Avi Bab, and Scott Lamb. (17522d2)
+ o Possible fix to 100% cpu usage with epoll and openssl (cf249e7 Mike Smellie)
+ o Don't race when calling event_active/event_add on a running signal event (fc5e0a2)
+ o Suppress a spurious EPERM warning in epoll.c (e73cbde)
+ o Fix wrong size calculation of iovec buffers when exact=1 (65abdc2 niks)
+ o Change bufferevent_openssl::do_write so it doesn't call SSL_write with a 0 length buffer (c991317 Mike Smellie)
+ o Fixed compilation of sample/le-proxy.c on win32 (13b912e Trond Norbye)
+ o Fix rate-limit calculation on openssl bufferevents. (009f300)
+ o Remember to initialize timeout events for bufferevent_async (de1f5d6 Christopher Davis)
+
+BUILD AND DISTRIBUTION CHANGES
+ o Test the unlocked-deferred callback case of bufferevents (dfb75ab)
+ o Remove the now-unusable EVTHREAD_LOCK/UNLOCK constants (fdfc3fc)
+ o Use -Wlogical-op on gcc 4.5 or higher (d14bb92)
+ o Add the libtool-generated /m4/* stuff to .gitignore (c21c663)
+ o Remove some automake-generated files from version control. (9b14911)
+ o Have autogen.sh pass --force-missing to automake (8a44062)
+ o Set library version for libevent_pthreads correctly (b2d7440)
+ o Really only add libevent_core.la to LIBADD on mingw (1425003 Sebastian Hahn)
+ o Build more cleanly with NetBSDs that dislike toupper(char) (42a8c71)
+ o Fix unit tests with -DUSE_DEBUG enabled (28f31a4)
+ o Fix evdns build with -DUNICODE (5fa30d2)
+ o Move event-config.h to include/event2 (ec347b9)
+
+TESTING
+ o Add options to test-ratelim.c to check its results (2b44dcc)
+ o Make test-ratelim clean up after itself better. (b5bfc44)
+ o Remove the now-obsolete setup_test() and cleanup_test() functions (e73f1d7)
+ o Remove all non-error prints from test/regress.c (8bc1e3d)
+ o Make test.sh exit with nonzero status if tests fail (faf2a04)
+ o Have the unit tests report errors from test.sh (3689bd2)
+ o Fix logic in correcting high values from FIONREAD (3467f2f)
+ o Add test for behavior on remote socket close (44d57ee)
+ o Unit test for event_get_struct_event_size() (7510aac)
+ o Make test/test.sh call test-changelist (7c92691)
+ o Fix badly-behaved subtest of dns/bufferevent_connect_hostname (840a72f Joachim Bauch)
+ o Add option to test-ratelim to test min_share (42f6b62)
+ o Fix an assertion bug in test-ratelim (b2c6202)
+ o Make tests quieter on local dns resolver failure (e996b3d)
+ o Increase the tolerance in our unit tests for sloppy clocks. (170ffd2)
+ o Use AF_INET socketpair to test sendfile on Solaris (9b60209)
+ o Make test-changelist count cpu usage right on win32 (ea1ea3d)
+
+INTERNALS, PERFORMANCE, AND CODE CLEANUPS
+ o Mark the event_err() functions as __attribute__((noreturn)) (33bbbed)
+ o Do not check that event_base is set in EVBASE_ACQUIRE_LOCK (218a3c3)
+ o Replace (safe) use of strcpy with memcpy to appease OpenBSD (caca2f4)
+ o Remove some dead assignments (47c5dfb)
+ o Fix a pedantic gcc 4.4 warning in event2/event.h (276e7ee)
+ o Drain th_notify_fd[0] more bytes at a time. (a5bc15b)
+ o Tidy up the code in evthread_make_base_notifiable a little (61e1eee)
+ o Pass flags to fcntl(F_SETFL) and fcntl(F_SETFD) as int, not long (7c2dea1)
+ o Remove unused variables in test/test-changelist.c (b00d4c0)
+ o Fix whitespace. (cb927a5)
+ o Improve error message for failed epoll to make debugging easier. (9e725f7)
+ o Turn our socketpair() replacement into its own function (57b30cd)
+
+
+
+Changes in 2.0.5-beta (10 May 2010):
+ [Autogenerated from the Git log, sorted by hand.]
+DOCUMENTATION
+ o Update all our copyright notices to say "2010" (17efc1c)
+ o Add Christopher Clark and Maxim Yegorushkin to the LICENSE file (38b7b57)
+ o Clarify Christopher Clark's status as writer of original ht code. (78772c3)
+ o Try to comment some of the event code more (cdd4c49)
+ o Add a few more evmap/changelist comments (c247adc)
+ o Add a comment to explain why evdns_request is now separte from request (ceefbe8)
+ o Document evutil_secure_rng_init() and evutil_secure_rng_add_bytes() (a5bf43a)
+ o Stop distributing and installing manpages: they were too inaccurate (7731ec8)
+
+NEW FEATURES AND INTERFACE CHANGES
+ o Remove signal_assign() and signal_new() macros. (2fac0f7)
+ o Make evdns use the regular logging system by default (b2f2be6)
+ o Allow evbuffer_read() to split across more than 2 iovecs (e470ad3)
+ o Functions to manipulate existing rate limiting groups. (ee41aca)
+ o Functions to track the total bytes sent over a rate limit group. (fb366c1)
+ o Detect and refuse reentrant event_base_loop() calls (b557b17)
+ o Limit the maximum number of events on each socket to 65535 (819f949)
+ o Add evbuffer_copyout to copy data from an evbuffer without draining (eb86c8c)
+ o Expose the request and reply members of rpc_req_generic() (07edf78 Shuo Chen)
+ o Add void* arguments to request_new and reply_new evrpc hooks (755fbf1 Shuo Chen)
+ o Seed the RNG using sysctl() as well as /dev/urandom (71fc3eb)
+ o Make evutil_secure_rng_init() work even with builtin arc4random (f980716)
+ o Report DNS error when lookup fails during bufferevent_socket_connect_hostname. (0ef4070 Christopher Davis)
+ o Release locks on bufferevents while executing callbacks (a5208fe Joachim Bauch) o Make debug mode catch mixed ET and non-ET events on an fd (cb67074)
+ o Catch attempts to enable debug_mode too late (9ecf0d4)
+ o Refuse null keys in evhttp_parse_query() (953e229 Frank Denis)
+
+BUGFIXES
+ o Avoid a spurious close(-1) on Linux (70a44b6)
+ o Do not close(-1) when freeing an uninitialized socket bufferevent (b34abf3)
+ o Free evdns_base->req_heads on evdns_base_free (859af67)
+ o Avoid an (untriggerable so far) crash bug in bufferevent_free() (0cf1431)
+ o Set mem_offset for every bufferevent type (657d1b6)
+ o Fix infrequent memory leak in bufferevent_init_common(). (8398641 Jardel Weyrich)
+ o Make evutil_signal_active() match declaration. (e1e703d Patrick Galbraith)
+ o Fix minheap code to use replacement malloc functions (a527618)
+ o Fix a free(NULL) in minheap-internal.h (6f20492)
+ o Fix critical bug in evbuffer_write when writev is not available (cda56ab)
+ o Make the no_iovecs case of write_atmost compile (8e227b0)
+ o Fix a memory leak when appending/prepending to a buffer with unused space. (45068a3)
+ o Clean up a mistake in pointer manipulation in evbuffer_remove (28bfed4 Christopher Davis)
+ o Always round up when there's a fractional number of msecs. (8f9e60c Christopher Davis)
+ o Fix compiler warnings under WIN32 (d469c50 Giuseppe Scrivano)
+ o Clean up properly when adding a signal handler fails. (b84b598 Gilad Benjamini) o Ensure that evdns_request is a persistent handle. (15bb82d Christopher Davis)
+ o Free search state when finished searching to avoid an infinite loop. (a625840 Christopher Davis)
+ o Assert for valid requests as necessary. (67072f3 Christopher Davis)
+ o do not leak the request object on persistent connections (9d8edf2)
+ o Make evdns logging threadsafe (b1c7950)
+ o Fix a couple of bugs in the BSD sysctl arc4seed logic (a47a4b7)
+ o Remove one last bug in last_with_datap logic. Found with valgrind (d49b92a)
+ o fix a leak when unpausing evrpc requests (94ee125)
+ o Fix a memory leak when unmarshalling RPC object arrays (f6ab2a2)
+ o Fix compilation when openssl support is disabled (40c301b)
+ o Allow empty reason line in HTTP status (739e688 Pierre Phaneuf)
+ o Fix a compile warning introduced in 739e688 (bd1ed5f Sebastian Hahn)
+ o Fix nonstandard TAILQ_FOREACH_REVERSE() definition (71afc52 Frank Denis)
+ o Try /proc on Linux as entropy fallback; use sysctl as last resort (20fda29)
+ o Fix symbol conflict between mm_*() macros and libmm (99e50e9)
+ o Fix some crazy macro mistakes in arc4random.c (90d4225)
+ o Make evbuffer_add_file() work on windows (dcdae6b)
+ o Fix unused-variable warning when building with threads disabled (ad811cd)
+ o Numerous opensolaris compilation fixes (c44de06)
+ o Fix getaddrinfo with protocol unset on Solaris 9. Found by Dagobert Michelsen (2cf2a28)
+ o Fix another nasty solaris getaddrinfo() behavior (3557071)
+ o Define _REENTRANT as needed on Solaris, elsewhere (c1cd32a)
+ o Fix some autoconf issues on OpenBSD (7c519df)
+
+BUILD AND DISTRIBUTION CHANGES
+ o Distribute libevent.pc.in, not libevent.pc (22aff04)
+ o Avoid errors in evutil.c when building with _UNICODE defined (b677032 Brodie Thiesfield)
+ o Avoid errors in http.c when building with VC 2003 .NET (13e4f3b Brodie Thiesfield)
+ o Support the standard 'make check' target in place of 'make verify' (426c8fb)
+ o Remove redundant stuff from EXTRA_DIST (b660edf)
+ o Switch to using AM conditionals in place of AC_LIBOBJ (2e898f5)
+ o Remove an orphaned RELEASE flag in Makefile.am (0794b0d)
+ o Give a better warning for bad automake versions. (77c917d)
+ o Use dist_bin_SCRIPTS, not EXTRA_DIST, to distribute scripts (9eb2fd7)
+ o Never test for select() on windows (3eb044d Trond Norbye)
+ o Do not inhibit automake dependencies generation (10c4c90 Giuseppe Scrivano)
+ o Create shared libraries under Windows (3cbca86 Giuseppe Scrivano)
+ o Add ctags/etags files to .gitignore (0861d17)
+ o Only specify -no-undefined on mingw (25433b9)
+ o Only add libevent_core.la to LIBADD on mingw (fdc6297)
+
+TESTING
+ o Get bench_http to work on Windows; add a switch to enable IOCP. (4ac38a5 Christopher Davis)
+ o VC has no getopt(), so do without in bench_http. (1273d2f Christopher Davis)
+ o Fix an obnoxious typo in the bufferevent_timeout_filter test (0d047c3)
+ o Fix a write of uninitialized RAM in regression tests (68dc742)
+ o Fix some memory leaks in the unit tests (274a7bd)
+ o Make 'main/many_events' test 70 fds, not 64. (33874b0)
+ o Unit-test every evbuffer_add_file() implementation. (06a4443)
+ o Add more unit tests for evbuffer_expand (8c83e99)
+ o Test another case of evbuffer_prepend (1234b95)
+ o Fix a possible double-free bug in SSL bufferevents with CLOSE_ON_FREE (7501895) o Add dns/search_cancel unit test. (39b870b Christopher Davis)
+ o Make http_base_test stop leaking an event_base. (96730d3)
+ o Detect broken unsetenv at unit-test runtime (f37cd4c)
+ o Implement regress_make_tempfile on win32 to test evbuffer_add_file (b4f12a1)
+ o add more (currently skipped) add_file tests on win32 (05de45d)
+ o Fix bench_http build on win32. (384d124)
+ o Make unit test for add_file able to tell "error" from "done" (88a543f)
+ o Make test for bufferevent_connect_hostname system-neutral (f89168e)
+ o Make test.sh support mingw/msys on win32 (0ee6f6c)
+ o Fix test.sh on freebsd (3d9e05b)
+
+INTERNALS, PERFORMANCE, AND AND CODE CLEANUPS
+ o Improve the speed of evbuffer_readln() (cc1600a)
+ o more whitespace normalization (2c2618d)
+ o Revise evbuffer to add last_with_data (2a6d2a1)
+ o Use last_with_data in place of previous_to_last (c8ac57f)
+ o Remove previous_to_last from evbuffer (6f47bd1)
+ o Fix last_with_data compilation on windows (1e7b986)
+ o Add some glass-box tests for the last_with_data code. (17da042)
+ o Improve robustness for refcounting (f1bc125)
+ o Remove a needless min_heap_shift_up_() call (7204b91)
+ o Increase MIN_BUFFER_SIZE to 512 (1024 on 64-bit) (2014ae4)
+ o Do not use evbuffer_expand() to add the first chain to a buffer (5c0ebb3)
+ o Make evbuffer_prepend handle empty buffers better (c87272b)
+ o Replace last_with_data with a slightly smarter version (b7442f8)
+ o Turn the increasingly complex *_CHAIN() macros into functions (96865c4)
+ o Rewrite evbuffer_expand and its users (d5ebcf3)
+ o Add evutil_tv_to_msec for safe conversion of timevals to milliseconds. (850c3ff Christopher Davis)
+ o Initialize last_with_datap correctly in evbuffer_overlapped (a0983b6)
+ o Replace EVUTIL_CLOSESOCKET macro with a function (899c1dc Sebastian Sjöberg)
+ o Move domain search state to evdns_request. (beaa14a Christopher Davis)
+ o Remove redundant checks for lock!=NULL before calling EVLOCK_LOCK (50ec59f)
+ o Rename current_base symbol to event_global_current_base_ (c16e684)
+ o Fix whitespace in evutil.c (935e150)
+ o Replace users of "int fd" with "evutil_socket_t fd" in portable code (c7cf6f0)
+
+
+
+Changes in 2.0.4-alpha (28 Feb 2010):
+ [Autogenerated from the Git log, sorted by hand.]
+DOCUMENTATION
+ o Add stub header for 2.0.4-alpha changelog. (94d0065)
+ o Improve the README with more information and links. (0b42726)
+ o Add more people who wrote patches to the acknowledgments (0af10d5)
+ o Add a warning about the use of event_initialized. (f32b575)
+ o Add a LICENSE file so people can find our license easily (7067006)
+ o Add a new "hello world" sample program (becb9f9)
+ o Clarify status of example programs (d60a1bd)
+ o Update time-test.c to use event2 (f4190bf)
+ o Add the arc4random.c license to the LICENSE file. (e15e1e9)
+
+NEW FEATURES AND INTERFACE CHANGES
+ o Improved optional lock debugging. (0cd3bb9)
+ o Rate-limiting for bufferevents; group and individual limits are supported. (737c9cd)
+ o Testing code for bufferevent rate-limiting. (f0c0124)
+ o Make the initial nameserver probe timeout configurable. (1e56a32)
+ o Revise the locking API: deprecate the old locking callbacks and add trylock. (347952f)
+ o Do not make bufferevent_setfd implicitly disable EV_READ and EV_WRITE. (8274379)
+ o Do not ignore bufferevent_enable(EV_READ) before bufferevent_connect(). (4a5b534)
+ o Introduced evutil_make_socket_closeonexec() to preserve fd flags for F_SETFD. (d0939d2 Jardel Weyrich)
+ o evdns_getaddrinfo() now supports the /etc/hosts file. (72dd666)
+ o Look at the proper /etc/hosts file on windows. (66c02c7)
+ o Allow http connections to use evdns for hostname looksups. (c698b77)
+ o Changelist code to defer event changes until just before dispatch (27308aa)
+ o do not use a function to assign the evdns base; instead assign it via evhttp_connection_base_new() which is a new function introduced in 2.0 (5032e52)
+ o Functions to access more fields of struct event. (0683950)
+ o Make kqueue use changelists. (45e5ae3)
+ o Remove kqueue->pend_changes. (3225dfb)
+ o Minimize epoll_ctl calls by using changelist (c8c6a89)
+ o Add support for a "debug mode" to try to catch common errors. (cd17c3a)
+ o Note a missing ratelim function (361da8f)
+ o Add ev_[u]intptr_t to include/event2/util.h (1fa4c81)
+ o const-ify a few more functions in event.h (d38a7a1)
+ o Deprecate EVENT_FD and EVENT_SIGNAL. (f6b2694)
+ o Remove EVUTIL_CHECK_FMT. (6c21c89)
+ o Add EV_*_MAX macros to event2/util.h to expose limits for ev_* types. (aba1fff) o Functions to view and manipulate rate-limiting buckets. (85047a6)
+ o Add the rest of the integer limits, and add a test for them. (60742d5)
+ o Remove the 'flags' argument from evdns_base_set_option() (1dd7e6d)
+ o Add an arc4random implementation for use by evdns (d4de062)
+ o Use off_t for the length parameter of evbuffer_add_file (3fe60fd)
+ o Construct Windows locks using InitializeCriticalSectionAndSpinCount (32c6f1b)
+ o Expose view of current rate limit as constrained by group limit (162ce8a)
+ o Provide consistent, tested semantics for bufferevent timeouts (d328829)
+
+BUGFIXES AND TESTS
+ o Tolerate code that returns from a fatal_cb. (91fe23f)
+ o Parenthesize macro arguments more aggressively (07e9e9b)
+ o Fix memory-leak of signal handler array with kqueue. (e1ffbb8)
+ o Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks. (76cd2b7)
+ o Fix two use-after-free bugs in unit tests spoted by lock debugging (d84d838)
+ o Fix a locking bug in event_base_loop() (da1718b)
+ o Fix an evdns lock violation. (2df1f82 Zhuang Yuyao)
+ o Valgrind fix: Clear struct kevent before checking for OSX bug. (56771a3 William Ahern)
+ o Fix up evthread compilation on windows (bd6f1ba Roman Puls)
+ o Fix regress_iocp.c usage of old lock allocation macros. (31687b4 unknown)
+ o Update nmake makefile to build evthread.c (b62d979 unknown)
+ o Fix a crash when reading badly formatted resolve.conf; from Yasuoka Masahiko (6c7c579 Yasuoka Masahiko)
+ o Fix a snow leopard compile warning in the unit tests. (7ae9445)
+ o Fix compile on Snow Leopard with gcc warnings enabled (70cdfe4 Sebastian Hahn)
+ o Only define _GNU_SOURCE if it is not already defined. (ea6b1df Joachim Bauch)
+ o Update sample/signal-test.c to use newer APIs and not leak. (f6430ac Evan Jones)
+ o Fix a segfault when writing a very fragmented evbuffer onto an SSL (a6adeca Joachim Bauch)
+ o Fix a segfault when freeing SSL bufferevents in an unusual order (a773df5 Joachim Bauch)
+ o Drop install-sh from our git repo: a mismatched version could break "make dist" (6799527)
+ o Set all instances of the version number correctly. (5a112d3)
+ o Fix a few locking issues on windows. (c51bb3c unknown)
+ o Use evutil_socket_t, not int, when logging socket errors. (292467c)
+ o Fix up behavior of never-defered callbacks a little (390e056)
+ o Replace some cases of uint32_t with ev_uint32_t. (a47d88d)
+ o Fix compilation of devpoll.c by adding missing thread includes. (fee2c77 Dagobert Michelsen)
+ o Make evutil_make_socket_nonblocking() leave any other flags alone. (4c8b7cd Jardel Weyrich)
+ o Fix an fd leak in evconnlistener_new_bind(). (24fb502 Jardel Weyrich)
+ o Fix a bogus free in evutil_new_addrinfo() (0d64051 Jardel Weyrich)
+ o Adjusted fcntl() retval comparison on evutil_make_socket_nonblocking(). (4df7dbc Jardel Weyrich)
+ o Fix the code that allowed DNS options to not end with : (ee4953f)
+ o Fix crash bugs when a bufferevent's eventcb is not set. (2e8eeea)
+ o Fix test-ratelim compilation on Linux. (885b427)
+ o Fix compilation of rate-limiting code on win32. (165d30e)
+ o Eradicated the last free() call. Let mm_free() take care of deallocation. (0546ce1 Jardel Weyrich)
+ o Fix byte counts when mixing deferred and non-deferred evbuffer callbacks. (29151e6)
+ o Fixed a memory leak on windows threads implementation. The CRITICAL_SECTION was not being free'd in evthread_win32_lock_free(). (2f33e00 Jardel Weyrich)
+ o Fixed a fd leak in start_accepting(), plus cosmetic changes (4367a33 Jardel Weyrich)
+ o Improved error handling in evconnlistener_new_async(). Also keeping the fd open because it is not opened by this function, so the caller is responsible for closing it. Additionally, since evconnlistener_new_bind() creates a socket and passes it to the function above, it required error checking to close the same socket. (fec66f9 Jardel Weyrich)
+ o Don't use a bind address for nameservers on loopback (8d4aaf9)
+ o Fix compilation of rate-limit code when threading support is disabled (97a8c79)
+ o Detect setenv/unsetenv; skip main/base_environ test if we can't fake them. (7296971)
+ o Check more internal event_add() calls for failure (ff3f6cd)
+ o Fix windows and msvc build (5c7a7bc)
+ o Call event_debug_unassign on internal events (a19b4a0)
+ o Try to fix a warning in hash_debug_entry (137f2c6)
+ o Fix a dumb typo in ev_intptr_t definitions. (27c9a40)
+ o do not fail while sending on http connections the client closed. (93d7369)
+ o make evhttp_send() safe against terminated connections, too (3978180)
+ o Make Libevent 1.4.12 build on win32 with Unicode enabled. (000a33e Brodie Thiesfield)
+ o Fix some additional -DUNICODE issues on win32. (a7a9431)
+ o Add a check to make soure our EVUTIL_AI flags do not conflict with the native ones (c18490e)
+ o Always use our own gai_strerror() replacement. (6810bdb)
+ o Make RNG work when we have arc4random() but not arc4random_buf() (4ec8fea)
+ o validate close cb on server when client connection closes (2f782af)
+ o Fix two unlocked reads in evbuffer. (7116bf2)
+ o When working without a current event base, don't try to use IOCP listeners (cb52838)
+ o Fix getpid() usage on Windows (ff2a134)
+ o Add a unit test for secure rng. (48a29b6)
+ o Add some headers to fix freebsd compilation (b72be50)
+ o When connect() succeeds immediately, don't invoke the callback immediately. (7515de9)
+ o Suspend read/write on bufferevents during hostname lookup (db08f64)
+ o Make bufferevent_free() clear all callbacks immediately. (b2fbeb3)
+ o Fix some race conditions in persistent events and event_reinit (e2642f0)
+ o Fix a bug in resetting timeouts on persistent events when IO triggers. (38ec0a7)
+ o Add a test for timeouts on filtering bufferevents. (c02bfe1)
+ o Add test for periodic timers that get activated for other reasons (8fcb7a1)
+ o Use new timeval diff comparison function in bufferevent test (f3dfe46)
+ o Delete stack-alloced event in new unit test before returning. (7ffd387)
+ o Fix mingw compilation (23170a6)
+ o Try to define a sane _EVENT_SIZEOF_SIZE_T for msvc compilation (1e14f82)
+ o Fix arc4random compilation on MSVC. (98edb89)
+ o deal with connect() failing immediately (7bc48bf)
+ o Small cleanups on freebsd-connect-refused patch. (57b7248)
+
+BUILD AND DISTRIBUTION CHANGES
+ o Remove the contents of WIN32-Prj as unmaintained. (c69d5a5)
+ o Allow the user to redirect the verbose output of test/test.sh to a file (c382de6)
+ o Allow test.sh to be run as ./test/test.sh (7dfbe94)
+ o Never believe that we have pthreads on win32, even if gcc thinks we do. (78ed097)
+ o Make it compile under gcc --std=c89. (e2ca403)
+ o Fix a number of warnings from gcc -pedantic (918e9c5)
+ o Add the msvc-generated .lib files to .gitignore. (e244a2e)
+ o Add the "compile" script to gitignore. (1ba6bed)
+
+INTERNALS AND CODE CLEANUPS
+ o Add a .gitignore file. (ba34071)
+ o New EVTHREAD_TRY_LOCK function to try to grab a lock. (689fc09)
+ o Add the abilitity to mark some buffer callbacks as never-deferred. (438f9ed)
+ o Refactor our 'suspend operation' logic on bufferevents. (0d744aa)
+ o Simplify the read high-watermark checking. (5846bf6)
+ o Improve readability of evutil_unparse_protoname() (5a43df8 Jardel Weyrich)
+ o Expose our cached gettimeofday value with a new interface (47854a8)
+ o Whitespace fixes in test.sh (0b151a9)
+ o Enable branch-prediction hints with EVUTIL_UNLIKELY. (eaaf27f)
+ o Refactor code from evdns into a new internal "read a file" function. (0f7144f)
+ o Comestic changes in evconnlistener_new(), new_accepting_socket(), accepted_socket_invoke_user_cb() and iocp_listener_enable(). (510ab6b Jardel Weyrich)
+ o Add unit-test for bad_request bug fixed in 1.4 recently. (6cc79c6 Pavel Plesov) o Add a comment on evthread_enable_lock_debuging. (b9f43b2)
+ o Fix test.sh on shells without echo -n (94131e9)
+ o More unit tests for getaddrinfo_async: v4timeout and cancel. (a334b31)
+ o Make http use evconnlistener. (ec34533)
+ o move dns utility functions into a separate file so that we can use them for http testing (b822639)
+ o add a test for evhttp_connection_base_new with a dns_base (26714ca)
+ o forgot to add void to test function (78a50fe)
+ o Add a forgotten header (changelist-internal.h) (4b9f307)
+ o Remove some commented-out code in evutil (26e1b6f)
+ o Remove a needless include of rpc_compat.h (70a4a3e)
+ o Use less memory for each entry in a hashtable (a66e947)
+ o Try to untangle the logic in server_port_flush(). (439aea0)
+ o Use ev_[u]intptr_t types in place of [u]intptr_t (cef61a2)
+ o Reduce windows header includes in our own headers. (da6135e)
+ o clean up terminate_chunked test (e8a9782)
+ o Increment the submicro version number. (63e868e)
+ o Update event-config.h version number to match configure.in (aae7db5)
+ o Clean up formatting: Disallow space-before-tab. (8fdf09c)
+ o Clean up formatting: use tabs, not 8-spaces, to indent. (e5bbd40)
+ o Clean up formatting: remove trailing spaces (e5cf987)
+ o Clean up formatting: function/keyword spacing consistency. (4faeaea)
+
+
+
+Changes in 2.0.3-alpha (20 Nov 2009):
+ o Add a new code to support SSL/TLS on bufferevents, using the OpenSSL library (where available).
+ o Fix a bug where we didn't allocate enough memory in event_get_supported_methods().
+ o Avoid segfault during failed allocation of locked evdns_base. (Found by Rocco Carbone.)
+ o Export new evutil_ascii_* functions to perform locale-independent character type operations.
+ o Try to compile better with MSVC: patches from Brodie Thiesfield
+ o New evconnlistener_get_fd function to expose a listener's associated socket.
+ o Expose an ev_socklen_t type for consistent use across platforms.
+ o Make bufferevent_socket_connect() work when the original fd was -1.
+ o Fix a bug in bufferevent_socket_connect() when the connection succeeds too quickly.
+ o Export an evutil_sockaddr_cmp() to compare to sockaddr objects for equality.
+ o Add a bufferevent_get_enabled() to tell what a bufferevent has been configured to do.
+ o Add an evbuffer_search_eol() function to locate the end of a line nondestructively.
+ o Add an evbuffer_search_range() function to search a bounded range of a buffer.
+ o Fix a rare crash bug in evdns.
+ o Have bufferevent_socket_connect() with no arguments put a bufferevent into connecting mode.
+ o Support sendfile on Solaris: patch from Caitlin Mercer.
+ o New functions to explicitly reference a socket used by an evhttp object. Patches from David Reiss.
+ o When we send a BEV_EVENT_CONNECTED to indicate connected status, we no longer invoke the write callback as well unless we actually wrote data too.
+ o If the kernel tells us that there are a negative number of bytes to read from a socket, do not believe it. Fixes bug 2841177; found by Alexander Pronchenkov.
+ o Do not detect whether we have monotonic clock support every time a new event base is created: instead do it only once. Patch taken from Chromium.
+ o Do not allocate the maximum event queue for the epoll backend at startup. Instead, start out accepting 32 events at a time, and double the queue's size when it seems that the OS is generating events faster than we're requesting them. Saves up to 374K per epoll-based event_base. Resolves bug 2839240.
+ o Treat an event with a negative fd as valid but untriggerable by Libevent. This is useful for applications that want to manually activate events.
+ o Fix compilation on Android, which forgot to define fd_mask in its sys/select.h
+ o Do not drop data from evbuffer when out of memory; reported by Jacek Masiulaniec
+ o New event_base_got_exit() and event_base_got_break() functions to tell whether an event loop exited because of an event_base_loopexit() or an event_base_loopbreak(). Patch from Ka-Hing Cheung.
+ o When adding or deleting an event from a non-main thread, only wake up the main thread when its behavior actually needs to change.
+ o Fix some bugs when using the old evdns interfaces to initialize the evdns module.
+ o Detect errors during bufferevent_connect(). Patch from Christopher Davis.
+ o Fix compilation for listener.h for C++ - missing extern "C". Patch from Ferenc Szalai.
+ o Make the event_base_loop() family of functions respect thread-safety better. This should clear up a few hard-to-debug race conditions.
+ o Fix a bug when using a specialized memory allocator on win32.
+ o Have the win32 select() backend label TCP-socket-connected events as EV_WRITE, not EV_READ. This should bring it in line with the other backends, and improve portability. Patch from Christopher Davis.
+ o Stop using enums as arguments or return values when what we mean is a bitfield of enum values. C++ doesn't believe that you can OR two enum values together and get another enum, and C++ takes its typing seriously. Patch from Christopher Davis.
+ o Add an API to replace all fatal calls to exit() with a user-provided panic function.
+ o Replace all assert() calls with a variant that is aware of the user-provided logging and panic functions.
+ o Add a return value to event_assign so that it can fail rather than asserting when the user gives it bad input. event_set still dies on bad input.
+ o The event_base_new() and event_base_new_with_config() functions now never call exit() on failure. For backward "compatibility", event_init() still does, but more consistently.
+ o Remove compat/sys/_time.h. It interfered with system headers on HPUX, and its functionality has been subsumed by event2/util.h and util-internal.h.
+ o Add a new bufferevent_socket_connect_hostname() to encapsulate the resolve-then-connect operation.
+ o Build kqueue.c correctly on GNU/kFreeBSD platforms. Patch pulled upstream from Debian.
+ o Alternative queue-based timeout algorithm for programs that use a large number of timeouts with the same value.
+ o New event_base_config option to disable the timeval cache entirely.
+ o Make EV_PERSIST timeouts more accurate: schedule the next event based on the scheduled time of the previous event, not based on the current time.
+ o Allow http.c to handle cases where getaddrinfo returns an IPv6 address. Patch from Ryan Phillips.
+ o Fix a problem with excessive memory allocation when using multiple event priorities.
+ o Default to using arc4random for DNS transaction IDs on systems that have it; from OpenBSD.
+ o Never check the environment when we're running setuid or setgid; from OpenBSD.
+ o Options passed to evdns_set_option() no longer need to end with a colon.
+ o Add an evutil_getaddrinfo() function to clone getaddrinfo on platforms that don't have it.
+ o Add an evdns_getaddrinfo() function to provide a nonblocking getaddrinfo using evdns, so programs can perform useful hostname lookup.
+ o Finally expose the IOCP-based bufferevent backend. It passes its unit tests, but probably still has some bugs remaining. Code by Nick Mathewson and Christopher Davis.
+ o Numerous other bugfixes.
+ o On FreeBSD and other OSes, connect can return ECONREFUSED immediately; instead of failing the function call, pretend with faileld in the callback.
+ o Fix a race condition in the pthreads test case; found by Nick Mathewson
+ o Remove most calls to event_err() in http and deal with memory errors instead
+
+
+
+Changes in 2.0.2-alpha (25 Jul 2009):
+ o Add a new flag to bufferevents to make all callbacks automatically deferred.
+ o Make evdns functionality locked, and automatically defer dns callbacks.
+ o Fix a possible free(NULL) when freeing an event_base with no signals.
+ o Add a flag to disable checking environment varibles when making an event_base
+ o Disallow setting less than 1 priority.
+ o Fix a bug when removing a timeout from the heap. [Patch from Marko Kreen]
+ o Use signal.h, not sys/signal.h. [Patch from mmadia]
+ o Try harder to build with certain older c99 compilers.
+ o Make sure that an event_config's flags field is always initialized to 0. [Bug report from Victor Goya]
+ o Avoid data corruption when reading data entirely into the second-to-last chain of an evbuffer. [Bug report from Victor Goya]
+ o Make sendfile work on FreeBSD
+ o Do not use vararg macros for accessing evrpc structures; this is not backwards compatible, but we did not promise any backwards compatibility for the rpc code.
+ o Actually define the event_config_set_flag() function.
+ o Try harder to compile with Visual C++.
+ o Move event_set() and its allies to event2/event_compat.h where they belong.
+ o Remove the event_gotsig code, which has long been deprecated and unused.
+ o Add an event_get_base() function to return the base assigned to an event.
+ o New function to automate connecting on a socket-based bufferevent.
+ o New functions to automate listening for incoming TCP connections.
+ o Do case-insensitive checks with a locale-independent comparison function.
+ o Rename the evbuffercb and everrorcb callbacks to bufferevent_data_cb and bufferevent_event_cb respectively. The old names are available in bufferevent_compat.h.
+ o Rename the EVBUFFER_* codes used by bufferevent event callbacks to BEV_EVENT_*, to avoid namespace collision with evbuffer flags. The old names are available in bufferevent_compat.h.
+ o Move the EVBUFFER_INPUT and EVBUFFER_OUTPUT macros to bufferevent_compat.h
+ o Add a bufferevent_getfd() function to mirror bufferevent_setfd()
+ o Make bufferevent_setfd() return an error code if the operation is not successful.
+ o Shave 22 bytes off struct event on 32-bit platforms by shrinking and re-ordering fields. The savings on 64-bit platforms is likely higher.
+ o Cap the maximum number of priorities at 256.
+ o Change the semantics of evbuffer_cb_set_flags() to be set-flag only; add a new evbuffer_cb_clear_flags() to remove set flags.
+ o Change the interface of evbuffer_add_reference so that the cleanup callback gets more information
+ o Revise the new evbuffer_reserve_space/evbuffer_commit_space() interfaces so that you can use them without causing extraneous copies or leaving gaps in the evbuffer.
+ o Add a new evbuffer_peek() interface to inspect data in an evbuffer without removing it.
+ o Fix a deadlock when suspending reads in a bufferevent due to a full buffer. (Spotted by Joachim Bauch.)
+ o Fix a memory error when freeing a thread-enabled event base with registered events. (Spotted by Joachim Bauch.)
+ o Try to contain degree of failure when running on a win32 version so heavily firewalled that we can't fake a socketpair.
+ o Activate fd events in a pseudorandom order with O(N) backends, so that we don't systematically favor low fds (select) or earlier-added fds (poll, win32).
+ o Replace some read()/write() instances with send()/recv() to work properly on win32.
+ o Set truncated flag correctly in evdns server replies.
+ o Raise RpcGenError in event_rpcgen.py; from jmanison and Zack Weinberg
+ o Fix preamble of rpcgen-generated files to rely on event2 includes; based on work by jmansion; patch from Zack Weinberg.
+ o Allow specifying the output filename for rpcgen; based on work by jmansion; patch from Zack Weinberg.
+ o Allow C identifiers as struct names; allow multiple comments in .rpc files; from Zack Weinberg
+ o Mitigate a race condition when using socket bufferevents in multiple threads.
+ o Use AC_SEARCH_LIBS, not AC_CHECK_LIB to avoid needless library use.
+ o Do not allow event_del(ev) to return while that event's callback is executing in another thread. This fixes a nasty race condition.
+ o event_get_supported_methods() now lists methods that have been disabled with the EVENT_NO* environment options.
+ o Rename encode_int[64] to evtag_encode_int[64] to avoid polluting the global namespace. The old method names are still available as macros in event2/tag_compat.h.
+
+
+
+Changes in 2.0.1-alpha (17 Apr 2009):
+ o free minheap on event_base_free(); from Christopher Layne
+ o debug cleanups in signal.c; from Christopher Layne
+ o provide event_base_new() that does not set the current_base global
+ o bufferevent_write now uses a const source argument; report from Charles Kerr
+ o improve documentation on event_base_loopexit; patch from Scott Lamb
+ o New function, event_{base_}loopbreak. Like event_loopexit, it makes an event loop stop executing and return. Unlike event_loopexit, it keeps subsequent pending events from getting executed. Patch from Scott Lamb
+ o Check return value of event_add in signal.c
+ o provide event_reinit() to reintialize an event_base after fork
+ o New function event_set_mem_functinons. It allows the user to give libevent replacement functions to use for memory management in place of malloc(), free(), etc. This should be generally useful for memory instrumentation, specialized allocators, and so on.
+ o The kqueue implementation now catches signals that are raised after event_add() is called but before the event_loop() call. This makes it match the other implementations.
+ o The kqueue implementation now restores original signal handlers correctly when its signal events are removed.
+ o Check return value of event_add in signal.c
+ o Add a more powerful evbuffer_readln as a replacement for evbuffer_readline. The new function handles more newline styles, and is more useful with buffers that may contain a nul characters.
+ o Do not mangle socket handles on 64-bit windows.
+ o The configure script now takes an --enable-gcc-warnings option that turns on many optional gcc warnings. (Nick has been building with these for a while, but they might be useful to other developers.)
+ o move EV_PERSIST handling out of the event backends
+ o small improvements to evhttp documentation
+ o always generate Date and Content-Length headers for HTTP/1.1 replies
+ o set the correct event base for HTTP close events
+ o When building with GCC, use the "format" attribute to verify type correctness of calls to printf-like functions.
+ o Rewrite win32.c backend to be O(n lg n) rather than O(n^2).
+ o Removed obsoleted recalc code
+ o support for 32-bit tag numbers in rpc structures; this is wire compatible, but changes the API slightly.
+ o pull setters/getters out of RPC structures into a base class to which we just need to store a pointer; this reduces the memory footprint of these structures.
+ o prefix {encode,decode}_tag functions with evtag to avoid collisions
+ o fix a bug with event_rpcgen for integers
+ o Correctly handle DNS replies with no answers set (Fixes bug 1846282)
+ o add -Wstrict-aliasing to warnings and more cleanup
+ o removed linger from http server socket; reported by Ilya Martynov
+ o event_rpcgen now allows creating integer arrays
+ o support string arrays in event_rpcgen
+ o change evrpc hooking to allow pausing of RPCs; this will make it possible for the hook to do some meaning ful work; this is not backwards compatible.
+ o allow an http request callback to take ownership of a request structure
+ o allow association of meta data with RPC requests for hook processing
+ o associate more context for hooks to query such as the connection object
+ o remove pending timeouts on event_base_free()
+ o also check EAGAIN for Solaris' event ports; from W.C.A. Wijngaards
+ o devpoll and evport need reinit; tested by W.C.A Wijngaards
+ o event_base_get_method; from Springande Ulv
+ o Send CRLF after each chunk in HTTP output, for compliance with RFC2626. Patch from "propanbutan". Fixes bug 1894184.
+ o Add a int64_t parsing function, with unit tests, so we can apply Scott Lamb's fix to allow large HTTP values.
+ o Use a 64-bit field to hold HTTP content-lengths. Patch from Scott Lamb.
+ o Allow regression code to build even without Python installed
+ o remove NDEBUG ifdefs from evdns.c
+ o detect integer types properly on platforms without stdint.h
+ o udpate documentation of event_loop and event_base_loop; from Tani Hosokawa.
+ o simplify evbuffer by removing orig_buffer
+ o do not insert event into list when evsel->add fails
+ o add support for PUT/DELETE requests; from Josh Rotenberg
+ o introduce evhttp_accept_socket() to accept from an already created socket
+ o include Content-Length in reply for HTTP/1.0 requests with keep-alive
+ o increase listen queue for http sockets to 128; if that is not enough the evhttp_accpet_socket() api can be used with a prepared socket.
+ o Patch from Tani Hosokawa: make some functions in http.c threadsafe.
+ o test support for PUT/DELETE requests; from Josh Rotenberg
+ o rewrite of the evbuffer code to reduce memory copies
+ o Some older Solaris versions demand that _REENTRANT be defined to get strtok_r(); do so.
+ o Do not free the kqop file descriptor in other processes, also allow it to be 0; from Andrei Nigmatulin
+ o Provide OpenSSL style support for multiple threads accessing the same event_base
+ o make event_rpcgen.py generate code include event-config.h; reported by Sam Banks.
+ o switch thread support so that locks get allocated as they are needed.
+ o make event methods static so that they are not exported; from Andrei Nigmatulin
+ o make RPC replies use application/octet-stream as mime type
+ o do not delete uninitialized timeout event in evdns
+ o Correct the documentation on buffer printf functions.
+ o Don't warn on unimplemented epoll_create(): this isn't a problem, just a reason to fall back to poll or select.
+ o Correctly handle timeouts larger than 35 minutes on Linux with epoll.c. This is probably a kernel defect, but we'll have to support old kernels anyway even if it gets fixed.
+ o Make name_from_addr() threadsafe in http.c
+ o Add new thread-safe interfaces to evdns functions.
+ o Make all event_tagging interfaces threadsafe.
+ o Rename internal memory management functions.
+ o New functions (event_assign, event_new, event_free) for use by apps that want to be safely threadsafe, or want to remain ignorant of the contents of struct event.
+ o introduce bufferevent_read_buffer; allows reading without memory copy.
+ o expose bufferevent_setwatermark via header files and fix high watermark on read
+ o fix a bug in buffrevent read water marks and add a test for them
+ o fix a bug in which bufferevent_write_buffer would not schedule a write event
+ o provide bufferevent_input and bufferevent_output without requiring knowledge of the structure
+ o introduce bufferevent_setcb and bufferevent_setfd to allow better manipulation of bufferevents
+ o convert evhttp_connection to use bufferevents.
+ o use libevent's internal timercmp on all platforms, to avoid bugs on old platforms where timercmp(a,b,<=) is buggy.
+ o Remove the never-exported, never-used evhttp_hostportfile function.
+ o Support input/output filters for bufferevents; somewhat similar to libio's model. This will allow us to implement SSL, compression, etc, transparently to users of bufferevents such as the http layer.
+ o allow connections to be removed from an rpc pool
+ o add new evtimer_assign, signal_assign, evtimer_new, and signal_new functions to manipulate timer and signal events, analagous to the now-recommended event_assign and event_new
+ o switch internal uses of event_set over to use event_assign.
+ o introduce evbuffer_contiguous_space() api that tells a user how much data is available in the first buffer chain
+ o introduce evbuffer_reserve_space() and evbuffer_commit_space() to make processing in filters more efficient.
+ o reduce system calls for getting current time by caching it.
+ o separate signal events from io events; making the code less complex.
+ o support for periodic timeouts
+ o support for virtual HTTP hosts.
+ o turn event_initialized() into a function, and add function equivalents to EVENT_SIGNAL and EVENT_FD so that people don't need to include event_struct.h
+ o Build test directory correctly with CPPFLAGS set.
+ o Provide an API for retrieving the supported event mechanisms.
+ o event_base_new_with_config() and corresponding config APIs.
+ o migrate the evhttp header to event2/ but accessors are still missing.
+ o deprecate timeout_* event functions by moving them to event_compat.h
+ o Move windows gettimeofday replacement into a new evutil_gettimeofday().
+ o Make configure script work on IRIX.
+ o provide a method for canceling ongoing http requests.
+ o Make vsnprintf() returns consistent on win32.
+ o Fix connection keep-alive behavior for HTTP/1.0
+ o Fix use of freed memory in event_reinit; pointed out by Peter Postma
+ o constify struct timeval * where possible
+ o make event_get_supported_methods obey environment variables
+ o support for edge-triggered events on epoll and kqueue backends: patch from Valery Kholodkov
+ o support for selecting event backends by their features, and for querying the features of a backend.
+ o change failing behavior of event_base_new_with_config: if a config is provided and no backend is selected, return NULL instead of aborting.
+ o deliver partial data to request callbacks when chunked callback is set even if there is no chunking on the http level; allows cancelation of requests from within the chunked callback; from Scott Lamb.
+ o allow min_heap_erase to be called on removed members; from liusifan.
+ o Rename INPUT and OUTPUT to EVRPC_INPUT and EVRPC_OUTPUT. Retain INPUT/OUTPUT aliases on on-win32 platforms for backwards compatibility.
+ o Do not use SO_REUSEADDR when connecting
+ o Support 64-bit integers in RPC structs
+ o Correct handling of trailing headers in chunked replies; from Scott Lamb.
+ o Support multi-line HTTP headers; based on a patch from Moshe Litvin
+ o Reject negative Content-Length headers; anonymous bug report
+ o Detect CLOCK_MONOTONIC at runtime for evdns; anonymous bug report
+ o Various HTTP correctness fixes from Scott Lamb
+ o Fix a bug where deleting signals with the kqueue backend would cause subsequent adds to fail
+ o Support multiple events listening on the same signal; make signals regular events that go on the same event queue; problem report by Alexander Drozdov.
+ o Fix a problem with epoll() and reinit; problem report by Alexander Drozdov.
+ o Fix off-by-one errors in devpoll; from Ian Bell
+ o Make event_add not change any state if it fails; reported by Ian Bell.
+ o Fix a bug where headers arriving in multiple packets were not parsed; fix from Jiang Hong; test by me.
+ o Match the query in DNS replies to the query in the request; from Vsevolod Stakhov.
+ o Add new utility functions to correctly observe and log winsock errors.
+ o Do not remove Accept-Encoding header
+ o Clear the timer cache on entering the event loop; reported by Victor Chang
+ o Only bind the socket on connect when a local address has been provided; reported by Alejo Sanchez
+ o Allow setting of local port for evhttp connections to support millions of connections from a single system; from Richard Jones.
+ o Clear the timer cache when leaving the event loop; reported by Robin Haberkorn
+ o Fix a typo in setting the global event base; reported by lance.
+ o Set the 0x20 bit on outgoing alphabetic characters in DNS requests randomly, and insist on a match in replies. This helps resist DNS poisoning attacks.
+ o Make the http connection close detection work properly with bufferevents and fix a potential memory leak associated with it.
+ o Restructure the event backends so that they do not need to keep track of events themselves, as a side effect multiple events can use the same fd or signal.
+ o Add generic implementations for parsing and emiting IPv6 addresses on platforms that do not have inet_ntop and/or inet_pton.
+ o Allow DNS servers that have IPv6 addresses.
+ o Add an evbuffer_write_atmost() function to write a limited number of bytes to an fd.
+ o Refactor internal notify-main-thread logic to prefer eventfd to pipe, then pipe to socketpair, and only use socketpairs as a last resort.
+ o Try harder to pack all evbuffer reads into as few chains as possible, using readv/WSARecv as appropriate.
+ o New evthread_use_windows_threads() and evthread_use_pthreads() functions to set up the evthread callbacks with reasonable defaults.
+ o Change the semantics of timeouts in conjunction with EV_PERSIST; timeouts in that case will now repeat until deleted.
+ o sendfile, mmap and memory reference support for evbuffers.
+ o New evutil_make_listen_socket_reuseable() to abstract SO_REUSEADDR.
+ o New bind-to option to allow DNS clients to bind to an arbitrary port for outgoing requests.
+ o evbuffers can now be "frozen" to prevent operations at one or both ends.
+ o Bufferevents now notice external attempts to add data to an inbuf or remove it from an outbuf, and stop them.
+ o Fix parsing of queries where the encoded queries contained \r, \n or +
+ o Do not allow internal events to starve lower-priority events.
+
diff --git a/contrib/libs/libevent/LICENSE b/contrib/libs/libevent/LICENSE
index 402ca50896..280d3d18ba 100644
--- a/contrib/libs/libevent/LICENSE
+++ b/contrib/libs/libevent/LICENSE
@@ -72,28 +72,28 @@ The arc4module is available under the following, sometimes called the
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-==============================
-
-The Windows timer code is based on code from libutp, which is
-distributed under this license, sometimes called the "MIT" license.
-
-
-Copyright (c) 2010 BitTorrent, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+==============================
+
+The Windows timer code is based on code from libutp, which is
+distributed under this license, sometimes called the "MIT" license.
+
+
+Copyright (c) 2010 BitTorrent, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/contrib/libs/libevent/README.md b/contrib/libs/libevent/README.md
index 1247e220f5..3482f71ce0 100644
--- a/contrib/libs/libevent/README.md
+++ b/contrib/libs/libevent/README.md
@@ -1,469 +1,469 @@
-<p align="center">
- <img src="https://strcpy.net/libevent3.png" alt="libevent logo"/>
-</p>
-
-
-
-[![Appveyor Win32 Build Status](https://ci.appveyor.com/api/projects/status/ng3jg0uhy44mp7ik?svg=true)](https://ci.appveyor.com/project/libevent/libevent)
-[![Travis Build Status](https://travis-ci.org/libevent/libevent.svg?branch=master)](https://travis-ci.org/libevent/libevent)
-[![Coverage Status](https://coveralls.io/repos/github/libevent/libevent/badge.svg)](https://coveralls.io/github/libevent/libevent)
-[![Join the chat at https://gitter.im/libevent/libevent](https://badges.gitter.im/libevent/libevent.svg)](https://gitter.im/libevent/libevent?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-
-
-
-# 0. BUILDING AND INSTALLATION (Briefly)
-
-## Autoconf
-
- $ ./configure
- $ make
- $ make verify # (optional)
- $ sudo make install
-
-## CMake (General)
-
-
-The following Libevent specific CMake variables are as follows (the values being
-the default).
-
-```
-# Type of the library to build (SHARED or STATIC)
-# Default is: SHARED for MSVC, otherwise BOTH
-EVENT__LIBRARY_TYPE:STRING=DEFAULT
-
-# Installation directory for CMake files
-EVENT_INSTALL_CMAKE_DIR:PATH=lib/cmake/libevent
-
-# Enable running gcov to get a test coverage report (only works with
-# GCC/CLang). Make sure to enable -DCMAKE_BUILD_TYPE=Debug as well.
-EVENT__COVERAGE:BOOL=OFF
-
-# Defines if Libevent should build without the benchmark executables
-EVENT__DISABLE_BENCHMARK:BOOL=OFF
-
-# Define if Libevent should build without support for a debug mode
-EVENT__DISABLE_DEBUG_MODE:BOOL=OFF
-
-# Define if Libevent should not allow replacing the mm functions
-EVENT__DISABLE_MM_REPLACEMENT:BOOL=OFF
-
-# Define if Libevent should build without support for OpenSSL encryption
-EVENT__DISABLE_OPENSSL:BOOL=OFF
-
-# Disable the regress tests
-EVENT__DISABLE_REGRESS:BOOL=OFF
-
-# Disable sample files
-EVENT__DISABLE_SAMPLES:BOOL=OFF
-
-# If tests should be compiled or not
-EVENT__DISABLE_TESTS:BOOL=OFF
-
-# Define if Libevent should not be compiled with thread support
-EVENT__DISABLE_THREAD_SUPPORT:BOOL=OFF
-
-# Enables verbose debugging
-EVENT__ENABLE_VERBOSE_DEBUG:BOOL=OFF
-
-# When cross compiling, forces running a test program that verifies that Kqueue
-# works with pipes. Note that this requires you to manually run the test program
-# on the the cross compilation target to verify that it works. See CMake
-# documentation for try_run for more details
-EVENT__FORCE_KQUEUE_CHECK:BOOL=OFF
-```
-
-__More variables can be found by running `cmake -LAH <sourcedir_path>`__
-
-
-## CMake (Windows)
-
-Install CMake: <https://www.cmake.org>
-
-
- $ md build && cd build
- $ cmake -G "Visual Studio 10" .. # Or whatever generator you want to use cmake --help for a list.
- $ start libevent.sln
-
-## CMake (Unix)
-
- $ mkdir build && cd build
- $ cmake .. # Default to Unix Makefiles.
- $ make
- $ make verify # (optional)
-
-
-# 1. BUILDING AND INSTALLATION (In Depth)
-
-## Autoconf
-
-To build Libevent, type
-
- $ ./configure && make
-
-
- (If you got Libevent from the git repository, you will
- first need to run the included "autogen.sh" script in order to
- generate the configure script.)
-
-You can run the regression tests by running
-
- $ make verify
-
-Install as root via
-
- $ make install
-
-Before reporting any problems, please run the regression tests.
-
-To enable low-level tracing, build the library as:
-
- $ CFLAGS=-DUSE_DEBUG ./configure [...]
-
-Standard configure flags should work. In particular, see:
-
- --disable-shared Only build static libraries.
- --prefix Install all files relative to this directory.
-
-
-The configure script also supports the following flags:
-
- --enable-gcc-warnings Enable extra compiler checking with GCC.
- --disable-malloc-replacement
- Don't let applications replace our memory
- management functions.
- --disable-openssl Disable support for OpenSSL encryption.
- --disable-thread-support Don't support multithreaded environments.
-
-## CMake (Windows)
-
-(Note that autoconf is currently the most mature and supported build
-environment for Libevent; the CMake instructions here are new and
-experimental, though they _should_ be solid. We hope that CMake will
-still be supported in future versions of Libevent, and will try to
-make sure that happens.)
-
-First of all install <https://www.cmake.org>.
-
-To build Libevent using Microsoft Visual studio open the "Visual Studio Command prompt" and type:
-
-```
-$ cd <libevent source dir>
-$ mkdir build && cd build
-$ cmake -G "Visual Studio 10" .. # Or whatever generator you want to use cmake --help for a list.
-$ start libevent.sln
-```
-
-In the above, the ".." refers to the dir containing the Libevent source code.
-You can build multiple versions (with different compile time settings) from the same source tree
-by creating other build directories.
-
-It is highly recommended to build "out of source" when using
-CMake instead of "in source" like the normal behaviour of autoconf for this reason.
-
-The "NMake Makefiles" CMake generator can be used to build entirely via the command line.
-
-To get a list of settings available for the project you can type:
-
-```
-$ cmake -LH ..
-```
-
-### GUI
-
-CMake also provides a GUI that lets you specify the source directory and output (binary) directory
-that the build should be placed in.
-
-# 2. USEFUL LINKS:
-
-For the latest released version of Libevent, see the official website at
-<http://libevent.org/> .
-
-There's a pretty good work-in-progress manual up at
- <http://www.wangafu.net/~nickm/libevent-book/> .
-
-For the latest development versions of Libevent, access our Git repository
-via
-
-```
-$ git clone https://github.com/libevent/libevent.git
-```
-
-You can browse the git repository online at:
-
-<https://github.com/libevent/libevent>
-
-To report bugs, issues, or ask for new features:
-
-__Patches__: https://github.com/libevent/libevent/pulls
-> OK, those are not really _patches_. You fork, modify, and hit the "Create Pull Request" button.
-> You can still submit normal git patches via the mailing list.
-
-__Bugs, Features [RFC], and Issues__: https://github.com/libevent/libevent/issues
-> Or you can do it via the mailing list.
-
-There's also a libevent-users mailing list for talking about Libevent
-use and development:
-
-<http://archives.seul.org/libevent/users/>
-
-# 3. ACKNOWLEDGMENTS
-
-The following people have helped with suggestions, ideas, code or
-fixing bugs:
-
- * Samy Al Bahra
- * Antony Antony
- * Jacob Appelbaum
- * Arno Bakker
- * Weston Andros Adamson
- * William Ahern
- * Ivan Andropov
- * Sergey Avseyev
- * Avi Bab
- * Joachim Bauch
- * Andrey Belobrov
- * Gilad Benjamini
- * Stas Bekman
- * Denis Bilenko
- * Julien Blache
- * Kevin Bowling
- * Tomash Brechko
- * Kelly Brock
- * Ralph Castain
- * Adrian Chadd
- * Lawnstein Chan
- * Shuo Chen
- * Ka-Hing Cheung
- * Andrew Cox
- * Paul Croome
- * George Danchev
- * Andrew Danforth
- * Ed Day
- * Christopher Davis
- * Mike Davis
- * Frank Denis
- * Antony Dovgal
- * Mihai Draghicioiu
- * Alexander Drozdov
- * Mark Ellzey
- * Shie Erlich
- * Leonid Evdokimov
- * Juan Pablo Fernandez
- * Christophe Fillot
- * Mike Frysinger
- * Remi Gacogne
- * Artem Germanov
- * Alexander von Gernler
- * Diego Giagio
- * Artur Grabowski
- * Diwaker Gupta
- * Kuldeep Gupta
- * Sebastian Hahn
- * Dave Hart
- * Greg Hazel
- * Nicholas Heath
- * Michael Herf
- * Savg He
- * Mark Heily
- * Maxime Henrion
- * Michael Herf
- * Greg Hewgill
- * Andrew Hochhaus
- * Aaron Hopkins
- * Tani Hosokawa
- * Jamie Iles
- * Xiuqiang Jiang
- * Claudio Jeker
- * Evan Jones
- * Marcin Juszkiewicz
- * George Kadianakis
- * Makoto Kato
- * Phua Keat
- * Azat Khuzhin
- * Alexander Klauer
- * Kevin Ko
- * Brian Koehmstedt
- * Marko Kreen
- * Ondřej Kuzník
- * Valery Kyholodov
- * Ross Lagerwall
- * Scott Lamb
- * Christopher Layne
- * Adam Langley
- * Graham Leggett
- * Volker Lendecke
- * Philip Lewis
- * Zhou Li
- * David Libenzi
- * Yan Lin
- * Moshe Litvin
- * Simon Liu
- * Mitchell Livingston
- * Hagne Mahre
- * Lubomir Marinov
- * Abilio Marques
- * Nicolas Martyanoff
- * Abel Mathew
- * Nick Mathewson
- * James Mansion
- * Nicholas Marriott
- * Andrey Matveev
- * Caitlin Mercer
- * Dagobert Michelsen
- * Andrea Montefusco
- * Mansour Moufid
- * Mina Naguib
- * Felix Nawothnig
- * Trond Norbye
- * Linus Nordberg
- * Richard Nyberg
- * Jon Oberheide
- * John Ohl
- * Phil Oleson
- * Alexey Ozeritsky
- * Dave Pacheco
- * Derrick Pallas
- * Tassilo von Parseval
- * Catalin Patulea
- * Patrick Pelletier
- * Simon Perreault
- * Dan Petro
- * Pierre Phaneuf
- * Amarin Phaosawasdi
- * Ryan Phillips
- * Dimitre Piskyulev
- * Pavel Plesov
- * Jon Poland
- * Roman Puls
- * Nate R
- * Robert Ransom
- * Balint Reczey
- * Bert JW Regeer
- * Nate Rosenblum
- * Peter Rosin
- * Maseeb Abdul Qadir
- * Wang Qin
- * Alex S
- * Gyepi Sam
- * Hanna Schroeter
- * Ralf Schmitt
- * Mike Smellie
- * Steve Snyder
- * Nir Soffer
- * Dug Song
- * Dongsheng Song
- * Hannes Sowa
- * Joakim Soderberg
- * Joseph Spadavecchia
- * Kevin Springborn
- * Harlan Stenn
- * Andrew Sweeney
- * Ferenc Szalai
- * Brodie Thiesfield
- * Jason Toffaletti
- * Brian Utterback
- * Gisle Vanem
- * Bas Verhoeven
- * Constantine Verutin
- * Colin Watt
- * Zack Weinberg
- * Jardel Weyrich
- * Jay R. Wren
- * Zack Weinberg
- * Mobai Zhang
- * Alejo
- * Alex
- * Taral
- * propanbutan
- * masksqwe
- * mmadia
- * yangacer
- * Andrey Skriabin
- * basavesh.as
- * billsegall
- * Bill Vaughan
- * Christopher Wiley
- * David Paschich
- * Ed Schouten
- * Eduardo Panisset
- * Jan Heylen
- * jer-gentoo
- * Joakim Söderberg
- * kirillDanshin
- * lzmths
- * Marcus Sundberg
- * Mark Mentovai
- * Mattes D
- * Matyas Dolak
- * Neeraj Badlani
- * Nick Mathewson
- * Rainer Keller
- * Seungmo Koo
- * Thomas Bernard
- * Xiao Bao Clark
- * zeliard
- * Zonr Chang
- * Kurt Roeckx
- * Seven
- * Simone Basso
- * Vlad Shcherban
- * Tim Hentenaar
- * Breaker
- * johnsonlee
- * Philip Prindeville
- * Vis Virial
- * Andreas Gustafsson
- * Andrey Okoshkin
- * an-tao
- * baixiangcpp
- * Bernard Spil
- * Bogdan Harjoc
- * Carlo Marcelo Arenas Belón
- * David Benjamin
- * David Disseldorp
- * Dmitry Alimov
- * Dominic Chen
- * dpayne
- * ejurgensen
- * Fredrik Strupe
- * Gonçalo Ribeiro
- * James Synge
- * Jan Beich
- * Jesse Fang
- * Jiri Luznicky
- * José Luis Millán
- * Kiyoshi Aman
- * Leo Zhang
- * lightningkay
- * Luke Dashjr
- * Marcin Szewczyk
- * Maximilian Brunner
- * Maya Rashish
- * Murat Demirten
- * Nathan French
- * Nikolay Edigaryev
- * Philip Herron
- * Redfoxmoon
- * stenn
- * SuckShit
- * The Gitter Badger
- * tim-le
- * Vincent JARDIN
- * Xiang Zhang
- * Xiaozhou Liu
- * yongqing.jiao
- * Enji Cooper
- * linxiaohui
- * Seong-Joong Kim
- * Tobias Stoeckmann
- * Yury Korzhetsky
- * zhuizhuhaomeng
- * Pierce Lopez
- * yuangongji
- * Keith Smiley
- * jeremyerb
- * Fabrice Fontaine
- * wenyg
+<p align="center">
+ <img src="https://strcpy.net/libevent3.png" alt="libevent logo"/>
+</p>
+
+
+
+[![Appveyor Win32 Build Status](https://ci.appveyor.com/api/projects/status/ng3jg0uhy44mp7ik?svg=true)](https://ci.appveyor.com/project/libevent/libevent)
+[![Travis Build Status](https://travis-ci.org/libevent/libevent.svg?branch=master)](https://travis-ci.org/libevent/libevent)
+[![Coverage Status](https://coveralls.io/repos/github/libevent/libevent/badge.svg)](https://coveralls.io/github/libevent/libevent)
+[![Join the chat at https://gitter.im/libevent/libevent](https://badges.gitter.im/libevent/libevent.svg)](https://gitter.im/libevent/libevent?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
+
+
+# 0. BUILDING AND INSTALLATION (Briefly)
+
+## Autoconf
+
+ $ ./configure
+ $ make
+ $ make verify # (optional)
+ $ sudo make install
+
+## CMake (General)
+
+
+The following Libevent specific CMake variables are as follows (the values being
+the default).
+
+```
+# Type of the library to build (SHARED or STATIC)
+# Default is: SHARED for MSVC, otherwise BOTH
+EVENT__LIBRARY_TYPE:STRING=DEFAULT
+
+# Installation directory for CMake files
+EVENT_INSTALL_CMAKE_DIR:PATH=lib/cmake/libevent
+
+# Enable running gcov to get a test coverage report (only works with
+# GCC/CLang). Make sure to enable -DCMAKE_BUILD_TYPE=Debug as well.
+EVENT__COVERAGE:BOOL=OFF
+
+# Defines if Libevent should build without the benchmark executables
+EVENT__DISABLE_BENCHMARK:BOOL=OFF
+
+# Define if Libevent should build without support for a debug mode
+EVENT__DISABLE_DEBUG_MODE:BOOL=OFF
+
+# Define if Libevent should not allow replacing the mm functions
+EVENT__DISABLE_MM_REPLACEMENT:BOOL=OFF
+
+# Define if Libevent should build without support for OpenSSL encryption
+EVENT__DISABLE_OPENSSL:BOOL=OFF
+
+# Disable the regress tests
+EVENT__DISABLE_REGRESS:BOOL=OFF
+
+# Disable sample files
+EVENT__DISABLE_SAMPLES:BOOL=OFF
+
+# If tests should be compiled or not
+EVENT__DISABLE_TESTS:BOOL=OFF
+
+# Define if Libevent should not be compiled with thread support
+EVENT__DISABLE_THREAD_SUPPORT:BOOL=OFF
+
+# Enables verbose debugging
+EVENT__ENABLE_VERBOSE_DEBUG:BOOL=OFF
+
+# When cross compiling, forces running a test program that verifies that Kqueue
+# works with pipes. Note that this requires you to manually run the test program
+# on the the cross compilation target to verify that it works. See CMake
+# documentation for try_run for more details
+EVENT__FORCE_KQUEUE_CHECK:BOOL=OFF
+```
+
+__More variables can be found by running `cmake -LAH <sourcedir_path>`__
+
+
+## CMake (Windows)
+
+Install CMake: <https://www.cmake.org>
+
+
+ $ md build && cd build
+ $ cmake -G "Visual Studio 10" .. # Or whatever generator you want to use cmake --help for a list.
+ $ start libevent.sln
+
+## CMake (Unix)
+
+ $ mkdir build && cd build
+ $ cmake .. # Default to Unix Makefiles.
+ $ make
+ $ make verify # (optional)
+
+
+# 1. BUILDING AND INSTALLATION (In Depth)
+
+## Autoconf
+
+To build Libevent, type
+
+ $ ./configure && make
+
+
+ (If you got Libevent from the git repository, you will
+ first need to run the included "autogen.sh" script in order to
+ generate the configure script.)
+
+You can run the regression tests by running
+
+ $ make verify
+
+Install as root via
+
+ $ make install
+
+Before reporting any problems, please run the regression tests.
+
+To enable low-level tracing, build the library as:
+
+ $ CFLAGS=-DUSE_DEBUG ./configure [...]
+
+Standard configure flags should work. In particular, see:
+
+ --disable-shared Only build static libraries.
+ --prefix Install all files relative to this directory.
+
+
+The configure script also supports the following flags:
+
+ --enable-gcc-warnings Enable extra compiler checking with GCC.
+ --disable-malloc-replacement
+ Don't let applications replace our memory
+ management functions.
+ --disable-openssl Disable support for OpenSSL encryption.
+ --disable-thread-support Don't support multithreaded environments.
+
+## CMake (Windows)
+
+(Note that autoconf is currently the most mature and supported build
+environment for Libevent; the CMake instructions here are new and
+experimental, though they _should_ be solid. We hope that CMake will
+still be supported in future versions of Libevent, and will try to
+make sure that happens.)
+
+First of all install <https://www.cmake.org>.
+
+To build Libevent using Microsoft Visual studio open the "Visual Studio Command prompt" and type:
+
+```
+$ cd <libevent source dir>
+$ mkdir build && cd build
+$ cmake -G "Visual Studio 10" .. # Or whatever generator you want to use cmake --help for a list.
+$ start libevent.sln
+```
+
+In the above, the ".." refers to the dir containing the Libevent source code.
+You can build multiple versions (with different compile time settings) from the same source tree
+by creating other build directories.
+
+It is highly recommended to build "out of source" when using
+CMake instead of "in source" like the normal behaviour of autoconf for this reason.
+
+The "NMake Makefiles" CMake generator can be used to build entirely via the command line.
+
+To get a list of settings available for the project you can type:
+
+```
+$ cmake -LH ..
+```
+
+### GUI
+
+CMake also provides a GUI that lets you specify the source directory and output (binary) directory
+that the build should be placed in.
+
+# 2. USEFUL LINKS:
+
+For the latest released version of Libevent, see the official website at
+<http://libevent.org/> .
+
+There's a pretty good work-in-progress manual up at
+ <http://www.wangafu.net/~nickm/libevent-book/> .
+
+For the latest development versions of Libevent, access our Git repository
+via
+
+```
+$ git clone https://github.com/libevent/libevent.git
+```
+
+You can browse the git repository online at:
+
+<https://github.com/libevent/libevent>
+
+To report bugs, issues, or ask for new features:
+
+__Patches__: https://github.com/libevent/libevent/pulls
+> OK, those are not really _patches_. You fork, modify, and hit the "Create Pull Request" button.
+> You can still submit normal git patches via the mailing list.
+
+__Bugs, Features [RFC], and Issues__: https://github.com/libevent/libevent/issues
+> Or you can do it via the mailing list.
+
+There's also a libevent-users mailing list for talking about Libevent
+use and development:
+
+<http://archives.seul.org/libevent/users/>
+
+# 3. ACKNOWLEDGMENTS
+
+The following people have helped with suggestions, ideas, code or
+fixing bugs:
+
+ * Samy Al Bahra
+ * Antony Antony
+ * Jacob Appelbaum
+ * Arno Bakker
+ * Weston Andros Adamson
+ * William Ahern
+ * Ivan Andropov
+ * Sergey Avseyev
+ * Avi Bab
+ * Joachim Bauch
+ * Andrey Belobrov
+ * Gilad Benjamini
+ * Stas Bekman
+ * Denis Bilenko
+ * Julien Blache
+ * Kevin Bowling
+ * Tomash Brechko
+ * Kelly Brock
+ * Ralph Castain
+ * Adrian Chadd
+ * Lawnstein Chan
+ * Shuo Chen
+ * Ka-Hing Cheung
+ * Andrew Cox
+ * Paul Croome
+ * George Danchev
+ * Andrew Danforth
+ * Ed Day
+ * Christopher Davis
+ * Mike Davis
+ * Frank Denis
+ * Antony Dovgal
+ * Mihai Draghicioiu
+ * Alexander Drozdov
+ * Mark Ellzey
+ * Shie Erlich
+ * Leonid Evdokimov
+ * Juan Pablo Fernandez
+ * Christophe Fillot
+ * Mike Frysinger
+ * Remi Gacogne
+ * Artem Germanov
+ * Alexander von Gernler
+ * Diego Giagio
+ * Artur Grabowski
+ * Diwaker Gupta
+ * Kuldeep Gupta
+ * Sebastian Hahn
+ * Dave Hart
+ * Greg Hazel
+ * Nicholas Heath
+ * Michael Herf
+ * Savg He
+ * Mark Heily
+ * Maxime Henrion
+ * Michael Herf
+ * Greg Hewgill
+ * Andrew Hochhaus
+ * Aaron Hopkins
+ * Tani Hosokawa
+ * Jamie Iles
+ * Xiuqiang Jiang
+ * Claudio Jeker
+ * Evan Jones
+ * Marcin Juszkiewicz
+ * George Kadianakis
+ * Makoto Kato
+ * Phua Keat
+ * Azat Khuzhin
+ * Alexander Klauer
+ * Kevin Ko
+ * Brian Koehmstedt
+ * Marko Kreen
+ * Ondřej Kuzník
+ * Valery Kyholodov
+ * Ross Lagerwall
+ * Scott Lamb
+ * Christopher Layne
+ * Adam Langley
+ * Graham Leggett
+ * Volker Lendecke
+ * Philip Lewis
+ * Zhou Li
+ * David Libenzi
+ * Yan Lin
+ * Moshe Litvin
+ * Simon Liu
+ * Mitchell Livingston
+ * Hagne Mahre
+ * Lubomir Marinov
+ * Abilio Marques
+ * Nicolas Martyanoff
+ * Abel Mathew
+ * Nick Mathewson
+ * James Mansion
+ * Nicholas Marriott
+ * Andrey Matveev
+ * Caitlin Mercer
+ * Dagobert Michelsen
+ * Andrea Montefusco
+ * Mansour Moufid
+ * Mina Naguib
+ * Felix Nawothnig
+ * Trond Norbye
+ * Linus Nordberg
+ * Richard Nyberg
+ * Jon Oberheide
+ * John Ohl
+ * Phil Oleson
+ * Alexey Ozeritsky
+ * Dave Pacheco
+ * Derrick Pallas
+ * Tassilo von Parseval
+ * Catalin Patulea
+ * Patrick Pelletier
+ * Simon Perreault
+ * Dan Petro
+ * Pierre Phaneuf
+ * Amarin Phaosawasdi
+ * Ryan Phillips
+ * Dimitre Piskyulev
+ * Pavel Plesov
+ * Jon Poland
+ * Roman Puls
+ * Nate R
+ * Robert Ransom
+ * Balint Reczey
+ * Bert JW Regeer
+ * Nate Rosenblum
+ * Peter Rosin
+ * Maseeb Abdul Qadir
+ * Wang Qin
+ * Alex S
+ * Gyepi Sam
+ * Hanna Schroeter
+ * Ralf Schmitt
+ * Mike Smellie
+ * Steve Snyder
+ * Nir Soffer
+ * Dug Song
+ * Dongsheng Song
+ * Hannes Sowa
+ * Joakim Soderberg
+ * Joseph Spadavecchia
+ * Kevin Springborn
+ * Harlan Stenn
+ * Andrew Sweeney
+ * Ferenc Szalai
+ * Brodie Thiesfield
+ * Jason Toffaletti
+ * Brian Utterback
+ * Gisle Vanem
+ * Bas Verhoeven
+ * Constantine Verutin
+ * Colin Watt
+ * Zack Weinberg
+ * Jardel Weyrich
+ * Jay R. Wren
+ * Zack Weinberg
+ * Mobai Zhang
+ * Alejo
+ * Alex
+ * Taral
+ * propanbutan
+ * masksqwe
+ * mmadia
+ * yangacer
+ * Andrey Skriabin
+ * basavesh.as
+ * billsegall
+ * Bill Vaughan
+ * Christopher Wiley
+ * David Paschich
+ * Ed Schouten
+ * Eduardo Panisset
+ * Jan Heylen
+ * jer-gentoo
+ * Joakim Söderberg
+ * kirillDanshin
+ * lzmths
+ * Marcus Sundberg
+ * Mark Mentovai
+ * Mattes D
+ * Matyas Dolak
+ * Neeraj Badlani
+ * Nick Mathewson
+ * Rainer Keller
+ * Seungmo Koo
+ * Thomas Bernard
+ * Xiao Bao Clark
+ * zeliard
+ * Zonr Chang
+ * Kurt Roeckx
+ * Seven
+ * Simone Basso
+ * Vlad Shcherban
+ * Tim Hentenaar
+ * Breaker
+ * johnsonlee
+ * Philip Prindeville
+ * Vis Virial
+ * Andreas Gustafsson
+ * Andrey Okoshkin
+ * an-tao
+ * baixiangcpp
+ * Bernard Spil
+ * Bogdan Harjoc
+ * Carlo Marcelo Arenas Belón
+ * David Benjamin
+ * David Disseldorp
+ * Dmitry Alimov
+ * Dominic Chen
+ * dpayne
+ * ejurgensen
+ * Fredrik Strupe
+ * Gonçalo Ribeiro
+ * James Synge
+ * Jan Beich
+ * Jesse Fang
+ * Jiri Luznicky
+ * José Luis Millán
+ * Kiyoshi Aman
+ * Leo Zhang
+ * lightningkay
+ * Luke Dashjr
+ * Marcin Szewczyk
+ * Maximilian Brunner
+ * Maya Rashish
+ * Murat Demirten
+ * Nathan French
+ * Nikolay Edigaryev
+ * Philip Herron
+ * Redfoxmoon
+ * stenn
+ * SuckShit
+ * The Gitter Badger
+ * tim-le
+ * Vincent JARDIN
+ * Xiang Zhang
+ * Xiaozhou Liu
+ * yongqing.jiao
+ * Enji Cooper
+ * linxiaohui
+ * Seong-Joong Kim
+ * Tobias Stoeckmann
+ * Yury Korzhetsky
+ * zhuizhuhaomeng
+ * Pierce Lopez
+ * yuangongji
+ * Keith Smiley
+ * jeremyerb
+ * Fabrice Fontaine
+ * wenyg
* Aleksandr-Melnikov
* ayuseleznev
* chenguolong
@@ -482,6 +482,6 @@ fixing bugs:
* Wataru Ashihara
* William A Rowe Jr
* yangyongsheng
-
-
-If we have forgotten your name, please contact us.
+
+
+If we have forgotten your name, please contact us.
diff --git a/contrib/libs/libevent/arc4random.c b/contrib/libs/libevent/arc4random.c
index 8729f6b92f..e8fbd1661f 100644
--- a/contrib/libs/libevent/arc4random.c
+++ b/contrib/libs/libevent/arc4random.c
@@ -50,17 +50,17 @@
#endif
#ifndef ARC4RANDOM_NO_INCLUDES
-#include "evconfig-private.h"
-#ifdef _WIN32
+#include "evconfig-private.h"
+#ifdef _WIN32
#include <wincrypt.h>
#include <process.h>
-#include <winerror.h>
+#include <winerror.h>
#else
#include <fcntl.h>
#include <unistd.h>
#include <sys/param.h>
#include <sys/time.h>
-#ifdef EVENT__HAVE_SYS_SYSCTL_H
+#ifdef EVENT__HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
#endif
#ifdef EVENT__HAVE_SYS_RANDOM_H
@@ -84,7 +84,7 @@ struct arc4_stream {
unsigned char s[256];
};
-#ifdef _WIN32
+#ifdef _WIN32
#define getpid _getpid
#define pid_t int
#endif
@@ -124,7 +124,7 @@ arc4_addrandom(const unsigned char *dat, int datlen)
rs.j = rs.i;
}
-#ifndef _WIN32
+#ifndef _WIN32
static ssize_t
read_all(int fd, unsigned char *buf, size_t count)
{
@@ -144,7 +144,7 @@ read_all(int fd, unsigned char *buf, size_t count)
}
#endif
-#ifdef _WIN32
+#ifdef _WIN32
#define TRY_SEED_WIN32
static int
arc4_seed_win32(void)
@@ -202,7 +202,7 @@ arc4_seed_getrandom(void)
#endif /* EVENT__HAVE_GETRANDOM */
#if defined(EVENT__HAVE_SYS_SYSCTL_H) && defined(EVENT__HAVE_SYSCTL)
-#if EVENT__HAVE_DECL_CTL_KERN && EVENT__HAVE_DECL_KERN_ARND
+#if EVENT__HAVE_DECL_CTL_KERN && EVENT__HAVE_DECL_KERN_ARND
#define TRY_SEED_SYSCTL_BSD
static int
arc4_seed_sysctl_bsd(void)
@@ -240,7 +240,7 @@ arc4_seed_sysctl_bsd(void)
return 0;
}
#endif
-#endif /* defined(EVENT__HAVE_SYS_SYSCTL_H) */
+#endif /* defined(EVENT__HAVE_SYS_SYSCTL_H) */
#ifdef __linux__
#define TRY_SEED_PROC_SYS_KERNEL_RANDOM_UUID
@@ -256,7 +256,7 @@ arc4_seed_proc_sys_kernel_random_uuid(void)
unsigned char entropy[64];
int bytes, n, i, nybbles;
for (bytes = 0; bytes<ADD_ENTROPY; ) {
- fd = evutil_open_closeonexec_("/proc/sys/kernel/random/uuid", O_RDONLY, 0);
+ fd = evutil_open_closeonexec_("/proc/sys/kernel/random/uuid", O_RDONLY, 0);
if (fd < 0)
return -1;
n = read(fd, buf, sizeof(buf));
@@ -265,8 +265,8 @@ arc4_seed_proc_sys_kernel_random_uuid(void)
return -1;
memset(entropy, 0, sizeof(entropy));
for (i=nybbles=0; i<n; ++i) {
- if (EVUTIL_ISXDIGIT_(buf[i])) {
- int nyb = evutil_hex_char_to_int_(buf[i]);
+ if (EVUTIL_ISXDIGIT_(buf[i])) {
+ int nyb = evutil_hex_char_to_int_(buf[i]);
if (nybbles & 1) {
entropy[nybbles/2] |= nyb;
} else {
@@ -286,7 +286,7 @@ arc4_seed_proc_sys_kernel_random_uuid(void)
}
#endif
-#ifndef _WIN32
+#ifndef _WIN32
#define TRY_SEED_URANDOM
static char *arc4random_urandom_filename = NULL;
@@ -296,7 +296,7 @@ static int arc4_seed_urandom_helper_(const char *fname)
int fd;
size_t n;
- fd = evutil_open_closeonexec_(fname, O_RDONLY, 0);
+ fd = evutil_open_closeonexec_(fname, O_RDONLY, 0);
if (fd<0)
return -1;
n = read_all(fd, buf, sizeof(buf));
@@ -370,7 +370,7 @@ arc4_stir(void)
rs_initialized = 1;
}
- if (0 != arc4_seed())
+ if (0 != arc4_seed())
return -1;
/*
@@ -444,9 +444,9 @@ ARC4RANDOM_EXPORT int
arc4random_stir(void)
{
int val;
- ARC4_LOCK_();
+ ARC4_LOCK_();
val = arc4_stir();
- ARC4_UNLOCK_();
+ ARC4_UNLOCK_();
return val;
}
#endif
@@ -456,7 +456,7 @@ ARC4RANDOM_EXPORT void
arc4random_addrandom(const unsigned char *dat, int datlen)
{
int j;
- ARC4_LOCK_();
+ ARC4_LOCK_();
if (!rs_initialized)
arc4_stir();
for (j = 0; j < datlen; j += 256) {
@@ -466,7 +466,7 @@ arc4random_addrandom(const unsigned char *dat, int datlen)
* crazy like passing us all the files in /var/log. */
arc4_addrandom(dat + j, datlen - j);
}
- ARC4_UNLOCK_();
+ ARC4_UNLOCK_();
}
#endif
@@ -475,27 +475,27 @@ ARC4RANDOM_EXPORT ARC4RANDOM_UINT32
arc4random(void)
{
ARC4RANDOM_UINT32 val;
- ARC4_LOCK_();
+ ARC4_LOCK_();
arc4_count -= 4;
arc4_stir_if_needed();
val = arc4_getword();
- ARC4_UNLOCK_();
+ ARC4_UNLOCK_();
return val;
}
#endif
ARC4RANDOM_EXPORT void
-arc4random_buf(void *buf_, size_t n)
+arc4random_buf(void *buf_, size_t n)
{
- unsigned char *buf = buf_;
- ARC4_LOCK_();
+ unsigned char *buf = buf_;
+ ARC4_LOCK_();
arc4_stir_if_needed();
while (n--) {
if (--arc4_count <= 0)
arc4_stir();
buf[n] = arc4_getbyte();
}
- ARC4_UNLOCK_();
+ ARC4_UNLOCK_();
}
#ifndef ARC4RANDOM_NOUNIFORM
diff --git a/contrib/libs/libevent/buffer.c b/contrib/libs/libevent/buffer.c
index 3524b3504d..9714b59ae9 100644
--- a/contrib/libs/libevent/buffer.c
+++ b/contrib/libs/libevent/buffer.c
@@ -26,58 +26,58 @@
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <io.h>
#endif
-#ifdef EVENT__HAVE_VASPRINTF
-/* If we have vasprintf, we need to define _GNU_SOURCE before we include
- * stdio.h. This comes from evconfig-private.h.
- */
-#endif
-
+#ifdef EVENT__HAVE_VASPRINTF
+/* If we have vasprintf, we need to define _GNU_SOURCE before we include
+ * stdio.h. This comes from evconfig-private.h.
+ */
+#endif
+
#include <sys/types.h>
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#ifdef EVENT__HAVE_SYS_SOCKET_H
+#ifdef EVENT__HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#ifdef EVENT__HAVE_SYS_UIO_H
+#ifdef EVENT__HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
-#ifdef EVENT__HAVE_SYS_IOCTL_H
+#ifdef EVENT__HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
-#ifdef EVENT__HAVE_SYS_MMAN_H
+#ifdef EVENT__HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
-#ifdef EVENT__HAVE_SYS_SENDFILE_H
+#ifdef EVENT__HAVE_SYS_SENDFILE_H
#include <sys/sendfile.h>
#endif
-#ifdef EVENT__HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
+#ifdef EVENT__HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef EVENT__HAVE_STDARG_H
+#ifdef EVENT__HAVE_STDARG_H
#include <stdarg.h>
#endif
-#ifdef EVENT__HAVE_UNISTD_H
+#ifdef EVENT__HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <limits.h>
@@ -95,7 +95,7 @@
#include "evthread-internal.h"
#include "evbuffer-internal.h"
#include "bufferevent-internal.h"
-#include "event-internal.h"
+#include "event-internal.h"
/* some systems do not have MAP_FAILED */
#ifndef MAP_FAILED
@@ -103,16 +103,16 @@
#endif
/* send file support */
-#if defined(EVENT__HAVE_SYS_SENDFILE_H) && defined(EVENT__HAVE_SENDFILE) && defined(__linux__)
+#if defined(EVENT__HAVE_SYS_SENDFILE_H) && defined(EVENT__HAVE_SENDFILE) && defined(__linux__)
#define USE_SENDFILE 1
#define SENDFILE_IS_LINUX 1
-#elif defined(EVENT__HAVE_SENDFILE) && defined(__FreeBSD__)
+#elif defined(EVENT__HAVE_SENDFILE) && defined(__FreeBSD__)
#define USE_SENDFILE 1
#define SENDFILE_IS_FREEBSD 1
-#elif defined(EVENT__HAVE_SENDFILE) && defined(__APPLE__)
+#elif defined(EVENT__HAVE_SENDFILE) && defined(__APPLE__)
#define USE_SENDFILE 1
#define SENDFILE_IS_MACOSX 1
-#elif defined(EVENT__HAVE_SENDFILE) && defined(__sun__) && defined(__svr4__)
+#elif defined(EVENT__HAVE_SENDFILE) && defined(__sun__) && defined(__svr4__)
#define USE_SENDFILE 1
#define SENDFILE_IS_SOLARIS 1
#endif
@@ -133,25 +133,25 @@
#define CHAIN_PINNED(ch) (((ch)->flags & EVBUFFER_MEM_PINNED_ANY) != 0)
#define CHAIN_PINNED_R(ch) (((ch)->flags & EVBUFFER_MEM_PINNED_R) != 0)
-/* evbuffer_ptr support */
-#define PTR_NOT_FOUND(ptr) do { \
- (ptr)->pos = -1; \
- (ptr)->internal_.chain = NULL; \
- (ptr)->internal_.pos_in_chain = 0; \
-} while (0)
-
+/* evbuffer_ptr support */
+#define PTR_NOT_FOUND(ptr) do { \
+ (ptr)->pos = -1; \
+ (ptr)->internal_.chain = NULL; \
+ (ptr)->internal_.pos_in_chain = 0; \
+} while (0)
+
static void evbuffer_chain_align(struct evbuffer_chain *chain);
static int evbuffer_chain_should_realign(struct evbuffer_chain *chain,
size_t datalen);
-static void evbuffer_deferred_callback(struct event_callback *cb, void *arg);
+static void evbuffer_deferred_callback(struct event_callback *cb, void *arg);
static int evbuffer_ptr_memcmp(const struct evbuffer *buf,
const struct evbuffer_ptr *pos, const char *mem, size_t len);
static struct evbuffer_chain *evbuffer_expand_singlechain(struct evbuffer *buf,
size_t datlen);
-static int evbuffer_ptr_subtract(struct evbuffer *buf, struct evbuffer_ptr *pos,
- size_t howfar);
-static int evbuffer_file_segment_materialize(struct evbuffer_file_segment *seg);
-static inline void evbuffer_chain_incref(struct evbuffer_chain *chain);
+static int evbuffer_ptr_subtract(struct evbuffer *buf, struct evbuffer_ptr *pos,
+ size_t howfar);
+static int evbuffer_file_segment_materialize(struct evbuffer_file_segment *seg);
+static inline void evbuffer_chain_incref(struct evbuffer_chain *chain);
static struct evbuffer_chain *
evbuffer_chain_new(size_t size)
@@ -185,69 +185,69 @@ evbuffer_chain_new(size_t size)
/* this way we can manipulate the buffer to different addresses,
* which is required for mmap for example.
*/
- chain->buffer = EVBUFFER_CHAIN_EXTRA(unsigned char, chain);
-
- chain->refcnt = 1;
+ chain->buffer = EVBUFFER_CHAIN_EXTRA(unsigned char, chain);
+ chain->refcnt = 1;
+
return (chain);
}
static inline void
evbuffer_chain_free(struct evbuffer_chain *chain)
{
- EVUTIL_ASSERT(chain->refcnt > 0);
- if (--chain->refcnt > 0) {
- /* chain is still referenced by other chains */
- return;
- }
-
+ EVUTIL_ASSERT(chain->refcnt > 0);
+ if (--chain->refcnt > 0) {
+ /* chain is still referenced by other chains */
+ return;
+ }
+
if (CHAIN_PINNED(chain)) {
- /* will get freed once no longer dangling */
- chain->refcnt++;
+ /* will get freed once no longer dangling */
+ chain->refcnt++;
chain->flags |= EVBUFFER_DANGLING;
return;
}
-
- /* safe to release chain, it's either a referencing
- * chain or all references to it have been freed */
- if (chain->flags & EVBUFFER_REFERENCE) {
- struct evbuffer_chain_reference *info =
- EVBUFFER_CHAIN_EXTRA(
- struct evbuffer_chain_reference,
- chain);
- if (info->cleanupfn)
- (*info->cleanupfn)(chain->buffer,
- chain->buffer_len,
- info->extra);
- }
- if (chain->flags & EVBUFFER_FILESEGMENT) {
- struct evbuffer_chain_file_segment *info =
- EVBUFFER_CHAIN_EXTRA(
- struct evbuffer_chain_file_segment,
- chain);
- if (info->segment) {
-#ifdef _WIN32
- if (info->segment->is_mapping)
- UnmapViewOfFile(chain->buffer);
+
+ /* safe to release chain, it's either a referencing
+ * chain or all references to it have been freed */
+ if (chain->flags & EVBUFFER_REFERENCE) {
+ struct evbuffer_chain_reference *info =
+ EVBUFFER_CHAIN_EXTRA(
+ struct evbuffer_chain_reference,
+ chain);
+ if (info->cleanupfn)
+ (*info->cleanupfn)(chain->buffer,
+ chain->buffer_len,
+ info->extra);
+ }
+ if (chain->flags & EVBUFFER_FILESEGMENT) {
+ struct evbuffer_chain_file_segment *info =
+ EVBUFFER_CHAIN_EXTRA(
+ struct evbuffer_chain_file_segment,
+ chain);
+ if (info->segment) {
+#ifdef _WIN32
+ if (info->segment->is_mapping)
+ UnmapViewOfFile(chain->buffer);
#endif
- evbuffer_file_segment_free(info->segment);
+ evbuffer_file_segment_free(info->segment);
}
}
- if (chain->flags & EVBUFFER_MULTICAST) {
- struct evbuffer_multicast_parent *info =
- EVBUFFER_CHAIN_EXTRA(
- struct evbuffer_multicast_parent,
- chain);
- /* referencing chain is being freed, decrease
- * refcounts of source chain and associated
- * evbuffer (which get freed once both reach
- * zero) */
- EVUTIL_ASSERT(info->source != NULL);
- EVUTIL_ASSERT(info->parent != NULL);
- EVBUFFER_LOCK(info->source);
- evbuffer_chain_free(info->parent);
- evbuffer_decref_and_unlock_(info->source);
- }
+ if (chain->flags & EVBUFFER_MULTICAST) {
+ struct evbuffer_multicast_parent *info =
+ EVBUFFER_CHAIN_EXTRA(
+ struct evbuffer_multicast_parent,
+ chain);
+ /* referencing chain is being freed, decrease
+ * refcounts of source chain and associated
+ * evbuffer (which get freed once both reach
+ * zero) */
+ EVUTIL_ASSERT(info->source != NULL);
+ EVUTIL_ASSERT(info->parent != NULL);
+ EVBUFFER_LOCK(info->source);
+ evbuffer_chain_free(info->parent);
+ evbuffer_decref_and_unlock_(info->source);
+ }
mm_free(chain);
}
@@ -316,11 +316,11 @@ evbuffer_chain_insert(struct evbuffer *buf,
EVUTIL_ASSERT(buf->first == NULL);
buf->first = buf->last = chain;
} else {
- struct evbuffer_chain **chp;
- chp = evbuffer_free_trailing_empty_chains(buf);
- *chp = chain;
- if (chain->off)
- buf->last_with_datap = chp;
+ struct evbuffer_chain **chp;
+ chp = evbuffer_free_trailing_empty_chains(buf);
+ *chp = chain;
+ if (chain->off)
+ buf->last_with_datap = chp;
buf->last = chain;
}
buf->total_len += chain->off;
@@ -337,14 +337,14 @@ evbuffer_chain_insert_new(struct evbuffer *buf, size_t datlen)
}
void
-evbuffer_chain_pin_(struct evbuffer_chain *chain, unsigned flag)
+evbuffer_chain_pin_(struct evbuffer_chain *chain, unsigned flag)
{
EVUTIL_ASSERT((chain->flags & flag) == 0);
chain->flags |= flag;
}
void
-evbuffer_chain_unpin_(struct evbuffer_chain *chain, unsigned flag)
+evbuffer_chain_unpin_(struct evbuffer_chain *chain, unsigned flag)
{
EVUTIL_ASSERT((chain->flags & flag) != 0);
chain->flags &= ~flag;
@@ -352,12 +352,12 @@ evbuffer_chain_unpin_(struct evbuffer_chain *chain, unsigned flag)
evbuffer_chain_free(chain);
}
-static inline void
-evbuffer_chain_incref(struct evbuffer_chain *chain)
-{
- ++chain->refcnt;
-}
-
+static inline void
+evbuffer_chain_incref(struct evbuffer_chain *chain)
+{
+ ++chain->refcnt;
+}
+
struct evbuffer *
evbuffer_new(void)
{
@@ -367,7 +367,7 @@ evbuffer_new(void)
if (buffer == NULL)
return (NULL);
- LIST_INIT(&buffer->callbacks);
+ LIST_INIT(&buffer->callbacks);
buffer->refcnt = 1;
buffer->last_with_datap = &buffer->first;
@@ -393,7 +393,7 @@ evbuffer_clear_flags(struct evbuffer *buf, ev_uint64_t flags)
}
void
-evbuffer_incref_(struct evbuffer *buf)
+evbuffer_incref_(struct evbuffer *buf)
{
EVBUFFER_LOCK(buf);
++buf->refcnt;
@@ -401,7 +401,7 @@ evbuffer_incref_(struct evbuffer *buf)
}
void
-evbuffer_incref_and_lock_(struct evbuffer *buf)
+evbuffer_incref_and_lock_(struct evbuffer *buf)
{
EVBUFFER_LOCK(buf);
++buf->refcnt;
@@ -411,10 +411,10 @@ int
evbuffer_defer_callbacks(struct evbuffer *buffer, struct event_base *base)
{
EVBUFFER_LOCK(buffer);
- buffer->cb_queue = base;
+ buffer->cb_queue = base;
buffer->deferred_cbs = 1;
- event_deferred_cb_init_(&buffer->deferred,
- event_base_get_npriorities(base) / 2,
+ event_deferred_cb_init_(&buffer->deferred,
+ event_base_get_npriorities(base) / 2,
evbuffer_deferred_callback, buffer);
EVBUFFER_UNLOCK(buffer);
return 0;
@@ -423,7 +423,7 @@ evbuffer_defer_callbacks(struct evbuffer *buffer, struct event_base *base)
int
evbuffer_enable_locking(struct evbuffer *buf, void *lock)
{
-#ifdef EVENT__DISABLE_THREAD_SUPPORT
+#ifdef EVENT__DISABLE_THREAD_SUPPORT
return -1;
#else
if (buf->lock)
@@ -445,7 +445,7 @@ evbuffer_enable_locking(struct evbuffer *buf, void *lock)
}
void
-evbuffer_set_parent_(struct evbuffer *buf, struct bufferevent *bev)
+evbuffer_set_parent_(struct evbuffer *buf, struct bufferevent *bev)
{
EVBUFFER_LOCK(buf);
buf->parent = bev;
@@ -477,7 +477,7 @@ evbuffer_run_callbacks(struct evbuffer *buffer, int running_deferred)
ASSERT_EVBUFFER_LOCKED(buffer);
- if (LIST_EMPTY(&buffer->callbacks)) {
+ if (LIST_EMPTY(&buffer->callbacks)) {
buffer->n_add_for_cb = buffer->n_del_for_cb = 0;
return;
}
@@ -492,12 +492,12 @@ evbuffer_run_callbacks(struct evbuffer *buffer, int running_deferred)
buffer->n_add_for_cb = 0;
buffer->n_del_for_cb = 0;
}
- for (cbent = LIST_FIRST(&buffer->callbacks);
- cbent != LIST_END(&buffer->callbacks);
+ for (cbent = LIST_FIRST(&buffer->callbacks);
+ cbent != LIST_END(&buffer->callbacks);
cbent = next) {
/* Get the 'next' pointer now in case this callback decides
* to remove itself or something. */
- next = LIST_NEXT(cbent, next);
+ next = LIST_NEXT(cbent, next);
if ((cbent->flags & mask) != masked_val)
continue;
@@ -511,27 +511,27 @@ evbuffer_run_callbacks(struct evbuffer *buffer, int running_deferred)
}
void
-evbuffer_invoke_callbacks_(struct evbuffer *buffer)
+evbuffer_invoke_callbacks_(struct evbuffer *buffer)
{
- if (LIST_EMPTY(&buffer->callbacks)) {
+ if (LIST_EMPTY(&buffer->callbacks)) {
buffer->n_add_for_cb = buffer->n_del_for_cb = 0;
return;
}
if (buffer->deferred_cbs) {
- if (event_deferred_cb_schedule_(buffer->cb_queue, &buffer->deferred)) {
- evbuffer_incref_and_lock_(buffer);
- if (buffer->parent)
- bufferevent_incref_(buffer->parent);
- EVBUFFER_UNLOCK(buffer);
- }
+ if (event_deferred_cb_schedule_(buffer->cb_queue, &buffer->deferred)) {
+ evbuffer_incref_and_lock_(buffer);
+ if (buffer->parent)
+ bufferevent_incref_(buffer->parent);
+ EVBUFFER_UNLOCK(buffer);
+ }
}
evbuffer_run_callbacks(buffer, 0);
}
static void
-evbuffer_deferred_callback(struct event_callback *cb, void *arg)
+evbuffer_deferred_callback(struct event_callback *cb, void *arg)
{
struct bufferevent *parent = NULL;
struct evbuffer *buffer = arg;
@@ -541,9 +541,9 @@ evbuffer_deferred_callback(struct event_callback *cb, void *arg)
EVBUFFER_LOCK(buffer);
parent = buffer->parent;
evbuffer_run_callbacks(buffer, 1);
- evbuffer_decref_and_unlock_(buffer);
+ evbuffer_decref_and_unlock_(buffer);
if (parent)
- bufferevent_decref_(parent);
+ bufferevent_decref_(parent);
}
static void
@@ -551,14 +551,14 @@ evbuffer_remove_all_callbacks(struct evbuffer *buffer)
{
struct evbuffer_cb_entry *cbent;
- while ((cbent = LIST_FIRST(&buffer->callbacks))) {
- LIST_REMOVE(cbent, next);
- mm_free(cbent);
+ while ((cbent = LIST_FIRST(&buffer->callbacks))) {
+ LIST_REMOVE(cbent, next);
+ mm_free(cbent);
}
}
void
-evbuffer_decref_and_unlock_(struct evbuffer *buffer)
+evbuffer_decref_and_unlock_(struct evbuffer *buffer)
{
struct evbuffer_chain *chain, *next;
ASSERT_EVBUFFER_LOCKED(buffer);
@@ -576,7 +576,7 @@ evbuffer_decref_and_unlock_(struct evbuffer *buffer)
}
evbuffer_remove_all_callbacks(buffer);
if (buffer->deferred_cbs)
- event_deferred_cb_cancel_(buffer->cb_queue, &buffer->deferred);
+ event_deferred_cb_cancel_(buffer->cb_queue, &buffer->deferred);
EVBUFFER_UNLOCK(buffer);
if (buffer->own_lock)
@@ -588,7 +588,7 @@ void
evbuffer_free(struct evbuffer *buffer)
{
EVBUFFER_LOCK(buffer);
- evbuffer_decref_and_unlock_(buffer);
+ evbuffer_decref_and_unlock_(buffer);
}
void
@@ -631,42 +631,42 @@ evbuffer_get_contiguous_space(const struct evbuffer *buf)
return result;
}
-size_t
-evbuffer_add_iovec(struct evbuffer * buf, struct evbuffer_iovec * vec, int n_vec) {
- int n;
- size_t res;
- size_t to_alloc;
-
- EVBUFFER_LOCK(buf);
-
- res = to_alloc = 0;
-
- for (n = 0; n < n_vec; n++) {
- to_alloc += vec[n].iov_len;
- }
-
- if (evbuffer_expand_fast_(buf, to_alloc, 2) < 0) {
- goto done;
- }
-
- for (n = 0; n < n_vec; n++) {
- /* XXX each 'add' call here does a bunch of setup that's
- * obviated by evbuffer_expand_fast_, and some cleanup that we
- * would like to do only once. Instead we should just extract
- * the part of the code that's needed. */
-
- if (evbuffer_add(buf, vec[n].iov_base, vec[n].iov_len) < 0) {
- goto done;
- }
-
- res += vec[n].iov_len;
- }
-
-done:
- EVBUFFER_UNLOCK(buf);
- return res;
-}
-
+size_t
+evbuffer_add_iovec(struct evbuffer * buf, struct evbuffer_iovec * vec, int n_vec) {
+ int n;
+ size_t res;
+ size_t to_alloc;
+
+ EVBUFFER_LOCK(buf);
+
+ res = to_alloc = 0;
+
+ for (n = 0; n < n_vec; n++) {
+ to_alloc += vec[n].iov_len;
+ }
+
+ if (evbuffer_expand_fast_(buf, to_alloc, 2) < 0) {
+ goto done;
+ }
+
+ for (n = 0; n < n_vec; n++) {
+ /* XXX each 'add' call here does a bunch of setup that's
+ * obviated by evbuffer_expand_fast_, and some cleanup that we
+ * would like to do only once. Instead we should just extract
+ * the part of the code that's needed. */
+
+ if (evbuffer_add(buf, vec[n].iov_base, vec[n].iov_len) < 0) {
+ goto done;
+ }
+
+ res += vec[n].iov_len;
+ }
+
+done:
+ EVBUFFER_UNLOCK(buf);
+ return res;
+}
+
int
evbuffer_reserve_space(struct evbuffer *buf, ev_ssize_t size,
struct evbuffer_iovec *vec, int n_vecs)
@@ -683,14 +683,14 @@ evbuffer_reserve_space(struct evbuffer *buf, ev_ssize_t size,
if ((chain = evbuffer_expand_singlechain(buf, size)) == NULL)
goto done;
- vec[0].iov_base = (void *)CHAIN_SPACE_PTR(chain);
- vec[0].iov_len = (size_t)CHAIN_SPACE_LEN(chain);
+ vec[0].iov_base = (void *)CHAIN_SPACE_PTR(chain);
+ vec[0].iov_len = (size_t)CHAIN_SPACE_LEN(chain);
EVUTIL_ASSERT(size<0 || (size_t)vec[0].iov_len >= (size_t)size);
n = 1;
} else {
- if (evbuffer_expand_fast_(buf, size, n_vecs)<0)
+ if (evbuffer_expand_fast_(buf, size, n_vecs)<0)
goto done;
- n = evbuffer_read_setup_vecs_(buf, size, vec, n_vecs,
+ n = evbuffer_read_setup_vecs_(buf, size, vec, n_vecs,
&chainp, 0);
}
@@ -704,17 +704,17 @@ static int
advance_last_with_data(struct evbuffer *buf)
{
int n = 0;
- struct evbuffer_chain **chainp = buf->last_with_datap;
-
+ struct evbuffer_chain **chainp = buf->last_with_datap;
+
ASSERT_EVBUFFER_LOCKED(buf);
- if (!*chainp)
+ if (!*chainp)
return 0;
- while ((*chainp)->next) {
- chainp = &(*chainp)->next;
- if ((*chainp)->off)
- buf->last_with_datap = chainp;
+ while ((*chainp)->next) {
+ chainp = &(*chainp)->next;
+ if ((*chainp)->off)
+ buf->last_with_datap = chainp;
++n;
}
return n;
@@ -737,7 +737,7 @@ evbuffer_commit_space(struct evbuffer *buf,
result = 0;
goto done;
} else if (n_vecs == 1 &&
- (buf->last && vec[0].iov_base == (void *)CHAIN_SPACE_PTR(buf->last))) {
+ (buf->last && vec[0].iov_base == (void *)CHAIN_SPACE_PTR(buf->last))) {
/* The user only got or used one chain; it might not
* be the first one with space in it. */
if ((size_t)vec[0].iov_len > (size_t)CHAIN_SPACE_LEN(buf->last))
@@ -763,7 +763,7 @@ evbuffer_commit_space(struct evbuffer *buf,
for (i=0; i<n_vecs; ++i) {
if (!chain)
goto done;
- if (vec[i].iov_base != (void *)CHAIN_SPACE_PTR(chain) ||
+ if (vec[i].iov_base != (void *)CHAIN_SPACE_PTR(chain) ||
(size_t)vec[i].iov_len > CHAIN_SPACE_LEN(chain))
goto done;
chain = chain->next;
@@ -783,7 +783,7 @@ okay:
buf->total_len += added;
buf->n_add_for_cb += added;
result = 0;
- evbuffer_invoke_callbacks_(buf);
+ evbuffer_invoke_callbacks_(buf);
done:
EVBUFFER_UNLOCK(buf);
@@ -888,62 +888,62 @@ COPY_CHAIN(struct evbuffer *dst, struct evbuffer *src)
static void
APPEND_CHAIN(struct evbuffer *dst, struct evbuffer *src)
{
- struct evbuffer_chain **chp;
-
+ struct evbuffer_chain **chp;
+
ASSERT_EVBUFFER_LOCKED(dst);
ASSERT_EVBUFFER_LOCKED(src);
-
- chp = evbuffer_free_trailing_empty_chains(dst);
- *chp = src->first;
-
+
+ chp = evbuffer_free_trailing_empty_chains(dst);
+ *chp = src->first;
+
if (src->last_with_datap == &src->first)
- dst->last_with_datap = chp;
+ dst->last_with_datap = chp;
else
dst->last_with_datap = src->last_with_datap;
dst->last = src->last;
dst->total_len += src->total_len;
}
-static inline void
-APPEND_CHAIN_MULTICAST(struct evbuffer *dst, struct evbuffer *src)
-{
- struct evbuffer_chain *tmp;
- struct evbuffer_chain *chain = src->first;
- struct evbuffer_multicast_parent *extra;
-
- ASSERT_EVBUFFER_LOCKED(dst);
- ASSERT_EVBUFFER_LOCKED(src);
-
- for (; chain; chain = chain->next) {
- if (!chain->off || chain->flags & EVBUFFER_DANGLING) {
- /* skip empty chains */
- continue;
- }
-
- tmp = evbuffer_chain_new(sizeof(struct evbuffer_multicast_parent));
- if (!tmp) {
- event_warn("%s: out of memory", __func__);
- return;
- }
- extra = EVBUFFER_CHAIN_EXTRA(struct evbuffer_multicast_parent, tmp);
- /* reference evbuffer containing source chain so it
- * doesn't get released while the chain is still
- * being referenced to */
- evbuffer_incref_(src);
- extra->source = src;
- /* reference source chain which now becomes immutable */
- evbuffer_chain_incref(chain);
- extra->parent = chain;
- chain->flags |= EVBUFFER_IMMUTABLE;
- tmp->buffer_len = chain->buffer_len;
- tmp->misalign = chain->misalign;
- tmp->off = chain->off;
- tmp->flags |= EVBUFFER_MULTICAST|EVBUFFER_IMMUTABLE;
- tmp->buffer = chain->buffer;
- evbuffer_chain_insert(dst, tmp);
- }
-}
-
+static inline void
+APPEND_CHAIN_MULTICAST(struct evbuffer *dst, struct evbuffer *src)
+{
+ struct evbuffer_chain *tmp;
+ struct evbuffer_chain *chain = src->first;
+ struct evbuffer_multicast_parent *extra;
+
+ ASSERT_EVBUFFER_LOCKED(dst);
+ ASSERT_EVBUFFER_LOCKED(src);
+
+ for (; chain; chain = chain->next) {
+ if (!chain->off || chain->flags & EVBUFFER_DANGLING) {
+ /* skip empty chains */
+ continue;
+ }
+
+ tmp = evbuffer_chain_new(sizeof(struct evbuffer_multicast_parent));
+ if (!tmp) {
+ event_warn("%s: out of memory", __func__);
+ return;
+ }
+ extra = EVBUFFER_CHAIN_EXTRA(struct evbuffer_multicast_parent, tmp);
+ /* reference evbuffer containing source chain so it
+ * doesn't get released while the chain is still
+ * being referenced to */
+ evbuffer_incref_(src);
+ extra->source = src;
+ /* reference source chain which now becomes immutable */
+ evbuffer_chain_incref(chain);
+ extra->parent = chain;
+ chain->flags |= EVBUFFER_IMMUTABLE;
+ tmp->buffer_len = chain->buffer_len;
+ tmp->misalign = chain->misalign;
+ tmp->off = chain->off;
+ tmp->flags |= EVBUFFER_MULTICAST|EVBUFFER_IMMUTABLE;
+ tmp->buffer = chain->buffer;
+ evbuffer_chain_insert(dst, tmp);
+ }
+}
+
static void
PREPEND_CHAIN(struct evbuffer *dst, struct evbuffer *src)
{
@@ -1000,51 +1000,8 @@ evbuffer_add_buffer(struct evbuffer *outbuf, struct evbuffer *inbuf)
inbuf->n_del_for_cb += in_total_len;
outbuf->n_add_for_cb += in_total_len;
- evbuffer_invoke_callbacks_(inbuf);
- evbuffer_invoke_callbacks_(outbuf);
-
-done:
- EVBUFFER_UNLOCK2(inbuf, outbuf);
- return result;
-}
-
-int
-evbuffer_add_buffer_reference(struct evbuffer *outbuf, struct evbuffer *inbuf)
-{
- size_t in_total_len, out_total_len;
- struct evbuffer_chain *chain;
- int result = 0;
-
- EVBUFFER_LOCK2(inbuf, outbuf);
- in_total_len = inbuf->total_len;
- out_total_len = outbuf->total_len;
- chain = inbuf->first;
-
- if (in_total_len == 0)
- goto done;
-
- if (outbuf->freeze_end || outbuf == inbuf) {
- result = -1;
- goto done;
- }
-
- for (; chain; chain = chain->next) {
- if ((chain->flags & (EVBUFFER_FILESEGMENT|EVBUFFER_SENDFILE|EVBUFFER_MULTICAST)) != 0) {
- /* chain type can not be referenced */
- result = -1;
- goto done;
- }
- }
-
- if (out_total_len == 0) {
- /* There might be an empty chain at the start of outbuf; free
- * it. */
- evbuffer_free_all_chains(outbuf->first);
- }
- APPEND_CHAIN_MULTICAST(outbuf, inbuf);
-
- outbuf->n_add_for_cb += in_total_len;
- evbuffer_invoke_callbacks_(outbuf);
+ evbuffer_invoke_callbacks_(inbuf);
+ evbuffer_invoke_callbacks_(outbuf);
done:
EVBUFFER_UNLOCK2(inbuf, outbuf);
@@ -1052,6 +1009,49 @@ done:
}
int
+evbuffer_add_buffer_reference(struct evbuffer *outbuf, struct evbuffer *inbuf)
+{
+ size_t in_total_len, out_total_len;
+ struct evbuffer_chain *chain;
+ int result = 0;
+
+ EVBUFFER_LOCK2(inbuf, outbuf);
+ in_total_len = inbuf->total_len;
+ out_total_len = outbuf->total_len;
+ chain = inbuf->first;
+
+ if (in_total_len == 0)
+ goto done;
+
+ if (outbuf->freeze_end || outbuf == inbuf) {
+ result = -1;
+ goto done;
+ }
+
+ for (; chain; chain = chain->next) {
+ if ((chain->flags & (EVBUFFER_FILESEGMENT|EVBUFFER_SENDFILE|EVBUFFER_MULTICAST)) != 0) {
+ /* chain type can not be referenced */
+ result = -1;
+ goto done;
+ }
+ }
+
+ if (out_total_len == 0) {
+ /* There might be an empty chain at the start of outbuf; free
+ * it. */
+ evbuffer_free_all_chains(outbuf->first);
+ }
+ APPEND_CHAIN_MULTICAST(outbuf, inbuf);
+
+ outbuf->n_add_for_cb += in_total_len;
+ evbuffer_invoke_callbacks_(outbuf);
+
+done:
+ EVBUFFER_UNLOCK2(inbuf, outbuf);
+ return result;
+}
+
+int
evbuffer_prepend_buffer(struct evbuffer *outbuf, struct evbuffer *inbuf)
{
struct evbuffer_chain *pinned, *last;
@@ -1090,8 +1090,8 @@ evbuffer_prepend_buffer(struct evbuffer *outbuf, struct evbuffer *inbuf)
inbuf->n_del_for_cb += in_total_len;
outbuf->n_add_for_cb += in_total_len;
- evbuffer_invoke_callbacks_(inbuf);
- evbuffer_invoke_callbacks_(outbuf);
+ evbuffer_invoke_callbacks_(inbuf);
+ evbuffer_invoke_callbacks_(outbuf);
done:
EVBUFFER_UNLOCK2(inbuf, outbuf);
return result;
@@ -1151,14 +1151,14 @@ evbuffer_drain(struct evbuffer *buf, size_t len)
}
buf->first = chain;
- EVUTIL_ASSERT(remaining <= chain->off);
- chain->misalign += remaining;
- chain->off -= remaining;
+ EVUTIL_ASSERT(remaining <= chain->off);
+ chain->misalign += remaining;
+ chain->off -= remaining;
}
buf->n_del_for_cb += len;
/* Tell someone about changes in this buffer */
- evbuffer_invoke_callbacks_(buf);
+ evbuffer_invoke_callbacks_(buf);
done:
EVBUFFER_UNLOCK(buf);
@@ -1171,7 +1171,7 @@ evbuffer_remove(struct evbuffer *buf, void *data_out, size_t datlen)
{
ev_ssize_t n;
EVBUFFER_LOCK(buf);
- n = evbuffer_copyout_from(buf, NULL, data_out, datlen);
+ n = evbuffer_copyout_from(buf, NULL, data_out, datlen);
if (n > 0) {
if (evbuffer_drain(buf, n)<0)
n = -1;
@@ -1183,37 +1183,37 @@ evbuffer_remove(struct evbuffer *buf, void *data_out, size_t datlen)
ev_ssize_t
evbuffer_copyout(struct evbuffer *buf, void *data_out, size_t datlen)
{
- return evbuffer_copyout_from(buf, NULL, data_out, datlen);
-}
-
-ev_ssize_t
-evbuffer_copyout_from(struct evbuffer *buf, const struct evbuffer_ptr *pos,
- void *data_out, size_t datlen)
-{
+ return evbuffer_copyout_from(buf, NULL, data_out, datlen);
+}
+
+ev_ssize_t
+evbuffer_copyout_from(struct evbuffer *buf, const struct evbuffer_ptr *pos,
+ void *data_out, size_t datlen)
+{
/*XXX fails badly on sendfile case. */
struct evbuffer_chain *chain;
char *data = data_out;
size_t nread;
ev_ssize_t result = 0;
- size_t pos_in_chain;
+ size_t pos_in_chain;
EVBUFFER_LOCK(buf);
- if (pos) {
- if (datlen > (size_t)(EV_SSIZE_MAX - pos->pos)) {
- result = -1;
- goto done;
- }
- chain = pos->internal_.chain;
- pos_in_chain = pos->internal_.pos_in_chain;
- if (datlen + pos->pos > buf->total_len)
- datlen = buf->total_len - pos->pos;
- } else {
- chain = buf->first;
- pos_in_chain = 0;
- if (datlen > buf->total_len)
- datlen = buf->total_len;
- }
+ if (pos) {
+ if (datlen > (size_t)(EV_SSIZE_MAX - pos->pos)) {
+ result = -1;
+ goto done;
+ }
+ chain = pos->internal_.chain;
+ pos_in_chain = pos->internal_.pos_in_chain;
+ if (datlen + pos->pos > buf->total_len)
+ datlen = buf->total_len - pos->pos;
+ } else {
+ chain = buf->first;
+ pos_in_chain = 0;
+ if (datlen > buf->total_len)
+ datlen = buf->total_len;
+ }
if (datlen == 0)
@@ -1226,25 +1226,25 @@ evbuffer_copyout_from(struct evbuffer *buf, const struct evbuffer_ptr *pos,
nread = datlen;
- while (datlen && datlen >= chain->off - pos_in_chain) {
- size_t copylen = chain->off - pos_in_chain;
- memcpy(data,
- chain->buffer + chain->misalign + pos_in_chain,
- copylen);
- data += copylen;
- datlen -= copylen;
+ while (datlen && datlen >= chain->off - pos_in_chain) {
+ size_t copylen = chain->off - pos_in_chain;
+ memcpy(data,
+ chain->buffer + chain->misalign + pos_in_chain,
+ copylen);
+ data += copylen;
+ datlen -= copylen;
chain = chain->next;
- pos_in_chain = 0;
+ pos_in_chain = 0;
EVUTIL_ASSERT(chain || datlen==0);
}
if (datlen) {
EVUTIL_ASSERT(chain);
- EVUTIL_ASSERT(datlen+pos_in_chain <= chain->off);
-
- memcpy(data, chain->buffer + chain->misalign + pos_in_chain,
- datlen);
+ EVUTIL_ASSERT(datlen+pos_in_chain <= chain->off);
+
+ memcpy(data, chain->buffer + chain->misalign + pos_in_chain,
+ datlen);
}
result = nread;
@@ -1303,7 +1303,7 @@ evbuffer_remove_buffer(struct evbuffer *src, struct evbuffer *dst,
chain = chain->next;
}
- if (chain != src->first) {
+ if (chain != src->first) {
/* we can remove the chain */
struct evbuffer_chain **chp;
chp = evbuffer_free_trailing_empty_chains(dst);
@@ -1336,8 +1336,8 @@ evbuffer_remove_buffer(struct evbuffer *src, struct evbuffer *dst,
src->n_del_for_cb += nread;
if (nread) {
- evbuffer_invoke_callbacks_(dst);
- evbuffer_invoke_callbacks_(src);
+ evbuffer_invoke_callbacks_(dst);
+ evbuffer_invoke_callbacks_(src);
}
result = (int)nread;/*XXXX should change return type */
@@ -1473,14 +1473,14 @@ evbuffer_readline(struct evbuffer *buffer)
static inline ev_ssize_t
evbuffer_strchr(struct evbuffer_ptr *it, const char chr)
{
- struct evbuffer_chain *chain = it->internal_.chain;
- size_t i = it->internal_.pos_in_chain;
+ struct evbuffer_chain *chain = it->internal_.chain;
+ size_t i = it->internal_.pos_in_chain;
while (chain != NULL) {
char *buffer = (char *)chain->buffer + chain->misalign;
char *cp = memchr(buffer+i, chr, chain->off-i);
if (cp) {
- it->internal_.chain = chain;
- it->internal_.pos_in_chain = cp - buffer;
+ it->internal_.chain = chain;
+ it->internal_.pos_in_chain = cp - buffer;
it->pos += (cp - buffer - i);
return it->pos;
}
@@ -1522,14 +1522,14 @@ find_eol_char(char *s, size_t len)
static ev_ssize_t
evbuffer_find_eol_char(struct evbuffer_ptr *it)
{
- struct evbuffer_chain *chain = it->internal_.chain;
- size_t i = it->internal_.pos_in_chain;
+ struct evbuffer_chain *chain = it->internal_.chain;
+ size_t i = it->internal_.pos_in_chain;
while (chain != NULL) {
char *buffer = (char *)chain->buffer + chain->misalign;
char *cp = find_eol_char(buffer+i, chain->off-i);
if (cp) {
- it->internal_.chain = chain;
- it->internal_.pos_in_chain = cp - buffer;
+ it->internal_.chain = chain;
+ it->internal_.pos_in_chain = cp - buffer;
it->pos += (cp - buffer) - i;
return it->pos;
}
@@ -1541,16 +1541,16 @@ evbuffer_find_eol_char(struct evbuffer_ptr *it)
return (-1);
}
-static inline size_t
+static inline size_t
evbuffer_strspn(
struct evbuffer_ptr *ptr, const char *chrset)
{
- size_t count = 0;
- struct evbuffer_chain *chain = ptr->internal_.chain;
- size_t i = ptr->internal_.pos_in_chain;
+ size_t count = 0;
+ struct evbuffer_chain *chain = ptr->internal_.chain;
+ size_t i = ptr->internal_.pos_in_chain;
if (!chain)
- return 0;
+ return 0;
while (1) {
char *buffer = (char *)chain->buffer + chain->misalign;
@@ -1560,8 +1560,8 @@ evbuffer_strspn(
if (buffer[i] == *p++)
goto next;
}
- ptr->internal_.chain = chain;
- ptr->internal_.pos_in_chain = i;
+ ptr->internal_.chain = chain;
+ ptr->internal_.pos_in_chain = i;
ptr->pos += count;
return count;
next:
@@ -1570,8 +1570,8 @@ evbuffer_strspn(
i = 0;
if (! chain->next) {
- ptr->internal_.chain = chain;
- ptr->internal_.pos_in_chain = i;
+ ptr->internal_.chain = chain;
+ ptr->internal_.pos_in_chain = i;
ptr->pos += count;
return count;
}
@@ -1581,16 +1581,16 @@ evbuffer_strspn(
}
-static inline int
+static inline int
evbuffer_getchr(struct evbuffer_ptr *it)
{
- struct evbuffer_chain *chain = it->internal_.chain;
- size_t off = it->internal_.pos_in_chain;
+ struct evbuffer_chain *chain = it->internal_.chain;
+ size_t off = it->internal_.pos_in_chain;
- if (chain == NULL)
- return -1;
-
- return (unsigned char)chain->buffer[chain->misalign + off];
+ if (chain == NULL)
+ return -1;
+
+ return (unsigned char)chain->buffer[chain->misalign + off];
}
struct evbuffer_ptr
@@ -1602,22 +1602,22 @@ evbuffer_search_eol(struct evbuffer *buffer,
size_t extra_drain = 0;
int ok = 0;
- /* Avoid locking in trivial edge cases */
- if (start && start->internal_.chain == NULL) {
- PTR_NOT_FOUND(&it);
- if (eol_len_out)
- *eol_len_out = extra_drain;
- return it;
- }
-
+ /* Avoid locking in trivial edge cases */
+ if (start && start->internal_.chain == NULL) {
+ PTR_NOT_FOUND(&it);
+ if (eol_len_out)
+ *eol_len_out = extra_drain;
+ return it;
+ }
+
EVBUFFER_LOCK(buffer);
if (start) {
memcpy(&it, start, sizeof(it));
} else {
it.pos = 0;
- it.internal_.chain = buffer->first;
- it.internal_.pos_in_chain = 0;
+ it.internal_.chain = buffer->first;
+ it.internal_.pos_in_chain = 0;
}
/* the eol_style determines our first stop character and how many
@@ -1636,37 +1636,37 @@ evbuffer_search_eol(struct evbuffer *buffer,
extra_drain = 2;
break;
}
- case EVBUFFER_EOL_CRLF: {
- ev_ssize_t start_pos = it.pos;
- /* Look for a LF ... */
- if (evbuffer_strchr(&it, '\n') < 0)
- goto done;
- extra_drain = 1;
- /* ... optionally preceeded by a CR. */
- if (it.pos == start_pos)
- break; /* If the first character is \n, don't back up */
- /* This potentially does an extra linear walk over the first
- * few chains. Probably, that's not too expensive unless you
- * have a really pathological setup. */
- memcpy(&it2, &it, sizeof(it));
- if (evbuffer_ptr_subtract(buffer, &it2, 1)<0)
- break;
- if (evbuffer_getchr(&it2) == '\r') {
- memcpy(&it, &it2, sizeof(it));
- extra_drain = 2;
+ case EVBUFFER_EOL_CRLF: {
+ ev_ssize_t start_pos = it.pos;
+ /* Look for a LF ... */
+ if (evbuffer_strchr(&it, '\n') < 0)
+ goto done;
+ extra_drain = 1;
+ /* ... optionally preceeded by a CR. */
+ if (it.pos == start_pos)
+ break; /* If the first character is \n, don't back up */
+ /* This potentially does an extra linear walk over the first
+ * few chains. Probably, that's not too expensive unless you
+ * have a really pathological setup. */
+ memcpy(&it2, &it, sizeof(it));
+ if (evbuffer_ptr_subtract(buffer, &it2, 1)<0)
+ break;
+ if (evbuffer_getchr(&it2) == '\r') {
+ memcpy(&it, &it2, sizeof(it));
+ extra_drain = 2;
}
break;
- }
+ }
case EVBUFFER_EOL_LF:
if (evbuffer_strchr(&it, '\n') < 0)
goto done;
extra_drain = 1;
break;
- case EVBUFFER_EOL_NUL:
- if (evbuffer_strchr(&it, '\0') < 0)
- goto done;
- extra_drain = 1;
- break;
+ case EVBUFFER_EOL_NUL:
+ if (evbuffer_strchr(&it, '\0') < 0)
+ goto done;
+ extra_drain = 1;
+ break;
default:
goto done;
}
@@ -1675,8 +1675,8 @@ evbuffer_search_eol(struct evbuffer *buffer,
done:
EVBUFFER_UNLOCK(buffer);
- if (!ok)
- PTR_NOT_FOUND(&it);
+ if (!ok)
+ PTR_NOT_FOUND(&it);
if (eol_len_out)
*eol_len_out = extra_drain;
@@ -1744,11 +1744,11 @@ evbuffer_add(struct evbuffer *buf, const void *data_in, size_t datlen)
goto done;
}
- if (*buf->last_with_datap == NULL) {
- chain = buf->last;
- } else {
- chain = *buf->last_with_datap;
- }
+ if (*buf->last_with_datap == NULL) {
+ chain = buf->last;
+ } else {
+ chain = *buf->last_with_datap;
+ }
/* If there are no chains allocated for this buffer, allocate one
* big enough to hold all the data. */
@@ -1816,7 +1816,7 @@ evbuffer_add(struct evbuffer *buf, const void *data_in, size_t datlen)
buf->n_add_for_cb += datlen;
out:
- evbuffer_invoke_callbacks_(buf);
+ evbuffer_invoke_callbacks_(buf);
result = 0;
done:
EVBUFFER_UNLOCK(buf);
@@ -1831,10 +1831,10 @@ evbuffer_prepend(struct evbuffer *buf, const void *data, size_t datlen)
EVBUFFER_LOCK(buf);
- if (datlen == 0) {
- result = 0;
- goto done;
- }
+ if (datlen == 0) {
+ result = 0;
+ goto done;
+ }
if (buf->freeze_start) {
goto done;
}
@@ -1888,7 +1888,7 @@ evbuffer_prepend(struct evbuffer *buf, const void *data, size_t datlen)
if ((tmp = evbuffer_chain_new(datlen)) == NULL)
goto done;
buf->first = tmp;
- if (buf->last_with_datap == &buf->first && chain->off)
+ if (buf->last_with_datap == &buf->first && chain->off)
buf->last_with_datap = &tmp->next;
tmp->next = chain;
@@ -1899,10 +1899,10 @@ evbuffer_prepend(struct evbuffer *buf, const void *data, size_t datlen)
memcpy(tmp->buffer + tmp->misalign, data, datlen);
buf->total_len += datlen;
- buf->n_add_for_cb += datlen;
+ buf->n_add_for_cb += datlen;
out:
- evbuffer_invoke_callbacks_(buf);
+ evbuffer_invoke_callbacks_(buf);
result = 0;
done:
EVBUFFER_UNLOCK(buf);
@@ -1994,7 +1994,7 @@ evbuffer_expand_singlechain(struct evbuffer *buf, size_t datlen)
/* Would expanding this chunk be affordable and worthwhile? */
if (CHAIN_SPACE_LEN(chain) < chain->buffer_len / 8 ||
chain->off > MAX_TO_COPY_IN_EXPAND ||
- datlen >= (EVBUFFER_CHAIN_MAX - chain->off)) {
+ datlen >= (EVBUFFER_CHAIN_MAX - chain->off)) {
/* It's not worth resizing this chain. Can the next one be
* used? */
if (chain->next && CHAIN_SPACE_LEN(chain->next) >= datlen) {
@@ -2048,7 +2048,7 @@ err:
/* Make sure that datlen bytes are available for writing in the last n
* chains. Never copies or moves data. */
int
-evbuffer_expand_fast_(struct evbuffer *buf, size_t datlen, int n)
+evbuffer_expand_fast_(struct evbuffer *buf, size_t datlen, int n)
{
struct evbuffer_chain *chain = buf->last, *tmp, *next;
size_t avail;
@@ -2172,13 +2172,13 @@ evbuffer_expand(struct evbuffer *buf, size_t datlen)
* Reads data from a file descriptor into a buffer.
*/
-#if defined(EVENT__HAVE_SYS_UIO_H) || defined(_WIN32)
+#if defined(EVENT__HAVE_SYS_UIO_H) || defined(_WIN32)
#define USE_IOVEC_IMPL
#endif
#ifdef USE_IOVEC_IMPL
-#ifdef EVENT__HAVE_SYS_UIO_H
+#ifdef EVENT__HAVE_SYS_UIO_H
/* number of iovec we use for writev, fragmentation is going to determine
* how much we end up writing */
@@ -2222,7 +2222,7 @@ evbuffer_expand(struct evbuffer *buf, size_t datlen)
@return The number of buffers we're using.
*/
int
-evbuffer_read_setup_vecs_(struct evbuffer *buf, ev_ssize_t howmuch,
+evbuffer_read_setup_vecs_(struct evbuffer *buf, ev_ssize_t howmuch,
struct evbuffer_iovec *vecs, int n_vecs_avail,
struct evbuffer_chain ***chainp, int exact)
{
@@ -2238,18 +2238,18 @@ evbuffer_read_setup_vecs_(struct evbuffer *buf, ev_ssize_t howmuch,
so_far = 0;
/* Let firstchain be the first chain with any space on it */
firstchainp = buf->last_with_datap;
- EVUTIL_ASSERT(*firstchainp);
+ EVUTIL_ASSERT(*firstchainp);
if (CHAIN_SPACE_LEN(*firstchainp) == 0) {
firstchainp = &(*firstchainp)->next;
}
chain = *firstchainp;
- EVUTIL_ASSERT(chain);
+ EVUTIL_ASSERT(chain);
for (i = 0; i < n_vecs_avail && so_far < (size_t)howmuch; ++i) {
size_t avail = (size_t) CHAIN_SPACE_LEN(chain);
if (avail > (howmuch - so_far) && exact)
avail = howmuch - so_far;
- vecs[i].iov_base = (void *)CHAIN_SPACE_PTR(chain);
+ vecs[i].iov_base = (void *)CHAIN_SPACE_PTR(chain);
vecs[i].iov_len = avail;
so_far += avail;
chain = chain->next;
@@ -2262,7 +2262,7 @@ evbuffer_read_setup_vecs_(struct evbuffer *buf, ev_ssize_t howmuch,
static int
get_n_bytes_readable_on_socket(evutil_socket_t fd)
{
-#if defined(FIONREAD) && defined(_WIN32)
+#if defined(FIONREAD) && defined(_WIN32)
unsigned long lng = EVBUFFER_MAX_READ;
if (ioctlsocket(fd, FIONREAD, &lng) < 0)
return -1;
@@ -2310,26 +2310,26 @@ evbuffer_read(struct evbuffer *buf, evutil_socket_t fd, int howmuch)
#ifdef USE_IOVEC_IMPL
/* Since we can use iovecs, we're willing to use the last
* NUM_READ_IOVEC chains. */
- if (evbuffer_expand_fast_(buf, howmuch, NUM_READ_IOVEC) == -1) {
+ if (evbuffer_expand_fast_(buf, howmuch, NUM_READ_IOVEC) == -1) {
result = -1;
goto done;
} else {
IOV_TYPE vecs[NUM_READ_IOVEC];
-#ifdef EVBUFFER_IOVEC_IS_NATIVE_
- nvecs = evbuffer_read_setup_vecs_(buf, howmuch, vecs,
+#ifdef EVBUFFER_IOVEC_IS_NATIVE_
+ nvecs = evbuffer_read_setup_vecs_(buf, howmuch, vecs,
NUM_READ_IOVEC, &chainp, 1);
#else
/* We aren't using the native struct iovec. Therefore,
we are on win32. */
struct evbuffer_iovec ev_vecs[NUM_READ_IOVEC];
- nvecs = evbuffer_read_setup_vecs_(buf, howmuch, ev_vecs, 2,
+ nvecs = evbuffer_read_setup_vecs_(buf, howmuch, ev_vecs, 2,
&chainp, 1);
for (i=0; i < nvecs; ++i)
WSABUF_FROM_EVBUFFER_IOV(&vecs[i], &ev_vecs[i]);
#endif
-#ifdef _WIN32
+#ifdef _WIN32
{
DWORD bytesRead;
DWORD flags=0;
@@ -2360,7 +2360,7 @@ evbuffer_read(struct evbuffer *buf, evutil_socket_t fd, int howmuch)
/* We can append new data at this point */
p = chain->buffer + chain->misalign + chain->off;
-#ifndef _WIN32
+#ifndef _WIN32
n = read(fd, p, howmuch);
#else
n = recv(fd, p, howmuch, 0);
@@ -2404,7 +2404,7 @@ evbuffer_read(struct evbuffer *buf, evutil_socket_t fd, int howmuch)
buf->n_add_for_cb += n;
/* Tell someone about changes in this buffer */
- evbuffer_invoke_callbacks_(buf);
+ evbuffer_invoke_callbacks_(buf);
result = n;
done:
EVBUFFER_UNLOCK(buf);
@@ -2447,8 +2447,8 @@ evbuffer_write_iovec(struct evbuffer *buffer, evutil_socket_t fd,
}
if (! i)
return 0;
-
-#ifdef _WIN32
+
+#ifdef _WIN32
{
DWORD bytesSent;
if (WSASend(fd, iov, i, &bytesSent, 0, NULL, NULL))
@@ -2465,17 +2465,17 @@ evbuffer_write_iovec(struct evbuffer *buffer, evutil_socket_t fd,
#ifdef USE_SENDFILE
static inline int
-evbuffer_write_sendfile(struct evbuffer *buffer, evutil_socket_t dest_fd,
+evbuffer_write_sendfile(struct evbuffer *buffer, evutil_socket_t dest_fd,
ev_ssize_t howmuch)
{
struct evbuffer_chain *chain = buffer->first;
- struct evbuffer_chain_file_segment *info =
- EVBUFFER_CHAIN_EXTRA(struct evbuffer_chain_file_segment,
- chain);
- const int source_fd = info->segment->fd;
+ struct evbuffer_chain_file_segment *info =
+ EVBUFFER_CHAIN_EXTRA(struct evbuffer_chain_file_segment,
+ chain);
+ const int source_fd = info->segment->fd;
#if defined(SENDFILE_IS_MACOSX) || defined(SENDFILE_IS_FREEBSD)
int res;
- ev_off_t len = chain->off;
+ ev_off_t len = chain->off;
#elif defined(SENDFILE_IS_LINUX) || defined(SENDFILE_IS_SOLARIS)
ev_ssize_t res;
off_t offset = chain->misalign;
@@ -2484,20 +2484,20 @@ evbuffer_write_sendfile(struct evbuffer *buffer, evutil_socket_t dest_fd,
ASSERT_EVBUFFER_LOCKED(buffer);
#if defined(SENDFILE_IS_MACOSX)
- res = sendfile(source_fd, dest_fd, chain->misalign, &len, NULL, 0);
+ res = sendfile(source_fd, dest_fd, chain->misalign, &len, NULL, 0);
if (res == -1 && !EVUTIL_ERR_RW_RETRIABLE(errno))
return (-1);
return (len);
#elif defined(SENDFILE_IS_FREEBSD)
- res = sendfile(source_fd, dest_fd, chain->misalign, chain->off, NULL, &len, 0);
+ res = sendfile(source_fd, dest_fd, chain->misalign, chain->off, NULL, &len, 0);
if (res == -1 && !EVUTIL_ERR_RW_RETRIABLE(errno))
return (-1);
return (len);
#elif defined(SENDFILE_IS_LINUX)
/* TODO(niels): implement splice */
- res = sendfile(dest_fd, source_fd, &offset, chain->off);
+ res = sendfile(dest_fd, source_fd, &offset, chain->off);
if (res == -1 && EVUTIL_ERR_RW_RETRIABLE(errno)) {
/* if this is EAGAIN or EINTR return 0; otherwise, -1 */
return (0);
@@ -2506,7 +2506,7 @@ evbuffer_write_sendfile(struct evbuffer *buffer, evutil_socket_t dest_fd,
#elif defined(SENDFILE_IS_SOLARIS)
{
const off_t offset_orig = offset;
- res = sendfile(dest_fd, source_fd, &offset, chain->off);
+ res = sendfile(dest_fd, source_fd, &offset, chain->off);
if (res == -1 && EVUTIL_ERR_RW_RETRIABLE(errno)) {
if (offset - offset_orig)
return offset - offset_orig;
@@ -2544,7 +2544,7 @@ evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd,
#endif
#ifdef USE_IOVEC_IMPL
n = evbuffer_write_iovec(buffer, fd, howmuch);
-#elif defined(_WIN32)
+#elif defined(_WIN32)
/* XXX(nickm) Don't disable this code until we know if
* the WSARecv code above works. */
void *p = evbuffer_pullup(buffer, howmuch);
@@ -2594,38 +2594,38 @@ evbuffer_find(struct evbuffer *buffer, const unsigned char *what, size_t len)
return search;
}
-/* Subract <b>howfar</b> from the position of <b>pos</b> within
- * <b>buf</b>. Returns 0 on success, -1 on failure.
- *
- * This isn't exposed yet, because of potential inefficiency issues.
- * Maybe it should be. */
-static int
-evbuffer_ptr_subtract(struct evbuffer *buf, struct evbuffer_ptr *pos,
- size_t howfar)
-{
- if (pos->pos < 0)
- return -1;
- if (howfar > (size_t)pos->pos)
- return -1;
- if (pos->internal_.chain && howfar <= pos->internal_.pos_in_chain) {
- pos->internal_.pos_in_chain -= howfar;
- pos->pos -= howfar;
- return 0;
- } else {
- const size_t newpos = pos->pos - howfar;
- /* Here's the inefficient part: it walks over the
- * chains until we hit newpos. */
- return evbuffer_ptr_set(buf, pos, newpos, EVBUFFER_PTR_SET);
- }
-}
-
+/* Subract <b>howfar</b> from the position of <b>pos</b> within
+ * <b>buf</b>. Returns 0 on success, -1 on failure.
+ *
+ * This isn't exposed yet, because of potential inefficiency issues.
+ * Maybe it should be. */
+static int
+evbuffer_ptr_subtract(struct evbuffer *buf, struct evbuffer_ptr *pos,
+ size_t howfar)
+{
+ if (pos->pos < 0)
+ return -1;
+ if (howfar > (size_t)pos->pos)
+ return -1;
+ if (pos->internal_.chain && howfar <= pos->internal_.pos_in_chain) {
+ pos->internal_.pos_in_chain -= howfar;
+ pos->pos -= howfar;
+ return 0;
+ } else {
+ const size_t newpos = pos->pos - howfar;
+ /* Here's the inefficient part: it walks over the
+ * chains until we hit newpos. */
+ return evbuffer_ptr_set(buf, pos, newpos, EVBUFFER_PTR_SET);
+ }
+}
+
int
evbuffer_ptr_set(struct evbuffer *buf, struct evbuffer_ptr *pos,
size_t position, enum evbuffer_ptr_how how)
{
size_t left = position;
struct evbuffer_chain *chain = NULL;
- int result = 0;
+ int result = 0;
EVBUFFER_LOCK(buf);
@@ -2642,9 +2642,9 @@ evbuffer_ptr_set(struct evbuffer *buf, struct evbuffer_ptr *pos,
EVBUFFER_UNLOCK(buf);
return -1;
}
- chain = pos->internal_.chain;
+ chain = pos->internal_.chain;
pos->pos += position;
- position = pos->internal_.pos_in_chain;
+ position = pos->internal_.pos_in_chain;
break;
}
@@ -2655,20 +2655,20 @@ evbuffer_ptr_set(struct evbuffer *buf, struct evbuffer_ptr *pos,
position = 0;
}
if (chain) {
- pos->internal_.chain = chain;
- pos->internal_.pos_in_chain = position + left;
- } else if (left == 0) {
- /* The first byte in the (nonexistent) chain after the last chain */
- pos->internal_.chain = NULL;
- pos->internal_.pos_in_chain = 0;
+ pos->internal_.chain = chain;
+ pos->internal_.pos_in_chain = position + left;
+ } else if (left == 0) {
+ /* The first byte in the (nonexistent) chain after the last chain */
+ pos->internal_.chain = NULL;
+ pos->internal_.pos_in_chain = 0;
} else {
- PTR_NOT_FOUND(pos);
- result = -1;
+ PTR_NOT_FOUND(pos);
+ result = -1;
}
EVBUFFER_UNLOCK(buf);
- return result;
+ return result;
}
/**
@@ -2690,8 +2690,8 @@ evbuffer_ptr_memcmp(const struct evbuffer *buf, const struct evbuffer_ptr *pos,
pos->pos + len > buf->total_len)
return -1;
- chain = pos->internal_.chain;
- position = pos->internal_.pos_in_chain;
+ chain = pos->internal_.chain;
+ position = pos->internal_.pos_in_chain;
while (len && chain) {
size_t n_comparable;
if (len + position > chain->off)
@@ -2729,15 +2729,15 @@ evbuffer_search_range(struct evbuffer *buffer, const char *what, size_t len, con
if (start) {
memcpy(&pos, start, sizeof(pos));
- chain = pos.internal_.chain;
+ chain = pos.internal_.chain;
} else {
pos.pos = 0;
- chain = pos.internal_.chain = buffer->first;
- pos.internal_.pos_in_chain = 0;
+ chain = pos.internal_.chain = buffer->first;
+ pos.internal_.pos_in_chain = 0;
}
if (end)
- last_chain = end->internal_.chain;
+ last_chain = end->internal_.chain;
if (!len || len > EV_SSIZE_MAX)
goto done;
@@ -2747,12 +2747,12 @@ evbuffer_search_range(struct evbuffer *buffer, const char *what, size_t len, con
while (chain) {
const unsigned char *start_at =
chain->buffer + chain->misalign +
- pos.internal_.pos_in_chain;
+ pos.internal_.pos_in_chain;
p = memchr(start_at, first,
- chain->off - pos.internal_.pos_in_chain);
+ chain->off - pos.internal_.pos_in_chain);
if (p) {
pos.pos += p - start_at;
- pos.internal_.pos_in_chain += p - start_at;
+ pos.internal_.pos_in_chain += p - start_at;
if (!evbuffer_ptr_memcmp(buffer, &pos, what, len)) {
if (end && pos.pos + (ev_ssize_t)len > end->pos)
goto not_found;
@@ -2760,22 +2760,22 @@ evbuffer_search_range(struct evbuffer *buffer, const char *what, size_t len, con
goto done;
}
++pos.pos;
- ++pos.internal_.pos_in_chain;
- if (pos.internal_.pos_in_chain == chain->off) {
- chain = pos.internal_.chain = chain->next;
- pos.internal_.pos_in_chain = 0;
+ ++pos.internal_.pos_in_chain;
+ if (pos.internal_.pos_in_chain == chain->off) {
+ chain = pos.internal_.chain = chain->next;
+ pos.internal_.pos_in_chain = 0;
}
} else {
if (chain == last_chain)
goto not_found;
- pos.pos += chain->off - pos.internal_.pos_in_chain;
- chain = pos.internal_.chain = chain->next;
- pos.internal_.pos_in_chain = 0;
+ pos.pos += chain->off - pos.internal_.pos_in_chain;
+ chain = pos.internal_.chain = chain->next;
+ pos.internal_.pos_in_chain = 0;
}
}
not_found:
- PTR_NOT_FOUND(&pos);
+ PTR_NOT_FOUND(&pos);
done:
EVBUFFER_UNLOCK(buffer);
return pos;
@@ -2790,20 +2790,20 @@ evbuffer_peek(struct evbuffer *buffer, ev_ssize_t len,
int idx = 0;
ev_ssize_t len_so_far = 0;
- /* Avoid locking in trivial edge cases */
- if (start_at && start_at->internal_.chain == NULL)
- return 0;
-
+ /* Avoid locking in trivial edge cases */
+ if (start_at && start_at->internal_.chain == NULL)
+ return 0;
+
EVBUFFER_LOCK(buffer);
if (start_at) {
- chain = start_at->internal_.chain;
+ chain = start_at->internal_.chain;
len_so_far = chain->off
- - start_at->internal_.pos_in_chain;
+ - start_at->internal_.pos_in_chain;
idx = 1;
if (n_vec > 0) {
- vec[0].iov_base = (void *)(chain->buffer + chain->misalign
- + start_at->internal_.pos_in_chain);
+ vec[0].iov_base = (void *)(chain->buffer + chain->misalign
+ + start_at->internal_.pos_in_chain);
vec[0].iov_len = len_so_far;
}
chain = chain->next;
@@ -2824,7 +2824,7 @@ evbuffer_peek(struct evbuffer *buffer, ev_ssize_t len,
if (len >= 0 && len_so_far >= len)
break;
if (idx<n_vec) {
- vec[idx].iov_base = (void *)(chain->buffer + chain->misalign);
+ vec[idx].iov_base = (void *)(chain->buffer + chain->misalign);
vec[idx].iov_len = chain->off;
} else if (len<0) {
break;
@@ -2890,7 +2890,7 @@ evbuffer_add_vprintf(struct evbuffer *buf, const char *fmt, va_list ap)
buf->n_add_for_cb += sz;
advance_last_with_data(buf);
- evbuffer_invoke_callbacks_(buf);
+ evbuffer_invoke_callbacks_(buf);
result = sz;
goto done;
}
@@ -2930,7 +2930,7 @@ evbuffer_add_reference(struct evbuffer *outbuf,
if (!chain)
return (-1);
chain->flags |= EVBUFFER_REFERENCE | EVBUFFER_IMMUTABLE;
- chain->buffer = (unsigned char *)data;
+ chain->buffer = (unsigned char *)data;
chain->buffer_len = datlen;
chain->off = datlen;
@@ -2948,7 +2948,7 @@ evbuffer_add_reference(struct evbuffer *outbuf,
evbuffer_chain_insert(outbuf, chain);
outbuf->n_add_for_cb += datlen;
- evbuffer_invoke_callbacks_(outbuf);
+ evbuffer_invoke_callbacks_(outbuf);
result = 0;
done:
@@ -2960,374 +2960,374 @@ done:
/* TODO(niels): we may want to add to automagically convert to mmap, in
* case evbuffer_remove() or evbuffer_pullup() are being used.
*/
-struct evbuffer_file_segment *
-evbuffer_file_segment_new(
- int fd, ev_off_t offset, ev_off_t length, unsigned flags)
-{
- struct evbuffer_file_segment *seg =
- mm_calloc(sizeof(struct evbuffer_file_segment), 1);
- if (!seg)
- return NULL;
- seg->refcnt = 1;
- seg->fd = fd;
- seg->flags = flags;
- seg->file_offset = offset;
- seg->cleanup_cb = NULL;
- seg->cleanup_cb_arg = NULL;
-#ifdef _WIN32
-#ifndef lseek
-#define lseek _lseeki64
-#endif
-#ifndef fstat
-#define fstat _fstat
+struct evbuffer_file_segment *
+evbuffer_file_segment_new(
+ int fd, ev_off_t offset, ev_off_t length, unsigned flags)
+{
+ struct evbuffer_file_segment *seg =
+ mm_calloc(sizeof(struct evbuffer_file_segment), 1);
+ if (!seg)
+ return NULL;
+ seg->refcnt = 1;
+ seg->fd = fd;
+ seg->flags = flags;
+ seg->file_offset = offset;
+ seg->cleanup_cb = NULL;
+ seg->cleanup_cb_arg = NULL;
+#ifdef _WIN32
+#ifndef lseek
+#define lseek _lseeki64
#endif
-#ifndef stat
-#define stat _stat
+#ifndef fstat
+#define fstat _fstat
#endif
-#endif
- if (length == -1) {
- struct stat st;
- if (fstat(fd, &st) < 0)
- goto err;
- length = st.st_size;
- }
- seg->length = length;
+#ifndef stat
+#define stat _stat
+#endif
+#endif
+ if (length == -1) {
+ struct stat st;
+ if (fstat(fd, &st) < 0)
+ goto err;
+ length = st.st_size;
+ }
+ seg->length = length;
if (offset < 0 || length < 0 ||
((ev_uint64_t)length > EVBUFFER_CHAIN_MAX) ||
(ev_uint64_t)offset > (ev_uint64_t)(EVBUFFER_CHAIN_MAX - length))
- goto err;
-
-#if defined(USE_SENDFILE)
- if (!(flags & EVBUF_FS_DISABLE_SENDFILE)) {
- seg->can_sendfile = 1;
- goto done;
- }
-#endif
-
- if (evbuffer_file_segment_materialize(seg)<0)
- goto err;
+ goto err;
#if defined(USE_SENDFILE)
-done:
-#endif
- if (!(flags & EVBUF_FS_DISABLE_LOCKING)) {
- EVTHREAD_ALLOC_LOCK(seg->lock, 0);
- }
- return seg;
-err:
- mm_free(seg);
- return NULL;
-}
-
-#ifdef EVENT__HAVE_MMAP
-static long
-get_page_size(void)
-{
-#ifdef SC_PAGE_SIZE
- return sysconf(SC_PAGE_SIZE);
-#elif defined(_SC_PAGE_SIZE)
- return sysconf(_SC_PAGE_SIZE);
-#else
- return 1;
-#endif
-}
-#endif
-
-/* DOCDOC */
-/* Requires lock */
-static int
-evbuffer_file_segment_materialize(struct evbuffer_file_segment *seg)
-{
- const unsigned flags = seg->flags;
- const int fd = seg->fd;
- const ev_off_t length = seg->length;
- const ev_off_t offset = seg->file_offset;
-
- if (seg->contents)
- return 0; /* already materialized */
-
-#if defined(EVENT__HAVE_MMAP)
- if (!(flags & EVBUF_FS_DISABLE_MMAP)) {
- off_t offset_rounded = 0, offset_leftover = 0;
- void *mapped;
- if (offset) {
- /* mmap implementations don't generally like us
- * to have an offset that isn't a round */
- long page_size = get_page_size();
- if (page_size == -1)
- goto err;
- offset_leftover = offset % page_size;
- offset_rounded = offset - offset_leftover;
+ if (!(flags & EVBUF_FS_DISABLE_SENDFILE)) {
+ seg->can_sendfile = 1;
+ goto done;
+ }
+#endif
+
+ if (evbuffer_file_segment_materialize(seg)<0)
+ goto err;
+
+#if defined(USE_SENDFILE)
+done:
+#endif
+ if (!(flags & EVBUF_FS_DISABLE_LOCKING)) {
+ EVTHREAD_ALLOC_LOCK(seg->lock, 0);
+ }
+ return seg;
+err:
+ mm_free(seg);
+ return NULL;
+}
+
+#ifdef EVENT__HAVE_MMAP
+static long
+get_page_size(void)
+{
+#ifdef SC_PAGE_SIZE
+ return sysconf(SC_PAGE_SIZE);
+#elif defined(_SC_PAGE_SIZE)
+ return sysconf(_SC_PAGE_SIZE);
+#else
+ return 1;
+#endif
+}
+#endif
+
+/* DOCDOC */
+/* Requires lock */
+static int
+evbuffer_file_segment_materialize(struct evbuffer_file_segment *seg)
+{
+ const unsigned flags = seg->flags;
+ const int fd = seg->fd;
+ const ev_off_t length = seg->length;
+ const ev_off_t offset = seg->file_offset;
+
+ if (seg->contents)
+ return 0; /* already materialized */
+
+#if defined(EVENT__HAVE_MMAP)
+ if (!(flags & EVBUF_FS_DISABLE_MMAP)) {
+ off_t offset_rounded = 0, offset_leftover = 0;
+ void *mapped;
+ if (offset) {
+ /* mmap implementations don't generally like us
+ * to have an offset that isn't a round */
+ long page_size = get_page_size();
+ if (page_size == -1)
+ goto err;
+ offset_leftover = offset % page_size;
+ offset_rounded = offset - offset_leftover;
}
- mapped = mmap(NULL, length + offset_leftover,
- PROT_READ,
+ mapped = mmap(NULL, length + offset_leftover,
+ PROT_READ,
#ifdef MAP_NOCACHE
- MAP_NOCACHE | /* ??? */
+ MAP_NOCACHE | /* ??? */
#endif
#ifdef MAP_FILE
MAP_FILE |
#endif
MAP_PRIVATE,
- fd, offset_rounded);
+ fd, offset_rounded);
if (mapped == MAP_FAILED) {
event_warn("%s: mmap(%d, %d, %zu) failed",
__func__, fd, 0, (size_t)(offset + length));
- } else {
- seg->mapping = mapped;
- seg->contents = (char*)mapped+offset_leftover;
- seg->mmap_offset = 0;
- seg->is_mapping = 1;
- goto done;
- }
- }
-#endif
-#ifdef _WIN32
- if (!(flags & EVBUF_FS_DISABLE_MMAP)) {
- intptr_t h = _get_osfhandle(fd);
- HANDLE m;
- ev_uint64_t total_size = length+offset;
- if ((HANDLE)h == INVALID_HANDLE_VALUE)
- goto err;
- m = CreateFileMapping((HANDLE)h, NULL, PAGE_READONLY,
- (total_size >> 32), total_size & 0xfffffffful,
- NULL);
- if (m != INVALID_HANDLE_VALUE) { /* Does h leak? */
- seg->mapping_handle = m;
- seg->mmap_offset = offset;
- seg->is_mapping = 1;
- goto done;
- }
- }
-#endif
- {
- ev_off_t start_pos = lseek(fd, 0, SEEK_CUR), pos;
- ev_off_t read_so_far = 0;
- char *mem;
- int e;
- ev_ssize_t n = 0;
- if (!(mem = mm_malloc(length)))
- goto err;
- if (start_pos < 0) {
- mm_free(mem);
- goto err;
- }
- if (lseek(fd, offset, SEEK_SET) < 0) {
- mm_free(mem);
- goto err;
+ } else {
+ seg->mapping = mapped;
+ seg->contents = (char*)mapped+offset_leftover;
+ seg->mmap_offset = 0;
+ seg->is_mapping = 1;
+ goto done;
}
- while (read_so_far < length) {
- n = read(fd, mem+read_so_far, length-read_so_far);
- if (n <= 0)
- break;
- read_so_far += n;
+ }
+#endif
+#ifdef _WIN32
+ if (!(flags & EVBUF_FS_DISABLE_MMAP)) {
+ intptr_t h = _get_osfhandle(fd);
+ HANDLE m;
+ ev_uint64_t total_size = length+offset;
+ if ((HANDLE)h == INVALID_HANDLE_VALUE)
+ goto err;
+ m = CreateFileMapping((HANDLE)h, NULL, PAGE_READONLY,
+ (total_size >> 32), total_size & 0xfffffffful,
+ NULL);
+ if (m != INVALID_HANDLE_VALUE) { /* Does h leak? */
+ seg->mapping_handle = m;
+ seg->mmap_offset = offset;
+ seg->is_mapping = 1;
+ goto done;
}
-
- e = errno;
- pos = lseek(fd, start_pos, SEEK_SET);
- if (n < 0 || (n == 0 && length > read_so_far)) {
- mm_free(mem);
- errno = e;
- goto err;
- } else if (pos < 0) {
- mm_free(mem);
- goto err;
- }
-
- seg->contents = mem;
- }
-
-done:
- return 0;
-err:
- return -1;
-}
-
-void evbuffer_file_segment_add_cleanup_cb(struct evbuffer_file_segment *seg,
- evbuffer_file_segment_cleanup_cb cb, void* arg)
-{
- EVUTIL_ASSERT(seg->refcnt > 0);
- seg->cleanup_cb = cb;
- seg->cleanup_cb_arg = arg;
-}
-
-void
-evbuffer_file_segment_free(struct evbuffer_file_segment *seg)
-{
- int refcnt;
- EVLOCK_LOCK(seg->lock, 0);
- refcnt = --seg->refcnt;
- EVLOCK_UNLOCK(seg->lock, 0);
- if (refcnt > 0)
- return;
- EVUTIL_ASSERT(refcnt == 0);
-
- if (seg->is_mapping) {
-#ifdef _WIN32
- CloseHandle(seg->mapping_handle);
-#elif defined (EVENT__HAVE_MMAP)
- off_t offset_leftover;
- offset_leftover = seg->file_offset % get_page_size();
- if (munmap(seg->mapping, seg->length + offset_leftover) == -1)
- event_warn("%s: munmap failed", __func__);
+ }
+#endif
+ {
+ ev_off_t start_pos = lseek(fd, 0, SEEK_CUR), pos;
+ ev_off_t read_so_far = 0;
+ char *mem;
+ int e;
+ ev_ssize_t n = 0;
+ if (!(mem = mm_malloc(length)))
+ goto err;
+ if (start_pos < 0) {
+ mm_free(mem);
+ goto err;
+ }
+ if (lseek(fd, offset, SEEK_SET) < 0) {
+ mm_free(mem);
+ goto err;
+ }
+ while (read_so_far < length) {
+ n = read(fd, mem+read_so_far, length-read_so_far);
+ if (n <= 0)
+ break;
+ read_so_far += n;
+ }
+
+ e = errno;
+ pos = lseek(fd, start_pos, SEEK_SET);
+ if (n < 0 || (n == 0 && length > read_so_far)) {
+ mm_free(mem);
+ errno = e;
+ goto err;
+ } else if (pos < 0) {
+ mm_free(mem);
+ goto err;
+ }
+
+ seg->contents = mem;
+ }
+
+done:
+ return 0;
+err:
+ return -1;
+}
+
+void evbuffer_file_segment_add_cleanup_cb(struct evbuffer_file_segment *seg,
+ evbuffer_file_segment_cleanup_cb cb, void* arg)
+{
+ EVUTIL_ASSERT(seg->refcnt > 0);
+ seg->cleanup_cb = cb;
+ seg->cleanup_cb_arg = arg;
+}
+
+void
+evbuffer_file_segment_free(struct evbuffer_file_segment *seg)
+{
+ int refcnt;
+ EVLOCK_LOCK(seg->lock, 0);
+ refcnt = --seg->refcnt;
+ EVLOCK_UNLOCK(seg->lock, 0);
+ if (refcnt > 0)
+ return;
+ EVUTIL_ASSERT(refcnt == 0);
+
+ if (seg->is_mapping) {
+#ifdef _WIN32
+ CloseHandle(seg->mapping_handle);
+#elif defined (EVENT__HAVE_MMAP)
+ off_t offset_leftover;
+ offset_leftover = seg->file_offset % get_page_size();
+ if (munmap(seg->mapping, seg->length + offset_leftover) == -1)
+ event_warn("%s: munmap failed", __func__);
#endif
- } else if (seg->contents) {
- mm_free(seg->contents);
- }
-
- if ((seg->flags & EVBUF_FS_CLOSE_ON_FREE) && seg->fd >= 0) {
- close(seg->fd);
- }
-
- if (seg->cleanup_cb) {
- (*seg->cleanup_cb)((struct evbuffer_file_segment const*)seg,
- seg->flags, seg->cleanup_cb_arg);
- seg->cleanup_cb = NULL;
- seg->cleanup_cb_arg = NULL;
- }
-
- EVTHREAD_FREE_LOCK(seg->lock, 0);
- mm_free(seg);
-}
-
-int
-evbuffer_add_file_segment(struct evbuffer *buf,
- struct evbuffer_file_segment *seg, ev_off_t offset, ev_off_t length)
-{
- struct evbuffer_chain *chain;
- struct evbuffer_chain_file_segment *extra;
- int can_use_sendfile = 0;
-
- EVBUFFER_LOCK(buf);
- EVLOCK_LOCK(seg->lock, 0);
- if (buf->flags & EVBUFFER_FLAG_DRAINS_TO_FD) {
- can_use_sendfile = 1;
- } else {
- if (!seg->contents) {
- if (evbuffer_file_segment_materialize(seg)<0) {
- EVLOCK_UNLOCK(seg->lock, 0);
- EVBUFFER_UNLOCK(buf);
- return -1;
+ } else if (seg->contents) {
+ mm_free(seg->contents);
+ }
+
+ if ((seg->flags & EVBUF_FS_CLOSE_ON_FREE) && seg->fd >= 0) {
+ close(seg->fd);
+ }
+
+ if (seg->cleanup_cb) {
+ (*seg->cleanup_cb)((struct evbuffer_file_segment const*)seg,
+ seg->flags, seg->cleanup_cb_arg);
+ seg->cleanup_cb = NULL;
+ seg->cleanup_cb_arg = NULL;
+ }
+
+ EVTHREAD_FREE_LOCK(seg->lock, 0);
+ mm_free(seg);
+}
+
+int
+evbuffer_add_file_segment(struct evbuffer *buf,
+ struct evbuffer_file_segment *seg, ev_off_t offset, ev_off_t length)
+{
+ struct evbuffer_chain *chain;
+ struct evbuffer_chain_file_segment *extra;
+ int can_use_sendfile = 0;
+
+ EVBUFFER_LOCK(buf);
+ EVLOCK_LOCK(seg->lock, 0);
+ if (buf->flags & EVBUFFER_FLAG_DRAINS_TO_FD) {
+ can_use_sendfile = 1;
+ } else {
+ if (!seg->contents) {
+ if (evbuffer_file_segment_materialize(seg)<0) {
+ EVLOCK_UNLOCK(seg->lock, 0);
+ EVBUFFER_UNLOCK(buf);
+ return -1;
}
}
- }
- EVLOCK_UNLOCK(seg->lock, 0);
-
- if (buf->freeze_end)
- goto err;
-
- if (length < 0) {
- if (offset > seg->length)
- goto err;
- length = seg->length - offset;
- }
-
- /* Can we actually add this? */
- if (offset+length > seg->length)
- goto err;
-
- chain = evbuffer_chain_new(sizeof(struct evbuffer_chain_file_segment));
- if (!chain)
- goto err;
- extra = EVBUFFER_CHAIN_EXTRA(struct evbuffer_chain_file_segment, chain);
-
- chain->flags |= EVBUFFER_IMMUTABLE|EVBUFFER_FILESEGMENT;
- if (can_use_sendfile && seg->can_sendfile) {
- chain->flags |= EVBUFFER_SENDFILE;
- chain->misalign = seg->file_offset + offset;
- chain->off = length;
- chain->buffer_len = chain->misalign + length;
- } else if (seg->is_mapping) {
-#ifdef _WIN32
- ev_uint64_t total_offset = seg->mmap_offset+offset;
- ev_uint64_t offset_rounded=0, offset_remaining=0;
- LPVOID data;
- if (total_offset) {
- SYSTEM_INFO si;
- memset(&si, 0, sizeof(si)); /* cargo cult */
- GetSystemInfo(&si);
- offset_remaining = total_offset % si.dwAllocationGranularity;
- offset_rounded = total_offset - offset_remaining;
- }
- data = MapViewOfFile(
- seg->mapping_handle,
- FILE_MAP_READ,
- offset_rounded >> 32,
- offset_rounded & 0xfffffffful,
- length + offset_remaining);
- if (data == NULL) {
- mm_free(chain);
- goto err;
- }
- chain->buffer = (unsigned char*) data;
- chain->buffer_len = length+offset_remaining;
- chain->misalign = offset_remaining;
- chain->off = length;
-#else
- chain->buffer = (unsigned char*)(seg->contents + offset);
- chain->buffer_len = length;
- chain->off = length;
+ }
+ EVLOCK_UNLOCK(seg->lock, 0);
+
+ if (buf->freeze_end)
+ goto err;
+
+ if (length < 0) {
+ if (offset > seg->length)
+ goto err;
+ length = seg->length - offset;
+ }
+
+ /* Can we actually add this? */
+ if (offset+length > seg->length)
+ goto err;
+
+ chain = evbuffer_chain_new(sizeof(struct evbuffer_chain_file_segment));
+ if (!chain)
+ goto err;
+ extra = EVBUFFER_CHAIN_EXTRA(struct evbuffer_chain_file_segment, chain);
+
+ chain->flags |= EVBUFFER_IMMUTABLE|EVBUFFER_FILESEGMENT;
+ if (can_use_sendfile && seg->can_sendfile) {
+ chain->flags |= EVBUFFER_SENDFILE;
+ chain->misalign = seg->file_offset + offset;
+ chain->off = length;
+ chain->buffer_len = chain->misalign + length;
+ } else if (seg->is_mapping) {
+#ifdef _WIN32
+ ev_uint64_t total_offset = seg->mmap_offset+offset;
+ ev_uint64_t offset_rounded=0, offset_remaining=0;
+ LPVOID data;
+ if (total_offset) {
+ SYSTEM_INFO si;
+ memset(&si, 0, sizeof(si)); /* cargo cult */
+ GetSystemInfo(&si);
+ offset_remaining = total_offset % si.dwAllocationGranularity;
+ offset_rounded = total_offset - offset_remaining;
+ }
+ data = MapViewOfFile(
+ seg->mapping_handle,
+ FILE_MAP_READ,
+ offset_rounded >> 32,
+ offset_rounded & 0xfffffffful,
+ length + offset_remaining);
+ if (data == NULL) {
+ mm_free(chain);
+ goto err;
+ }
+ chain->buffer = (unsigned char*) data;
+ chain->buffer_len = length+offset_remaining;
+ chain->misalign = offset_remaining;
+ chain->off = length;
+#else
+ chain->buffer = (unsigned char*)(seg->contents + offset);
+ chain->buffer_len = length;
+ chain->off = length;
#endif
- } else {
- chain->buffer = (unsigned char*)(seg->contents + offset);
- chain->buffer_len = length;
- chain->off = length;
+ } else {
+ chain->buffer = (unsigned char*)(seg->contents + offset);
+ chain->buffer_len = length;
+ chain->off = length;
}
EVLOCK_LOCK(seg->lock, 0);
++seg->refcnt;
EVLOCK_UNLOCK(seg->lock, 0);
- extra->segment = seg;
- buf->n_add_for_cb += length;
- evbuffer_chain_insert(buf, chain);
-
- evbuffer_invoke_callbacks_(buf);
-
- EVBUFFER_UNLOCK(buf);
-
- return 0;
-err:
- EVBUFFER_UNLOCK(buf);
- evbuffer_file_segment_free(seg); /* Lowers the refcount */
- return -1;
-}
-
-int
-evbuffer_add_file(struct evbuffer *buf, int fd, ev_off_t offset, ev_off_t length)
-{
- struct evbuffer_file_segment *seg;
- unsigned flags = EVBUF_FS_CLOSE_ON_FREE;
- int r;
-
- seg = evbuffer_file_segment_new(fd, offset, length, flags);
- if (!seg)
- return -1;
- r = evbuffer_add_file_segment(buf, seg, 0, length);
- if (r == 0)
- evbuffer_file_segment_free(seg);
- return r;
-}
-
-int
+ extra->segment = seg;
+ buf->n_add_for_cb += length;
+ evbuffer_chain_insert(buf, chain);
+
+ evbuffer_invoke_callbacks_(buf);
+
+ EVBUFFER_UNLOCK(buf);
+
+ return 0;
+err:
+ EVBUFFER_UNLOCK(buf);
+ evbuffer_file_segment_free(seg); /* Lowers the refcount */
+ return -1;
+}
+
+int
+evbuffer_add_file(struct evbuffer *buf, int fd, ev_off_t offset, ev_off_t length)
+{
+ struct evbuffer_file_segment *seg;
+ unsigned flags = EVBUF_FS_CLOSE_ON_FREE;
+ int r;
+
+ seg = evbuffer_file_segment_new(fd, offset, length, flags);
+ if (!seg)
+ return -1;
+ r = evbuffer_add_file_segment(buf, seg, 0, length);
+ if (r == 0)
+ evbuffer_file_segment_free(seg);
+ return r;
+}
+
+int
evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg)
{
EVBUFFER_LOCK(buffer);
- if (!LIST_EMPTY(&buffer->callbacks))
+ if (!LIST_EMPTY(&buffer->callbacks))
evbuffer_remove_all_callbacks(buffer);
if (cb) {
struct evbuffer_cb_entry *ent =
evbuffer_add_cb(buffer, NULL, cbarg);
- if (!ent) {
- EVBUFFER_UNLOCK(buffer);
- return -1;
- }
+ if (!ent) {
+ EVBUFFER_UNLOCK(buffer);
+ return -1;
+ }
ent->cb.cb_obsolete = cb;
ent->flags |= EVBUFFER_CB_OBSOLETE;
}
EVBUFFER_UNLOCK(buffer);
- return 0;
+ return 0;
}
struct evbuffer_cb_entry *
@@ -3340,7 +3340,7 @@ evbuffer_add_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg)
e->cb.cb_func = cb;
e->cbarg = cbarg;
e->flags = EVBUFFER_CB_ENABLED;
- LIST_INSERT_HEAD(&buffer->callbacks, e, next);
+ LIST_INSERT_HEAD(&buffer->callbacks, e, next);
EVBUFFER_UNLOCK(buffer);
return e;
}
@@ -3350,7 +3350,7 @@ evbuffer_remove_cb_entry(struct evbuffer *buffer,
struct evbuffer_cb_entry *ent)
{
EVBUFFER_LOCK(buffer);
- LIST_REMOVE(ent, next);
+ LIST_REMOVE(ent, next);
EVBUFFER_UNLOCK(buffer);
mm_free(ent);
return 0;
@@ -3362,7 +3362,7 @@ evbuffer_remove_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg)
struct evbuffer_cb_entry *cbent;
int result = -1;
EVBUFFER_LOCK(buffer);
- LIST_FOREACH(cbent, &buffer->callbacks, next) {
+ LIST_FOREACH(cbent, &buffer->callbacks, next) {
if (cb == cbent->cb.cb_func && cbarg == cbent->cbarg) {
result = evbuffer_remove_cb_entry(buffer, cbent);
goto done;
@@ -3448,20 +3448,20 @@ evbuffer_cb_unsuspend(struct evbuffer *buffer, struct evbuffer_cb_entry *cb)
#endif
int
-evbuffer_get_callbacks_(struct evbuffer *buffer, struct event_callback **cbs,
- int max_cbs)
-{
- int r = 0;
- EVBUFFER_LOCK(buffer);
- if (buffer->deferred_cbs) {
- if (max_cbs < 1) {
- r = -1;
- goto done;
- }
- cbs[0] = &buffer->deferred;
- r = 1;
- }
-done:
- EVBUFFER_UNLOCK(buffer);
- return r;
+evbuffer_get_callbacks_(struct evbuffer *buffer, struct event_callback **cbs,
+ int max_cbs)
+{
+ int r = 0;
+ EVBUFFER_LOCK(buffer);
+ if (buffer->deferred_cbs) {
+ if (max_cbs < 1) {
+ r = -1;
+ goto done;
+ }
+ cbs[0] = &buffer->deferred;
+ r = 1;
+ }
+done:
+ EVBUFFER_UNLOCK(buffer);
+ return r;
}
diff --git a/contrib/libs/libevent/buffer_iocp.c b/contrib/libs/libevent/buffer_iocp.c
index 2af0c49cc6..e5a4b76292 100644
--- a/contrib/libs/libevent/buffer_iocp.c
+++ b/contrib/libs/libevent/buffer_iocp.c
@@ -30,8 +30,8 @@
This module implements overlapped read and write functions for evbuffer
objects on Windows.
*/
-#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "event2/event-config.h"
+#include "evconfig-private.h"
#include "event2/buffer.h"
#include "event2/buffer_compat.h"
@@ -44,7 +44,7 @@
#include "mm-internal.h"
#include <winsock2.h>
-#include <winerror.h>
+#include <winerror.h>
#include <windows.h>
#include <stdio.h>
@@ -89,13 +89,13 @@ pin_release(struct evbuffer_overlapped *eo, unsigned flag)
for (i = 0; i < eo->n_buffers; ++i) {
EVUTIL_ASSERT(chain);
next = chain->next;
- evbuffer_chain_unpin_(chain, flag);
+ evbuffer_chain_unpin_(chain, flag);
chain = next;
}
}
void
-evbuffer_commit_read_(struct evbuffer *evbuf, ev_ssize_t nBytes)
+evbuffer_commit_read_(struct evbuffer *evbuf, ev_ssize_t nBytes)
{
struct evbuffer_overlapped *buf = upcast_evbuffer(evbuf);
struct evbuffer_chain **chainp;
@@ -130,13 +130,13 @@ evbuffer_commit_read_(struct evbuffer *evbuf, ev_ssize_t nBytes)
evbuf->total_len += nBytes;
evbuf->n_add_for_cb += nBytes;
- evbuffer_invoke_callbacks_(evbuf);
+ evbuffer_invoke_callbacks_(evbuf);
- evbuffer_decref_and_unlock_(evbuf);
+ evbuffer_decref_and_unlock_(evbuf);
}
void
-evbuffer_commit_write_(struct evbuffer *evbuf, ev_ssize_t nBytes)
+evbuffer_commit_write_(struct evbuffer *evbuf, ev_ssize_t nBytes)
{
struct evbuffer_overlapped *buf = upcast_evbuffer(evbuf);
@@ -146,11 +146,11 @@ evbuffer_commit_write_(struct evbuffer *evbuf, ev_ssize_t nBytes)
evbuffer_drain(evbuf, nBytes);
pin_release(buf,EVBUFFER_MEM_PINNED_W);
buf->write_in_progress = 0;
- evbuffer_decref_and_unlock_(evbuf);
+ evbuffer_decref_and_unlock_(evbuf);
}
struct evbuffer *
-evbuffer_overlapped_new_(evutil_socket_t fd)
+evbuffer_overlapped_new_(evutil_socket_t fd)
{
struct evbuffer_overlapped *evo;
@@ -158,7 +158,7 @@ evbuffer_overlapped_new_(evutil_socket_t fd)
if (!evo)
return NULL;
- LIST_INIT(&evo->buffer.callbacks);
+ LIST_INIT(&evo->buffer.callbacks);
evo->buffer.refcnt = 1;
evo->buffer.last_with_datap = &evo->buffer.first;
@@ -169,7 +169,7 @@ evbuffer_overlapped_new_(evutil_socket_t fd)
}
int
-evbuffer_launch_write_(struct evbuffer *buf, ev_ssize_t at_most,
+evbuffer_launch_write_(struct evbuffer *buf, ev_ssize_t at_most,
struct event_overlapped *ol)
{
struct evbuffer_overlapped *buf_o = upcast_evbuffer(buf);
@@ -205,7 +205,7 @@ evbuffer_launch_write_(struct evbuffer *buf, ev_ssize_t at_most,
for (i=0; i < MAX_WSABUFS && chain; ++i, chain=chain->next) {
WSABUF *b = &buf_o->buffers[i];
b->buf = (char*)( chain->buffer + chain->misalign );
- evbuffer_chain_pin_(chain, EVBUFFER_MEM_PINNED_W);
+ evbuffer_chain_pin_(chain, EVBUFFER_MEM_PINNED_W);
if ((size_t)at_most > chain->off) {
/* XXXX Cast is safe for now, since win32 has no
@@ -222,7 +222,7 @@ evbuffer_launch_write_(struct evbuffer *buf, ev_ssize_t at_most,
}
buf_o->n_buffers = i;
- evbuffer_incref_(buf);
+ evbuffer_incref_(buf);
if (WSASend(buf_o->fd, buf_o->buffers, i, &bytesSent, 0,
&ol->overlapped, NULL)) {
int error = WSAGetLastError();
@@ -243,7 +243,7 @@ done:
}
int
-evbuffer_launch_read_(struct evbuffer *buf, size_t at_most,
+evbuffer_launch_read_(struct evbuffer *buf, size_t at_most,
struct event_overlapped *ol)
{
struct evbuffer_overlapped *buf_o = upcast_evbuffer(buf);
@@ -266,11 +266,11 @@ evbuffer_launch_read_(struct evbuffer *buf, size_t at_most,
buf_o->n_buffers = 0;
memset(buf_o->buffers, 0, sizeof(buf_o->buffers));
- if (evbuffer_expand_fast_(buf, at_most, MAX_WSABUFS) == -1)
+ if (evbuffer_expand_fast_(buf, at_most, MAX_WSABUFS) == -1)
goto done;
evbuffer_freeze(buf, 0);
- nvecs = evbuffer_read_setup_vecs_(buf, at_most,
+ nvecs = evbuffer_read_setup_vecs_(buf, at_most,
vecs, MAX_WSABUFS, &chainp, 1);
for (i=0;i<nvecs;++i) {
WSABUF_FROM_EVBUFFER_IOV(
@@ -283,12 +283,12 @@ evbuffer_launch_read_(struct evbuffer *buf, size_t at_most,
npin=0;
for ( ; chain; chain = chain->next) {
- evbuffer_chain_pin_(chain, EVBUFFER_MEM_PINNED_R);
+ evbuffer_chain_pin_(chain, EVBUFFER_MEM_PINNED_R);
++npin;
}
EVUTIL_ASSERT(npin == nvecs);
- evbuffer_incref_(buf);
+ evbuffer_incref_(buf);
if (WSARecv(buf_o->fd, buf_o->buffers, nvecs, &bytesRead, &flags,
&ol->overlapped, NULL)) {
int error = WSAGetLastError();
@@ -309,14 +309,14 @@ done:
}
evutil_socket_t
-evbuffer_overlapped_get_fd_(struct evbuffer *buf)
+evbuffer_overlapped_get_fd_(struct evbuffer *buf)
{
struct evbuffer_overlapped *buf_o = upcast_evbuffer(buf);
return buf_o ? buf_o->fd : -1;
}
void
-evbuffer_overlapped_set_fd_(struct evbuffer *buf, evutil_socket_t fd)
+evbuffer_overlapped_set_fd_(struct evbuffer *buf, evutil_socket_t fd)
{
struct evbuffer_overlapped *buf_o = upcast_evbuffer(buf);
EVBUFFER_LOCK(buf);
diff --git a/contrib/libs/libevent/bufferevent-internal.h b/contrib/libs/libevent/bufferevent-internal.h
index c89fa0d6b7..be3950fe0a 100644
--- a/contrib/libs/libevent/bufferevent-internal.h
+++ b/contrib/libs/libevent/bufferevent-internal.h
@@ -23,16 +23,16 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef BUFFEREVENT_INTERNAL_H_INCLUDED_
-#define BUFFEREVENT_INTERNAL_H_INCLUDED_
+#ifndef BUFFEREVENT_INTERNAL_H_INCLUDED_
+#define BUFFEREVENT_INTERNAL_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
#endif
#include "event2/event-config.h"
-#include "event2/event_struct.h"
-#include "evconfig-private.h"
+#include "event2/event_struct.h"
+#include "evconfig-private.h"
#include "event2/util.h"
#include "defer-internal.h"
#include "evthread-internal.h"
@@ -40,17 +40,17 @@ extern "C" {
#include "ratelim-internal.h"
#include "event2/bufferevent_struct.h"
-#include "ipv6-internal.h"
-#ifdef _WIN32
-#include <ws2tcpip.h>
-#endif
-#ifdef EVENT__HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef EVENT__HAVE_NETINET_IN6_H
-#error #include <netinet/in6.h>
-#endif
-
+#include "ipv6-internal.h"
+#ifdef _WIN32
+#include <ws2tcpip.h>
+#endif
+#ifdef EVENT__HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef EVENT__HAVE_NETINET_IN6_H
+#error #include <netinet/in6.h>
+#endif
+
/* These flags are reasons that we might be declining to actually enable
reading or writing on a bufferevent.
*/
@@ -78,7 +78,7 @@ typedef ev_uint16_t bufferevent_suspend_flags;
struct bufferevent_rate_limit_group {
/** List of all members in the group */
- LIST_HEAD(rlim_group_member_list, bufferevent_private) members;
+ LIST_HEAD(rlim_group_member_list, bufferevent_private) members;
/** Current limits for the group. */
struct ev_token_bucket rate_limit;
struct ev_token_bucket_cfg rate_limit_cfg;
@@ -116,10 +116,10 @@ struct bufferevent_rate_limit_group {
/** Timeout event that goes off once a tick, when the bucket is ready
* to refill. */
struct event master_refill_event;
-
- /** Seed for weak random number generator. Protected by 'lock' */
- struct evutil_weakrand_state weakrand_seed;
-
+
+ /** Seed for weak random number generator. Protected by 'lock' */
+ struct evutil_weakrand_state weakrand_seed;
+
/** Lock to protect the members of this group. This lock should nest
* within every bufferevent lock: if you are holding this lock, do
* not assume you can lock another bufferevent. */
@@ -133,7 +133,7 @@ struct bufferevent_rate_limit {
*
* Note that this field is supposed to be protected by the group
* lock */
- LIST_ENTRY(bufferevent_private) next_in_group;
+ LIST_ENTRY(bufferevent_private) next_in_group;
/** The rate-limiting group for this bufferevent, or NULL if it is
* only rate-limited on its own. */
struct bufferevent_rate_limit_group *group;
@@ -194,7 +194,7 @@ struct bufferevent_private {
int dns_error;
/** Used to implement deferred callbacks */
- struct event_callback deferred;
+ struct event_callback deferred;
/** The options this bufferevent was constructed with */
enum bufferevent_options options;
@@ -206,30 +206,30 @@ struct bufferevent_private {
* If NULL, locking is disabled. */
void *lock;
- /** No matter how big our bucket gets, don't try to read more than this
- * much in a single read operation. */
- ev_ssize_t max_single_read;
-
- /** No matter how big our bucket gets, don't try to write more than this
- * much in a single write operation. */
- ev_ssize_t max_single_write;
-
+ /** No matter how big our bucket gets, don't try to read more than this
+ * much in a single read operation. */
+ ev_ssize_t max_single_read;
+
+ /** No matter how big our bucket gets, don't try to write more than this
+ * much in a single write operation. */
+ ev_ssize_t max_single_write;
+
/** Rate-limiting information for this bufferevent */
struct bufferevent_rate_limit *rate_limiting;
-
- /* Saved conn_addr, to extract IP address from it.
- *
- * Because some servers may reset/close connection without waiting clients,
- * in that case we can't extract IP address even in close_cb.
- * So we need to save it, just after we connected to remote server, or
- * after resolving (to avoid extra dns requests during retrying, since UDP
- * is slow) */
- union {
- struct sockaddr_in6 in6;
- struct sockaddr_in in;
- } conn_address;
-
- struct evdns_getaddrinfo_request *dns_request;
+
+ /* Saved conn_addr, to extract IP address from it.
+ *
+ * Because some servers may reset/close connection without waiting clients,
+ * in that case we can't extract IP address even in close_cb.
+ * So we need to save it, just after we connected to remote server, or
+ * after resolving (to avoid extra dns requests during retrying, since UDP
+ * is slow) */
+ union {
+ struct sockaddr_in6 in6;
+ struct sockaddr_in in;
+ } conn_address;
+
+ struct evdns_getaddrinfo_request *dns_request;
};
/** Possible operations for a control callback. */
@@ -277,13 +277,13 @@ struct bufferevent_ops {
*/
int (*disable)(struct bufferevent *, short);
- /** Detatches the bufferevent from related data structures. Called as
- * soon as its reference count reaches 0. */
- void (*unlink)(struct bufferevent *);
-
+ /** Detatches the bufferevent from related data structures. Called as
+ * soon as its reference count reaches 0. */
+ void (*unlink)(struct bufferevent *);
+
/** Free any storage and deallocate any extra data or structures used
- in this implementation. Called when the bufferevent is
- finalized.
+ in this implementation. Called when the bufferevent is
+ finalized.
*/
void (*destruct)(struct bufferevent *);
@@ -306,14 +306,14 @@ extern const struct bufferevent_ops bufferevent_ops_pair;
#define BEV_IS_FILTER(bevp) ((bevp)->be_ops == &bufferevent_ops_filter)
#define BEV_IS_PAIR(bevp) ((bevp)->be_ops == &bufferevent_ops_pair)
-#if defined(EVENT__HAVE_OPENSSL)
-extern const struct bufferevent_ops bufferevent_ops_openssl;
-#define BEV_IS_OPENSSL(bevp) ((bevp)->be_ops == &bufferevent_ops_openssl)
-#else
-#define BEV_IS_OPENSSL(bevp) 0
-#endif
-
-#ifdef _WIN32
+#if defined(EVENT__HAVE_OPENSSL)
+extern const struct bufferevent_ops bufferevent_ops_openssl;
+#define BEV_IS_OPENSSL(bevp) ((bevp)->be_ops == &bufferevent_ops_openssl)
+#else
+#define BEV_IS_OPENSSL(bevp) 0
+#endif
+
+#ifdef _WIN32
extern const struct bufferevent_ops bufferevent_ops_async;
#define BEV_IS_ASYNC(bevp) ((bevp)->be_ops == &bufferevent_ops_async)
#else
@@ -321,103 +321,103 @@ extern const struct bufferevent_ops bufferevent_ops_async;
#endif
/** Initialize the shared parts of a bufferevent. */
-EVENT2_EXPORT_SYMBOL
-int bufferevent_init_common_(struct bufferevent_private *, struct event_base *, const struct bufferevent_ops *, enum bufferevent_options options);
+EVENT2_EXPORT_SYMBOL
+int bufferevent_init_common_(struct bufferevent_private *, struct event_base *, const struct bufferevent_ops *, enum bufferevent_options options);
/** For internal use: temporarily stop all reads on bufev, until the conditions
* in 'what' are over. */
-EVENT2_EXPORT_SYMBOL
-void bufferevent_suspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags what);
+EVENT2_EXPORT_SYMBOL
+void bufferevent_suspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags what);
/** For internal use: clear the conditions 'what' on bufev, and re-enable
* reading if there are no conditions left. */
-EVENT2_EXPORT_SYMBOL
-void bufferevent_unsuspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags what);
+EVENT2_EXPORT_SYMBOL
+void bufferevent_unsuspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags what);
/** For internal use: temporarily stop all writes on bufev, until the conditions
* in 'what' are over. */
-void bufferevent_suspend_write_(struct bufferevent *bufev, bufferevent_suspend_flags what);
+void bufferevent_suspend_write_(struct bufferevent *bufev, bufferevent_suspend_flags what);
/** For internal use: clear the conditions 'what' on bufev, and re-enable
* writing if there are no conditions left. */
-void bufferevent_unsuspend_write_(struct bufferevent *bufev, bufferevent_suspend_flags what);
+void bufferevent_unsuspend_write_(struct bufferevent *bufev, bufferevent_suspend_flags what);
#define bufferevent_wm_suspend_read(b) \
- bufferevent_suspend_read_((b), BEV_SUSPEND_WM)
+ bufferevent_suspend_read_((b), BEV_SUSPEND_WM)
#define bufferevent_wm_unsuspend_read(b) \
- bufferevent_unsuspend_read_((b), BEV_SUSPEND_WM)
+ bufferevent_unsuspend_read_((b), BEV_SUSPEND_WM)
/*
Disable a bufferevent. Equivalent to bufferevent_disable(), but
first resets 'connecting' flag to force EV_WRITE down for sure.
XXXX this method will go away in the future; try not to add new users.
- See comment in evhttp_connection_reset_() for discussion.
+ See comment in evhttp_connection_reset_() for discussion.
@param bufev the bufferevent to be disabled
@param event any combination of EV_READ | EV_WRITE.
@return 0 if successful, or -1 if an error occurred
@see bufferevent_disable()
*/
-EVENT2_EXPORT_SYMBOL
-int bufferevent_disable_hard_(struct bufferevent *bufev, short event);
+EVENT2_EXPORT_SYMBOL
+int bufferevent_disable_hard_(struct bufferevent *bufev, short event);
/** Internal: Set up locking on a bufferevent. If lock is set, use it.
* Otherwise, use a new lock. */
-EVENT2_EXPORT_SYMBOL
-int bufferevent_enable_locking_(struct bufferevent *bufev, void *lock);
-/** Internal: backwards compat macro for the now public function
- * Increment the reference count on bufev. */
-#define bufferevent_incref_(bufev) bufferevent_incref(bufev)
+EVENT2_EXPORT_SYMBOL
+int bufferevent_enable_locking_(struct bufferevent *bufev, void *lock);
+/** Internal: backwards compat macro for the now public function
+ * Increment the reference count on bufev. */
+#define bufferevent_incref_(bufev) bufferevent_incref(bufev)
/** Internal: Lock bufev and increase its reference count.
* unlocking it otherwise. */
-EVENT2_EXPORT_SYMBOL
-void bufferevent_incref_and_lock_(struct bufferevent *bufev);
-/** Internal: backwards compat macro for the now public function
- * Decrement the reference count on bufev. Returns 1 if it freed
+EVENT2_EXPORT_SYMBOL
+void bufferevent_incref_and_lock_(struct bufferevent *bufev);
+/** Internal: backwards compat macro for the now public function
+ * Decrement the reference count on bufev. Returns 1 if it freed
* the bufferevent.*/
-#define bufferevent_decref_(bufev) bufferevent_decref(bufev)
-
+#define bufferevent_decref_(bufev) bufferevent_decref(bufev)
+
/** Internal: Drop the reference count on bufev, freeing as necessary, and
* unlocking it otherwise. Returns 1 if it freed the bufferevent. */
-EVENT2_EXPORT_SYMBOL
-int bufferevent_decref_and_unlock_(struct bufferevent *bufev);
+EVENT2_EXPORT_SYMBOL
+int bufferevent_decref_and_unlock_(struct bufferevent *bufev);
/** Internal: If callbacks are deferred and we have a read callback, schedule
- * a readcb. Otherwise just run the readcb. Ignores watermarks. */
-EVENT2_EXPORT_SYMBOL
-void bufferevent_run_readcb_(struct bufferevent *bufev, int options);
+ * a readcb. Otherwise just run the readcb. Ignores watermarks. */
+EVENT2_EXPORT_SYMBOL
+void bufferevent_run_readcb_(struct bufferevent *bufev, int options);
/** Internal: If callbacks are deferred and we have a write callback, schedule
- * a writecb. Otherwise just run the writecb. Ignores watermarks. */
-EVENT2_EXPORT_SYMBOL
-void bufferevent_run_writecb_(struct bufferevent *bufev, int options);
+ * a writecb. Otherwise just run the writecb. Ignores watermarks. */
+EVENT2_EXPORT_SYMBOL
+void bufferevent_run_writecb_(struct bufferevent *bufev, int options);
/** Internal: If callbacks are deferred and we have an eventcb, schedule
- * it to run with events "what". Otherwise just run the eventcb.
- * See bufferevent_trigger_event for meaning of "options". */
-EVENT2_EXPORT_SYMBOL
-void bufferevent_run_eventcb_(struct bufferevent *bufev, short what, int options);
-
-/** Internal: Run or schedule (if deferred or options contain
- * BEV_TRIG_DEFER_CALLBACKS) I/O callbacks specified in iotype.
- * Must already hold the bufev lock. Honors watermarks unless
- * BEV_TRIG_IGNORE_WATERMARKS is in options. */
-static inline void bufferevent_trigger_nolock_(struct bufferevent *bufev, short iotype, int options);
-
-/* Making this inline since all of the common-case calls to this function in
- * libevent use constant arguments. */
-static inline void
-bufferevent_trigger_nolock_(struct bufferevent *bufev, short iotype, int options)
-{
- if ((iotype & EV_READ) && ((options & BEV_TRIG_IGNORE_WATERMARKS) ||
- evbuffer_get_length(bufev->input) >= bufev->wm_read.low))
- bufferevent_run_readcb_(bufev, options);
- if ((iotype & EV_WRITE) && ((options & BEV_TRIG_IGNORE_WATERMARKS) ||
- evbuffer_get_length(bufev->output) <= bufev->wm_write.low))
- bufferevent_run_writecb_(bufev, options);
-}
-
+ * it to run with events "what". Otherwise just run the eventcb.
+ * See bufferevent_trigger_event for meaning of "options". */
+EVENT2_EXPORT_SYMBOL
+void bufferevent_run_eventcb_(struct bufferevent *bufev, short what, int options);
+
+/** Internal: Run or schedule (if deferred or options contain
+ * BEV_TRIG_DEFER_CALLBACKS) I/O callbacks specified in iotype.
+ * Must already hold the bufev lock. Honors watermarks unless
+ * BEV_TRIG_IGNORE_WATERMARKS is in options. */
+static inline void bufferevent_trigger_nolock_(struct bufferevent *bufev, short iotype, int options);
+
+/* Making this inline since all of the common-case calls to this function in
+ * libevent use constant arguments. */
+static inline void
+bufferevent_trigger_nolock_(struct bufferevent *bufev, short iotype, int options)
+{
+ if ((iotype & EV_READ) && ((options & BEV_TRIG_IGNORE_WATERMARKS) ||
+ evbuffer_get_length(bufev->input) >= bufev->wm_read.low))
+ bufferevent_run_readcb_(bufev, options);
+ if ((iotype & EV_WRITE) && ((options & BEV_TRIG_IGNORE_WATERMARKS) ||
+ evbuffer_get_length(bufev->output) <= bufev->wm_write.low))
+ bufferevent_run_writecb_(bufev, options);
+}
+
/** Internal: Add the event 'ev' with timeout tv, unless tv is set to 0, in
* which case add ev with no timeout. */
-EVENT2_EXPORT_SYMBOL
-int bufferevent_add_event_(struct event *ev, const struct timeval *tv);
+EVENT2_EXPORT_SYMBOL
+int bufferevent_add_event_(struct event *ev, const struct timeval *tv);
/* =========
* These next functions implement timeouts for bufferevents that aren't doing
@@ -426,33 +426,33 @@ int bufferevent_add_event_(struct event *ev, const struct timeval *tv);
/** Internal use: Set up the ev_read and ev_write callbacks so that
* the other "generic_timeout" functions will work on it. Call this from
* the constructor function. */
-EVENT2_EXPORT_SYMBOL
-void bufferevent_init_generic_timeout_cbs_(struct bufferevent *bev);
+EVENT2_EXPORT_SYMBOL
+void bufferevent_init_generic_timeout_cbs_(struct bufferevent *bev);
/** Internal use: Add or delete the generic timeout events as appropriate.
* (If an event is enabled and a timeout is set, we add the event. Otherwise
* we delete it.) Call this from anything that changes the timeout values,
* that enabled EV_READ or EV_WRITE, or that disables EV_READ or EV_WRITE. */
-EVENT2_EXPORT_SYMBOL
-int bufferevent_generic_adj_timeouts_(struct bufferevent *bev);
-EVENT2_EXPORT_SYMBOL
-int bufferevent_generic_adj_existing_timeouts_(struct bufferevent *bev);
-
-EVENT2_EXPORT_SYMBOL
-enum bufferevent_options bufferevent_get_options_(struct bufferevent *bev);
-
-EVENT2_EXPORT_SYMBOL
-const struct sockaddr*
-bufferevent_socket_get_conn_address_(struct bufferevent *bev);
-
-EVENT2_EXPORT_SYMBOL
-void
-bufferevent_socket_set_conn_address_fd_(struct bufferevent *bev, evutil_socket_t fd);
-
-EVENT2_EXPORT_SYMBOL
-void
-bufferevent_socket_set_conn_address_(struct bufferevent *bev, struct sockaddr *addr, size_t addrlen);
-
-
+EVENT2_EXPORT_SYMBOL
+int bufferevent_generic_adj_timeouts_(struct bufferevent *bev);
+EVENT2_EXPORT_SYMBOL
+int bufferevent_generic_adj_existing_timeouts_(struct bufferevent *bev);
+
+EVENT2_EXPORT_SYMBOL
+enum bufferevent_options bufferevent_get_options_(struct bufferevent *bev);
+
+EVENT2_EXPORT_SYMBOL
+const struct sockaddr*
+bufferevent_socket_get_conn_address_(struct bufferevent *bev);
+
+EVENT2_EXPORT_SYMBOL
+void
+bufferevent_socket_set_conn_address_fd_(struct bufferevent *bev, evutil_socket_t fd);
+
+EVENT2_EXPORT_SYMBOL
+void
+bufferevent_socket_set_conn_address_(struct bufferevent *bev, struct sockaddr *addr, size_t addrlen);
+
+
/** Internal use: We have just successfully read data into an inbuf, so
* reset the read timeout (if any). */
#define BEV_RESET_GENERIC_READ_TIMEOUT(bev) \
@@ -477,9 +477,9 @@ bufferevent_socket_set_conn_address_(struct bufferevent *bev, struct sockaddr *a
* bufferevent_private. */
#define BEV_UPCAST(b) EVUTIL_UPCAST((b), struct bufferevent_private, bev)
-#ifdef EVENT__DISABLE_THREAD_SUPPORT
-#define BEV_LOCK(b) EVUTIL_NIL_STMT_
-#define BEV_UNLOCK(b) EVUTIL_NIL_STMT_
+#ifdef EVENT__DISABLE_THREAD_SUPPORT
+#define BEV_LOCK(b) EVUTIL_NIL_STMT_
+#define BEV_UNLOCK(b) EVUTIL_NIL_STMT_
#else
/** Internal: Grab the lock (if any) on a bufferevent */
#define BEV_LOCK(b) do { \
@@ -497,22 +497,22 @@ bufferevent_socket_set_conn_address_(struct bufferevent *bev, struct sockaddr *a
/* ==== For rate-limiting. */
-EVENT2_EXPORT_SYMBOL
-int bufferevent_decrement_write_buckets_(struct bufferevent_private *bev,
+EVENT2_EXPORT_SYMBOL
+int bufferevent_decrement_write_buckets_(struct bufferevent_private *bev,
ev_ssize_t bytes);
-EVENT2_EXPORT_SYMBOL
-int bufferevent_decrement_read_buckets_(struct bufferevent_private *bev,
+EVENT2_EXPORT_SYMBOL
+int bufferevent_decrement_read_buckets_(struct bufferevent_private *bev,
ev_ssize_t bytes);
-EVENT2_EXPORT_SYMBOL
-ev_ssize_t bufferevent_get_read_max_(struct bufferevent_private *bev);
-EVENT2_EXPORT_SYMBOL
-ev_ssize_t bufferevent_get_write_max_(struct bufferevent_private *bev);
-
-int bufferevent_ratelim_init_(struct bufferevent_private *bev);
+EVENT2_EXPORT_SYMBOL
+ev_ssize_t bufferevent_get_read_max_(struct bufferevent_private *bev);
+EVENT2_EXPORT_SYMBOL
+ev_ssize_t bufferevent_get_write_max_(struct bufferevent_private *bev);
+int bufferevent_ratelim_init_(struct bufferevent_private *bev);
+
#ifdef __cplusplus
}
#endif
-#endif /* BUFFEREVENT_INTERNAL_H_INCLUDED_ */
+#endif /* BUFFEREVENT_INTERNAL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/bufferevent.c b/contrib/libs/libevent/bufferevent.c
index 08c0486c08..ed09604241 100644
--- a/contrib/libs/libevent/bufferevent.c
+++ b/contrib/libs/libevent/bufferevent.c
@@ -25,12 +25,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "event2/event-config.h"
-#include "evconfig-private.h"
-
+#include "event2/event-config.h"
+#include "evconfig-private.h"
+
#include <sys/types.h>
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -38,11 +38,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef EVENT__HAVE_STDARG_H
+#ifdef EVENT__HAVE_STDARG_H
#include <stdarg.h>
#endif
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
@@ -53,20 +53,20 @@
#include "event2/bufferevent_struct.h"
#include "event2/bufferevent_compat.h"
#include "event2/event.h"
-#include "event-internal.h"
+#include "event-internal.h"
#include "log-internal.h"
#include "mm-internal.h"
#include "bufferevent-internal.h"
#include "evbuffer-internal.h"
#include "util-internal.h"
-static void bufferevent_cancel_all_(struct bufferevent *bev);
-static void bufferevent_finalize_cb_(struct event_callback *evcb, void *arg_);
+static void bufferevent_cancel_all_(struct bufferevent *bev);
+static void bufferevent_finalize_cb_(struct event_callback *evcb, void *arg_);
void
-bufferevent_suspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags what)
+bufferevent_suspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags what)
{
- struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
BEV_LOCK(bufev);
if (!bufev_private->read_suspended)
bufev->be_ops->disable(bufev, EV_READ);
@@ -75,9 +75,9 @@ bufferevent_suspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags w
}
void
-bufferevent_unsuspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags what)
+bufferevent_unsuspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags what)
{
- struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
BEV_LOCK(bufev);
bufev_private->read_suspended &= ~what;
if (!bufev_private->read_suspended && (bufev->enabled & EV_READ))
@@ -86,9 +86,9 @@ bufferevent_unsuspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags
}
void
-bufferevent_suspend_write_(struct bufferevent *bufev, bufferevent_suspend_flags what)
+bufferevent_suspend_write_(struct bufferevent *bufev, bufferevent_suspend_flags what)
{
- struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
BEV_LOCK(bufev);
if (!bufev_private->write_suspended)
bufev->be_ops->disable(bufev, EV_WRITE);
@@ -97,9 +97,9 @@ bufferevent_suspend_write_(struct bufferevent *bufev, bufferevent_suspend_flags
}
void
-bufferevent_unsuspend_write_(struct bufferevent *bufev, bufferevent_suspend_flags what)
+bufferevent_unsuspend_write_(struct bufferevent *bufev, bufferevent_suspend_flags what)
{
- struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
BEV_LOCK(bufev);
bufev_private->write_suspended &= ~what;
if (!bufev_private->write_suspended && (bufev->enabled & EV_WRITE))
@@ -107,29 +107,29 @@ bufferevent_unsuspend_write_(struct bufferevent *bufev, bufferevent_suspend_flag
BEV_UNLOCK(bufev);
}
-/**
- * Sometimes bufferevent's implementation can overrun high watermarks
- * (one of examples is openssl) and in this case if the read callback
- * will not handle enough data do over condition above the read
- * callback will never be called again (due to suspend above).
- *
- * To avoid this we are scheduling read callback again here, but only
- * from the user callback to avoid multiple scheduling:
- * - when the data had been added to it
- * - when the data had been drained from it (user specified read callback)
- */
-static void bufferevent_inbuf_wm_check(struct bufferevent *bev)
-{
- if (!bev->wm_read.high)
- return;
- if (!(bev->enabled & EV_READ))
- return;
- if (evbuffer_get_length(bev->input) < bev->wm_read.high)
- return;
-
- bufferevent_trigger(bev, EV_READ, BEV_OPT_DEFER_CALLBACKS);
-}
-
+/**
+ * Sometimes bufferevent's implementation can overrun high watermarks
+ * (one of examples is openssl) and in this case if the read callback
+ * will not handle enough data do over condition above the read
+ * callback will never be called again (due to suspend above).
+ *
+ * To avoid this we are scheduling read callback again here, but only
+ * from the user callback to avoid multiple scheduling:
+ * - when the data had been added to it
+ * - when the data had been drained from it (user specified read callback)
+ */
+static void bufferevent_inbuf_wm_check(struct bufferevent *bev)
+{
+ if (!bev->wm_read.high)
+ return;
+ if (!(bev->enabled & EV_READ))
+ return;
+ if (evbuffer_get_length(bev->input) < bev->wm_read.high)
+ return;
+
+ bufferevent_trigger(bev, EV_READ, BEV_OPT_DEFER_CALLBACKS);
+}
+
/* Callback to implement watermarks on the input buffer. Only enabled
* if the watermark is set. */
static void
@@ -149,7 +149,7 @@ bufferevent_inbuf_wm_cb(struct evbuffer *buf,
}
static void
-bufferevent_run_deferred_callbacks_locked(struct event_callback *cb, void *arg)
+bufferevent_run_deferred_callbacks_locked(struct event_callback *cb, void *arg)
{
struct bufferevent_private *bufev_private = arg;
struct bufferevent *bufev = &bufev_private->bev;
@@ -165,7 +165,7 @@ bufferevent_run_deferred_callbacks_locked(struct event_callback *cb, void *arg)
if (bufev_private->readcb_pending && bufev->readcb) {
bufev_private->readcb_pending = 0;
bufev->readcb(bufev, bufev->cbarg);
- bufferevent_inbuf_wm_check(bufev);
+ bufferevent_inbuf_wm_check(bufev);
}
if (bufev_private->writecb_pending && bufev->writecb) {
bufev_private->writecb_pending = 0;
@@ -179,11 +179,11 @@ bufferevent_run_deferred_callbacks_locked(struct event_callback *cb, void *arg)
EVUTIL_SET_SOCKET_ERROR(err);
bufev->errorcb(bufev, what, bufev->cbarg);
}
- bufferevent_decref_and_unlock_(bufev);
+ bufferevent_decref_and_unlock_(bufev);
}
static void
-bufferevent_run_deferred_callbacks_unlocked(struct event_callback *cb, void *arg)
+bufferevent_run_deferred_callbacks_unlocked(struct event_callback *cb, void *arg)
{
struct bufferevent_private *bufev_private = arg;
struct bufferevent *bufev = &bufev_private->bev;
@@ -206,7 +206,7 @@ bufferevent_run_deferred_callbacks_unlocked(struct event_callback *cb, void *arg
void *cbarg = bufev->cbarg;
bufev_private->readcb_pending = 0;
UNLOCKED(readcb(bufev, cbarg));
- bufferevent_inbuf_wm_check(bufev);
+ bufferevent_inbuf_wm_check(bufev);
}
if (bufev_private->writecb_pending && bufev->writecb) {
bufferevent_data_cb writecb = bufev->writecb;
@@ -224,89 +224,89 @@ bufferevent_run_deferred_callbacks_unlocked(struct event_callback *cb, void *arg
EVUTIL_SET_SOCKET_ERROR(err);
UNLOCKED(errorcb(bufev,what,cbarg));
}
- bufferevent_decref_and_unlock_(bufev);
+ bufferevent_decref_and_unlock_(bufev);
#undef UNLOCKED
}
#define SCHEDULE_DEFERRED(bevp) \
do { \
- if (event_deferred_cb_schedule_( \
- (bevp)->bev.ev_base, \
- &(bevp)->deferred)) \
- bufferevent_incref_(&(bevp)->bev); \
+ if (event_deferred_cb_schedule_( \
+ (bevp)->bev.ev_base, \
+ &(bevp)->deferred)) \
+ bufferevent_incref_(&(bevp)->bev); \
} while (0)
void
-bufferevent_run_readcb_(struct bufferevent *bufev, int options)
+bufferevent_run_readcb_(struct bufferevent *bufev, int options)
{
/* Requires that we hold the lock and a reference */
- struct bufferevent_private *p = BEV_UPCAST(bufev);
+ struct bufferevent_private *p = BEV_UPCAST(bufev);
if (bufev->readcb == NULL)
return;
- if ((p->options|options) & BEV_OPT_DEFER_CALLBACKS) {
+ if ((p->options|options) & BEV_OPT_DEFER_CALLBACKS) {
p->readcb_pending = 1;
- SCHEDULE_DEFERRED(p);
+ SCHEDULE_DEFERRED(p);
} else {
bufev->readcb(bufev, bufev->cbarg);
- bufferevent_inbuf_wm_check(bufev);
+ bufferevent_inbuf_wm_check(bufev);
}
}
void
-bufferevent_run_writecb_(struct bufferevent *bufev, int options)
+bufferevent_run_writecb_(struct bufferevent *bufev, int options)
{
/* Requires that we hold the lock and a reference */
- struct bufferevent_private *p = BEV_UPCAST(bufev);
+ struct bufferevent_private *p = BEV_UPCAST(bufev);
if (bufev->writecb == NULL)
return;
- if ((p->options|options) & BEV_OPT_DEFER_CALLBACKS) {
+ if ((p->options|options) & BEV_OPT_DEFER_CALLBACKS) {
p->writecb_pending = 1;
- SCHEDULE_DEFERRED(p);
+ SCHEDULE_DEFERRED(p);
} else {
bufev->writecb(bufev, bufev->cbarg);
}
}
-#define BEV_TRIG_ALL_OPTS ( \
- BEV_TRIG_IGNORE_WATERMARKS| \
- BEV_TRIG_DEFER_CALLBACKS \
- )
-
-void
-bufferevent_trigger(struct bufferevent *bufev, short iotype, int options)
-{
- bufferevent_incref_and_lock_(bufev);
- bufferevent_trigger_nolock_(bufev, iotype, options&BEV_TRIG_ALL_OPTS);
- bufferevent_decref_and_unlock_(bufev);
-}
-
+#define BEV_TRIG_ALL_OPTS ( \
+ BEV_TRIG_IGNORE_WATERMARKS| \
+ BEV_TRIG_DEFER_CALLBACKS \
+ )
+
void
-bufferevent_run_eventcb_(struct bufferevent *bufev, short what, int options)
+bufferevent_trigger(struct bufferevent *bufev, short iotype, int options)
{
+ bufferevent_incref_and_lock_(bufev);
+ bufferevent_trigger_nolock_(bufev, iotype, options&BEV_TRIG_ALL_OPTS);
+ bufferevent_decref_and_unlock_(bufev);
+}
+
+void
+bufferevent_run_eventcb_(struct bufferevent *bufev, short what, int options)
+{
/* Requires that we hold the lock and a reference */
- struct bufferevent_private *p = BEV_UPCAST(bufev);
+ struct bufferevent_private *p = BEV_UPCAST(bufev);
if (bufev->errorcb == NULL)
return;
- if ((p->options|options) & BEV_OPT_DEFER_CALLBACKS) {
+ if ((p->options|options) & BEV_OPT_DEFER_CALLBACKS) {
p->eventcb_pending |= what;
p->errno_pending = EVUTIL_SOCKET_ERROR();
- SCHEDULE_DEFERRED(p);
+ SCHEDULE_DEFERRED(p);
} else {
bufev->errorcb(bufev, what, bufev->cbarg);
}
}
-void
-bufferevent_trigger_event(struct bufferevent *bufev, short what, int options)
-{
- bufferevent_incref_and_lock_(bufev);
- bufferevent_run_eventcb_(bufev, what, options&BEV_TRIG_ALL_OPTS);
- bufferevent_decref_and_unlock_(bufev);
-}
-
+void
+bufferevent_trigger_event(struct bufferevent *bufev, short what, int options)
+{
+ bufferevent_incref_and_lock_(bufev);
+ bufferevent_run_eventcb_(bufev, what, options&BEV_TRIG_ALL_OPTS);
+ bufferevent_decref_and_unlock_(bufev);
+}
+
int
-bufferevent_init_common_(struct bufferevent_private *bufev_private,
+bufferevent_init_common_(struct bufferevent_private *bufev_private,
struct event_base *base,
const struct bufferevent_ops *ops,
enum bufferevent_options options)
@@ -315,12 +315,12 @@ bufferevent_init_common_(struct bufferevent_private *bufev_private,
if (!bufev->input) {
if ((bufev->input = evbuffer_new()) == NULL)
- goto err;
+ goto err;
}
if (!bufev->output) {
- if ((bufev->output = evbuffer_new()) == NULL)
- goto err;
+ if ((bufev->output = evbuffer_new()) == NULL)
+ goto err;
}
bufev_private->refcnt = 1;
@@ -332,9 +332,9 @@ bufferevent_init_common_(struct bufferevent_private *bufev_private,
bufev->be_ops = ops;
- if (bufferevent_ratelim_init_(bufev_private))
- goto err;
-
+ if (bufferevent_ratelim_init_(bufev_private))
+ goto err;
+
/*
* Set to EV_WRITE so that using bufferevent_write is going to
* trigger a callback. Reading needs to be explicitly enabled
@@ -342,47 +342,47 @@ bufferevent_init_common_(struct bufferevent_private *bufev_private,
*/
bufev->enabled = EV_WRITE;
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
if (options & BEV_OPT_THREADSAFE) {
- if (bufferevent_enable_locking_(bufev, NULL) < 0)
- goto err;
+ if (bufferevent_enable_locking_(bufev, NULL) < 0)
+ goto err;
}
#endif
if ((options & (BEV_OPT_DEFER_CALLBACKS|BEV_OPT_UNLOCK_CALLBACKS))
== BEV_OPT_UNLOCK_CALLBACKS) {
event_warnx("UNLOCK_CALLBACKS requires DEFER_CALLBACKS");
- goto err;
+ goto err;
}
- if (options & BEV_OPT_UNLOCK_CALLBACKS)
- event_deferred_cb_init_(
- &bufev_private->deferred,
- event_base_get_npriorities(base) / 2,
- bufferevent_run_deferred_callbacks_unlocked,
- bufev_private);
- else
- event_deferred_cb_init_(
- &bufev_private->deferred,
- event_base_get_npriorities(base) / 2,
- bufferevent_run_deferred_callbacks_locked,
- bufev_private);
+ if (options & BEV_OPT_UNLOCK_CALLBACKS)
+ event_deferred_cb_init_(
+ &bufev_private->deferred,
+ event_base_get_npriorities(base) / 2,
+ bufferevent_run_deferred_callbacks_unlocked,
+ bufev_private);
+ else
+ event_deferred_cb_init_(
+ &bufev_private->deferred,
+ event_base_get_npriorities(base) / 2,
+ bufferevent_run_deferred_callbacks_locked,
+ bufev_private);
bufev_private->options = options;
- evbuffer_set_parent_(bufev->input, bufev);
- evbuffer_set_parent_(bufev->output, bufev);
+ evbuffer_set_parent_(bufev->input, bufev);
+ evbuffer_set_parent_(bufev->output, bufev);
return 0;
-
-err:
- if (bufev->input) {
- evbuffer_free(bufev->input);
- bufev->input = NULL;
- }
- if (bufev->output) {
- evbuffer_free(bufev->output);
- bufev->output = NULL;
- }
- return -1;
+
+err:
+ if (bufev->input) {
+ evbuffer_free(bufev->input);
+ bufev->input = NULL;
+ }
+ if (bufev->output) {
+ evbuffer_free(bufev->output);
+ bufev->output = NULL;
+ }
+ return -1;
}
void
@@ -400,26 +400,26 @@ bufferevent_setcb(struct bufferevent *bufev,
BEV_UNLOCK(bufev);
}
-void
-bufferevent_getcb(struct bufferevent *bufev,
- bufferevent_data_cb *readcb_ptr,
- bufferevent_data_cb *writecb_ptr,
- bufferevent_event_cb *eventcb_ptr,
- void **cbarg_ptr)
-{
- BEV_LOCK(bufev);
- if (readcb_ptr)
- *readcb_ptr = bufev->readcb;
- if (writecb_ptr)
- *writecb_ptr = bufev->writecb;
- if (eventcb_ptr)
- *eventcb_ptr = bufev->errorcb;
- if (cbarg_ptr)
- *cbarg_ptr = bufev->cbarg;
-
- BEV_UNLOCK(bufev);
-}
-
+void
+bufferevent_getcb(struct bufferevent *bufev,
+ bufferevent_data_cb *readcb_ptr,
+ bufferevent_data_cb *writecb_ptr,
+ bufferevent_event_cb *eventcb_ptr,
+ void **cbarg_ptr)
+{
+ BEV_LOCK(bufev);
+ if (readcb_ptr)
+ *readcb_ptr = bufev->readcb;
+ if (writecb_ptr)
+ *writecb_ptr = bufev->writecb;
+ if (eventcb_ptr)
+ *eventcb_ptr = bufev->errorcb;
+ if (cbarg_ptr)
+ *cbarg_ptr = bufev->cbarg;
+
+ BEV_UNLOCK(bufev);
+}
+
struct evbuffer *
bufferevent_get_input(struct bufferevent *bufev)
{
@@ -439,16 +439,16 @@ bufferevent_get_base(struct bufferevent *bufev)
}
int
-bufferevent_get_priority(const struct bufferevent *bufev)
-{
- if (event_initialized(&bufev->ev_read)) {
- return event_get_priority(&bufev->ev_read);
- } else {
- return event_base_get_npriorities(bufev->ev_base) / 2;
- }
-}
-
-int
+bufferevent_get_priority(const struct bufferevent *bufev)
+{
+ if (event_initialized(&bufev->ev_read)) {
+ return event_get_priority(&bufev->ev_read);
+ } else {
+ return event_base_get_npriorities(bufev->ev_base) / 2;
+ }
+}
+
+int
bufferevent_write(struct bufferevent *bufev, const void *data, size_t size)
{
if (evbuffer_add(bufev->output, data, size) == -1)
@@ -481,11 +481,11 @@ bufferevent_read_buffer(struct bufferevent *bufev, struct evbuffer *buf)
int
bufferevent_enable(struct bufferevent *bufev, short event)
{
- struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
short impl_events = event;
int r = 0;
- bufferevent_incref_and_lock_(bufev);
+ bufferevent_incref_and_lock_(bufev);
if (bufev_private->read_suspended)
impl_events &= ~EV_READ;
if (bufev_private->write_suspended)
@@ -495,10 +495,10 @@ bufferevent_enable(struct bufferevent *bufev, short event)
if (impl_events && bufev->be_ops->enable(bufev, impl_events) < 0)
r = -1;
- if (r)
- event_debug(("%s: cannot enable 0x%hx on %p", __func__, event, bufev));
+ if (r)
+ event_debug(("%s: cannot enable 0x%hx on %p", __func__, event, bufev));
- bufferevent_decref_and_unlock_(bufev);
+ bufferevent_decref_and_unlock_(bufev);
return r;
}
@@ -553,10 +553,10 @@ bufferevent_settimeout(struct bufferevent *bufev,
int
-bufferevent_disable_hard_(struct bufferevent *bufev, short event)
+bufferevent_disable_hard_(struct bufferevent *bufev, short event)
{
int r = 0;
- struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
BEV_LOCK(bufev);
bufev->enabled &= ~event;
@@ -579,8 +579,8 @@ bufferevent_disable(struct bufferevent *bufev, short event)
if (bufev->be_ops->disable(bufev, event) < 0)
r = -1;
- if (r)
- event_debug(("%s: cannot disable 0x%hx on %p", __func__, event, bufev));
+ if (r)
+ event_debug(("%s: cannot disable 0x%hx on %p", __func__, event, bufev));
BEV_UNLOCK(bufev);
return r;
@@ -594,7 +594,7 @@ void
bufferevent_setwatermark(struct bufferevent *bufev, short events,
size_t lowmark, size_t highmark)
{
- struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
BEV_LOCK(bufev);
if (events & EV_WRITE) {
@@ -638,32 +638,32 @@ bufferevent_setwatermark(struct bufferevent *bufev, short events,
}
int
-bufferevent_getwatermark(struct bufferevent *bufev, short events,
- size_t *lowmark, size_t *highmark)
-{
- if (events == EV_WRITE) {
- BEV_LOCK(bufev);
- if (lowmark)
- *lowmark = bufev->wm_write.low;
- if (highmark)
- *highmark = bufev->wm_write.high;
- BEV_UNLOCK(bufev);
- return 0;
- }
-
- if (events == EV_READ) {
- BEV_LOCK(bufev);
- if (lowmark)
- *lowmark = bufev->wm_read.low;
- if (highmark)
- *highmark = bufev->wm_read.high;
- BEV_UNLOCK(bufev);
- return 0;
- }
- return -1;
-}
-
-int
+bufferevent_getwatermark(struct bufferevent *bufev, short events,
+ size_t *lowmark, size_t *highmark)
+{
+ if (events == EV_WRITE) {
+ BEV_LOCK(bufev);
+ if (lowmark)
+ *lowmark = bufev->wm_write.low;
+ if (highmark)
+ *highmark = bufev->wm_write.high;
+ BEV_UNLOCK(bufev);
+ return 0;
+ }
+
+ if (events == EV_READ) {
+ BEV_LOCK(bufev);
+ if (lowmark)
+ *lowmark = bufev->wm_read.low;
+ if (highmark)
+ *highmark = bufev->wm_read.high;
+ BEV_UNLOCK(bufev);
+ return 0;
+ }
+ return -1;
+}
+
+int
bufferevent_flush(struct bufferevent *bufev,
short iotype,
enum bufferevent_flush_mode mode)
@@ -677,16 +677,16 @@ bufferevent_flush(struct bufferevent *bufev,
}
void
-bufferevent_incref_and_lock_(struct bufferevent *bufev)
+bufferevent_incref_and_lock_(struct bufferevent *bufev)
{
- struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
BEV_LOCK(bufev);
++bufev_private->refcnt;
}
#if 0
static void
-bufferevent_transfer_lock_ownership_(struct bufferevent *donor,
+bufferevent_transfer_lock_ownership_(struct bufferevent *donor,
struct bufferevent *recipient)
{
struct bufferevent_private *d = BEV_UPCAST(donor);
@@ -703,12 +703,12 @@ bufferevent_transfer_lock_ownership_(struct bufferevent *donor,
#endif
int
-bufferevent_decref_and_unlock_(struct bufferevent *bufev)
+bufferevent_decref_and_unlock_(struct bufferevent *bufev)
{
- struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
- int n_cbs = 0;
-#define MAX_CBS 16
- struct event_callback *cbs[MAX_CBS];
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
+ int n_cbs = 0;
+#define MAX_CBS 16
+ struct event_callback *cbs[MAX_CBS];
EVUTIL_ASSERT(bufev_private->refcnt > 0);
@@ -717,40 +717,40 @@ bufferevent_decref_and_unlock_(struct bufferevent *bufev)
return 0;
}
- if (bufev->be_ops->unlink)
- bufev->be_ops->unlink(bufev);
-
- /* Okay, we're out of references. Let's finalize this once all the
- * callbacks are done running. */
- cbs[0] = &bufev->ev_read.ev_evcallback;
- cbs[1] = &bufev->ev_write.ev_evcallback;
- cbs[2] = &bufev_private->deferred;
- n_cbs = 3;
- if (bufev_private->rate_limiting) {
- struct event *e = &bufev_private->rate_limiting->refill_bucket_event;
- if (event_initialized(e))
- cbs[n_cbs++] = &e->ev_evcallback;
- }
- n_cbs += evbuffer_get_callbacks_(bufev->input, cbs+n_cbs, MAX_CBS-n_cbs);
- n_cbs += evbuffer_get_callbacks_(bufev->output, cbs+n_cbs, MAX_CBS-n_cbs);
-
- event_callback_finalize_many_(bufev->ev_base, n_cbs, cbs,
- bufferevent_finalize_cb_);
-
-#undef MAX_CBS
- BEV_UNLOCK(bufev);
-
- return 1;
-}
-
-static void
-bufferevent_finalize_cb_(struct event_callback *evcb, void *arg_)
-{
- struct bufferevent *bufev = arg_;
- struct bufferevent *underlying;
- struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
-
- BEV_LOCK(bufev);
+ if (bufev->be_ops->unlink)
+ bufev->be_ops->unlink(bufev);
+
+ /* Okay, we're out of references. Let's finalize this once all the
+ * callbacks are done running. */
+ cbs[0] = &bufev->ev_read.ev_evcallback;
+ cbs[1] = &bufev->ev_write.ev_evcallback;
+ cbs[2] = &bufev_private->deferred;
+ n_cbs = 3;
+ if (bufev_private->rate_limiting) {
+ struct event *e = &bufev_private->rate_limiting->refill_bucket_event;
+ if (event_initialized(e))
+ cbs[n_cbs++] = &e->ev_evcallback;
+ }
+ n_cbs += evbuffer_get_callbacks_(bufev->input, cbs+n_cbs, MAX_CBS-n_cbs);
+ n_cbs += evbuffer_get_callbacks_(bufev->output, cbs+n_cbs, MAX_CBS-n_cbs);
+
+ event_callback_finalize_many_(bufev->ev_base, n_cbs, cbs,
+ bufferevent_finalize_cb_);
+
+#undef MAX_CBS
+ BEV_UNLOCK(bufev);
+
+ return 1;
+}
+
+static void
+bufferevent_finalize_cb_(struct event_callback *evcb, void *arg_)
+{
+ struct bufferevent *bufev = arg_;
+ struct bufferevent *underlying;
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
+
+ BEV_LOCK(bufev);
underlying = bufferevent_get_underlying(bufev);
/* Clean up the shared info */
@@ -766,14 +766,14 @@ bufferevent_finalize_cb_(struct event_callback *evcb, void *arg_)
if (bufev_private->rate_limiting) {
if (bufev_private->rate_limiting->group)
- bufferevent_remove_from_rate_limit_group_internal_(bufev,0);
+ bufferevent_remove_from_rate_limit_group_internal_(bufev,0);
mm_free(bufev_private->rate_limiting);
bufev_private->rate_limiting = NULL;
}
BEV_UNLOCK(bufev);
-
+
if (bufev_private->own_lock)
EVTHREAD_FREE_LOCK(bufev_private->lock,
EVTHREAD_LOCKTYPE_RECURSIVE);
@@ -792,14 +792,14 @@ bufferevent_finalize_cb_(struct event_callback *evcb, void *arg_)
* It would probably save us some headaches.
*/
if (underlying)
- bufferevent_decref_(underlying);
+ bufferevent_decref_(underlying);
}
int
bufferevent_decref(struct bufferevent *bufev)
{
BEV_LOCK(bufev);
- return bufferevent_decref_and_unlock_(bufev);
+ return bufferevent_decref_and_unlock_(bufev);
}
void
@@ -807,28 +807,28 @@ bufferevent_free(struct bufferevent *bufev)
{
BEV_LOCK(bufev);
bufferevent_setcb(bufev, NULL, NULL, NULL, NULL);
- bufferevent_cancel_all_(bufev);
- bufferevent_decref_and_unlock_(bufev);
+ bufferevent_cancel_all_(bufev);
+ bufferevent_decref_and_unlock_(bufev);
}
void
bufferevent_incref(struct bufferevent *bufev)
{
- struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
- /* XXX: now that this function is public, we might want to
- * - return the count from this function
- * - create a new function to atomically grab the current refcount
- */
+ /* XXX: now that this function is public, we might want to
+ * - return the count from this function
+ * - create a new function to atomically grab the current refcount
+ */
BEV_LOCK(bufev);
++bufev_private->refcnt;
BEV_UNLOCK(bufev);
}
int
-bufferevent_enable_locking_(struct bufferevent *bufev, void *lock)
+bufferevent_enable_locking_(struct bufferevent *bufev, void *lock)
{
-#ifdef EVENT__DISABLE_THREAD_SUPPORT
+#ifdef EVENT__DISABLE_THREAD_SUPPORT
return -1;
#else
struct bufferevent *underlying;
@@ -855,7 +855,7 @@ bufferevent_enable_locking_(struct bufferevent *bufev, void *lock)
evbuffer_enable_locking(bufev->output, lock);
if (underlying && !BEV_UPCAST(underlying)->lock)
- bufferevent_enable_locking_(underlying, lock);
+ bufferevent_enable_locking_(underlying, lock);
return 0;
#endif
@@ -870,8 +870,8 @@ bufferevent_setfd(struct bufferevent *bev, evutil_socket_t fd)
BEV_LOCK(bev);
if (bev->be_ops->ctrl)
res = bev->be_ops->ctrl(bev, BEV_CTRL_SET_FD, &d);
- if (res)
- event_debug(("%s: cannot set fd for %p to "EV_SOCK_FMT, __func__, bev, fd));
+ if (res)
+ event_debug(("%s: cannot set fd for %p to "EV_SOCK_FMT, __func__, bev, fd));
BEV_UNLOCK(bev);
return res;
}
@@ -885,27 +885,27 @@ bufferevent_getfd(struct bufferevent *bev)
BEV_LOCK(bev);
if (bev->be_ops->ctrl)
res = bev->be_ops->ctrl(bev, BEV_CTRL_GET_FD, &d);
- if (res)
- event_debug(("%s: cannot get fd for %p", __func__, bev));
+ if (res)
+ event_debug(("%s: cannot get fd for %p", __func__, bev));
BEV_UNLOCK(bev);
return (res<0) ? -1 : d.fd;
}
-enum bufferevent_options
-bufferevent_get_options_(struct bufferevent *bev)
-{
- struct bufferevent_private *bev_p = BEV_UPCAST(bev);
- enum bufferevent_options options;
-
- BEV_LOCK(bev);
- options = bev_p->options;
- BEV_UNLOCK(bev);
- return options;
-}
-
-
+enum bufferevent_options
+bufferevent_get_options_(struct bufferevent *bev)
+{
+ struct bufferevent_private *bev_p = BEV_UPCAST(bev);
+ enum bufferevent_options options;
+
+ BEV_LOCK(bev);
+ options = bev_p->options;
+ BEV_UNLOCK(bev);
+ return options;
+}
+
+
static void
-bufferevent_cancel_all_(struct bufferevent *bev)
+bufferevent_cancel_all_(struct bufferevent *bev)
{
union bufferevent_ctrl_data d;
memset(&d, 0, sizeof(d));
@@ -942,35 +942,35 @@ static void
bufferevent_generic_read_timeout_cb(evutil_socket_t fd, short event, void *ctx)
{
struct bufferevent *bev = ctx;
- bufferevent_incref_and_lock_(bev);
+ bufferevent_incref_and_lock_(bev);
bufferevent_disable(bev, EV_READ);
- bufferevent_run_eventcb_(bev, BEV_EVENT_TIMEOUT|BEV_EVENT_READING, 0);
- bufferevent_decref_and_unlock_(bev);
+ bufferevent_run_eventcb_(bev, BEV_EVENT_TIMEOUT|BEV_EVENT_READING, 0);
+ bufferevent_decref_and_unlock_(bev);
}
static void
bufferevent_generic_write_timeout_cb(evutil_socket_t fd, short event, void *ctx)
{
struct bufferevent *bev = ctx;
- bufferevent_incref_and_lock_(bev);
+ bufferevent_incref_and_lock_(bev);
bufferevent_disable(bev, EV_WRITE);
- bufferevent_run_eventcb_(bev, BEV_EVENT_TIMEOUT|BEV_EVENT_WRITING, 0);
- bufferevent_decref_and_unlock_(bev);
+ bufferevent_run_eventcb_(bev, BEV_EVENT_TIMEOUT|BEV_EVENT_WRITING, 0);
+ bufferevent_decref_and_unlock_(bev);
}
void
-bufferevent_init_generic_timeout_cbs_(struct bufferevent *bev)
+bufferevent_init_generic_timeout_cbs_(struct bufferevent *bev)
{
- event_assign(&bev->ev_read, bev->ev_base, -1, EV_FINALIZE,
+ event_assign(&bev->ev_read, bev->ev_base, -1, EV_FINALIZE,
bufferevent_generic_read_timeout_cb, bev);
- event_assign(&bev->ev_write, bev->ev_base, -1, EV_FINALIZE,
+ event_assign(&bev->ev_write, bev->ev_base, -1, EV_FINALIZE,
bufferevent_generic_write_timeout_cb, bev);
}
int
-bufferevent_generic_adj_timeouts_(struct bufferevent *bev)
+bufferevent_generic_adj_timeouts_(struct bufferevent *bev)
{
const short enabled = bev->enabled;
- struct bufferevent_private *bev_p = BEV_UPCAST(bev);
+ struct bufferevent_private *bev_p = BEV_UPCAST(bev);
int r1=0, r2=0;
if ((enabled & EV_READ) && !bev_p->read_suspended &&
evutil_timerisset(&bev->timeout_read))
@@ -990,47 +990,47 @@ bufferevent_generic_adj_timeouts_(struct bufferevent *bev)
}
int
-bufferevent_generic_adj_existing_timeouts_(struct bufferevent *bev)
-{
- int r = 0;
- if (event_pending(&bev->ev_read, EV_READ, NULL)) {
- if (evutil_timerisset(&bev->timeout_read)) {
- if (bufferevent_add_event_(&bev->ev_read, &bev->timeout_read) < 0)
- r = -1;
- } else {
- event_remove_timer(&bev->ev_read);
- }
- }
- if (event_pending(&bev->ev_write, EV_WRITE, NULL)) {
- if (evutil_timerisset(&bev->timeout_write)) {
- if (bufferevent_add_event_(&bev->ev_write, &bev->timeout_write) < 0)
- r = -1;
- } else {
- event_remove_timer(&bev->ev_write);
- }
- }
- return r;
-}
-
-int
-bufferevent_add_event_(struct event *ev, const struct timeval *tv)
+bufferevent_generic_adj_existing_timeouts_(struct bufferevent *bev)
{
- if (!evutil_timerisset(tv))
+ int r = 0;
+ if (event_pending(&bev->ev_read, EV_READ, NULL)) {
+ if (evutil_timerisset(&bev->timeout_read)) {
+ if (bufferevent_add_event_(&bev->ev_read, &bev->timeout_read) < 0)
+ r = -1;
+ } else {
+ event_remove_timer(&bev->ev_read);
+ }
+ }
+ if (event_pending(&bev->ev_write, EV_WRITE, NULL)) {
+ if (evutil_timerisset(&bev->timeout_write)) {
+ if (bufferevent_add_event_(&bev->ev_write, &bev->timeout_write) < 0)
+ r = -1;
+ } else {
+ event_remove_timer(&bev->ev_write);
+ }
+ }
+ return r;
+}
+
+int
+bufferevent_add_event_(struct event *ev, const struct timeval *tv)
+{
+ if (!evutil_timerisset(tv))
return event_add(ev, NULL);
else
return event_add(ev, tv);
}
/* For use by user programs only; internally, we should be calling
- either bufferevent_incref_and_lock_(), or BEV_LOCK. */
+ either bufferevent_incref_and_lock_(), or BEV_LOCK. */
void
bufferevent_lock(struct bufferevent *bev)
{
- bufferevent_incref_and_lock_(bev);
+ bufferevent_incref_and_lock_(bev);
}
void
bufferevent_unlock(struct bufferevent *bev)
{
- bufferevent_decref_and_unlock_(bev);
+ bufferevent_decref_and_unlock_(bev);
}
diff --git a/contrib/libs/libevent/bufferevent_async.c b/contrib/libs/libevent/bufferevent_async.c
index 40c7c5e8d0..5548721234 100644
--- a/contrib/libs/libevent/bufferevent_async.c
+++ b/contrib/libs/libevent/bufferevent_async.c
@@ -27,9 +27,9 @@
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -37,16 +37,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef EVENT__HAVE_STDARG_H
+#ifdef EVENT__HAVE_STDARG_H
#include <stdarg.h>
#endif
-#ifdef EVENT__HAVE_UNISTD_H
+#ifdef EVENT__HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
-#include <winerror.h>
+#include <winerror.h>
#include <ws2tcpip.h>
#endif
@@ -94,39 +94,39 @@ const struct bufferevent_ops bufferevent_ops_async = {
evutil_offsetof(struct bufferevent_async, bev.bev),
be_async_enable,
be_async_disable,
- NULL, /* Unlink */
+ NULL, /* Unlink */
be_async_destruct,
- bufferevent_generic_adj_timeouts_,
+ bufferevent_generic_adj_timeouts_,
be_async_flush,
be_async_ctrl,
};
-static inline void
-be_async_run_eventcb(struct bufferevent *bev, short what, int options)
-{ bufferevent_run_eventcb_(bev, what, options|BEV_TRIG_DEFER_CALLBACKS); }
-
-static inline void
-be_async_trigger_nolock(struct bufferevent *bev, short what, int options)
-{ bufferevent_trigger_nolock_(bev, what, options|BEV_TRIG_DEFER_CALLBACKS); }
-
-static inline int
-fatal_error(int err)
-{
- switch (err) {
- /* We may have already associated this fd with a port.
- * Let's hope it's this port, and that the error code
- * for doing this neer changes. */
- case ERROR_INVALID_PARAMETER:
- return 0;
- }
- return 1;
-}
-
+static inline void
+be_async_run_eventcb(struct bufferevent *bev, short what, int options)
+{ bufferevent_run_eventcb_(bev, what, options|BEV_TRIG_DEFER_CALLBACKS); }
+
+static inline void
+be_async_trigger_nolock(struct bufferevent *bev, short what, int options)
+{ bufferevent_trigger_nolock_(bev, what, options|BEV_TRIG_DEFER_CALLBACKS); }
+
+static inline int
+fatal_error(int err)
+{
+ switch (err) {
+ /* We may have already associated this fd with a port.
+ * Let's hope it's this port, and that the error code
+ * for doing this neer changes. */
+ case ERROR_INVALID_PARAMETER:
+ return 0;
+ }
+ return 1;
+}
+
static inline struct bufferevent_async *
upcast(struct bufferevent *bev)
{
struct bufferevent_async *bev_a;
- if (!BEV_IS_ASYNC(bev))
+ if (!BEV_IS_ASYNC(bev))
return NULL;
bev_a = EVUTIL_UPCAST(bev, struct bufferevent_async, bev.bev);
return bev_a;
@@ -166,7 +166,7 @@ bev_async_del_write(struct bufferevent_async *beva)
if (beva->write_added) {
beva->write_added = 0;
- event_base_del_virtual_(bev->ev_base);
+ event_base_del_virtual_(bev->ev_base);
}
}
@@ -177,7 +177,7 @@ bev_async_del_read(struct bufferevent_async *beva)
if (beva->read_added) {
beva->read_added = 0;
- event_base_del_virtual_(bev->ev_base);
+ event_base_del_virtual_(bev->ev_base);
}
}
@@ -188,7 +188,7 @@ bev_async_add_write(struct bufferevent_async *beva)
if (!beva->write_added) {
beva->write_added = 1;
- event_base_add_virtual_(bev->ev_base);
+ event_base_add_virtual_(bev->ev_base);
}
}
@@ -199,7 +199,7 @@ bev_async_add_read(struct bufferevent_async *beva)
if (!beva->read_added) {
beva->read_added = 1;
- event_base_add_virtual_(bev->ev_base);
+ event_base_add_virtual_(bev->ev_base);
}
}
@@ -224,7 +224,7 @@ bev_async_consider_writing(struct bufferevent_async *beva)
/* This is safe so long as bufferevent_get_write_max never returns
* more than INT_MAX. That's true for now. XXXX */
- limit = (int)bufferevent_get_write_max_(&beva->bev);
+ limit = (int)bufferevent_get_write_max_(&beva->bev);
if (at_most >= (size_t)limit && limit >= 0)
at_most = limit;
@@ -234,15 +234,15 @@ bev_async_consider_writing(struct bufferevent_async *beva)
}
/* XXXX doesn't respect low-water mark very well. */
- bufferevent_incref_(bev);
- if (evbuffer_launch_write_(bev->output, at_most,
+ bufferevent_incref_(bev);
+ if (evbuffer_launch_write_(bev->output, at_most,
&beva->write_overlapped)) {
- bufferevent_decref_(bev);
+ bufferevent_decref_(bev);
beva->ok = 0;
- be_async_run_eventcb(bev, BEV_EVENT_ERROR, 0);
+ be_async_run_eventcb(bev, BEV_EVENT_ERROR, 0);
} else {
beva->write_in_progress = at_most;
- bufferevent_decrement_write_buckets_(&beva->bev, at_most);
+ bufferevent_decrement_write_buckets_(&beva->bev, at_most);
bev_async_add_write(beva);
}
}
@@ -279,8 +279,8 @@ bev_async_consider_reading(struct bufferevent_async *beva)
}
/* XXXX This over-commits. */
- /* XXXX see also not above on cast on bufferevent_get_write_max_() */
- limit = (int)bufferevent_get_read_max_(&beva->bev);
+ /* XXXX see also not above on cast on bufferevent_get_write_max_() */
+ limit = (int)bufferevent_get_read_max_(&beva->bev);
if (at_most >= (size_t)limit && limit >= 0)
at_most = limit;
@@ -289,14 +289,14 @@ bev_async_consider_reading(struct bufferevent_async *beva)
return;
}
- bufferevent_incref_(bev);
- if (evbuffer_launch_read_(bev->input, at_most, &beva->read_overlapped)) {
+ bufferevent_incref_(bev);
+ if (evbuffer_launch_read_(bev->input, at_most, &beva->read_overlapped)) {
beva->ok = 0;
- be_async_run_eventcb(bev, BEV_EVENT_ERROR, 0);
- bufferevent_decref_(bev);
+ be_async_run_eventcb(bev, BEV_EVENT_ERROR, 0);
+ bufferevent_decref_(bev);
} else {
beva->read_in_progress = at_most;
- bufferevent_decrement_read_buckets_(&beva->bev, at_most);
+ bufferevent_decrement_read_buckets_(&beva->bev, at_most);
bev_async_add_read(beva);
}
@@ -314,12 +314,12 @@ be_async_outbuf_callback(struct evbuffer *buf,
/* If we added data to the outbuf and were not writing before,
* we may want to write now. */
- bufferevent_incref_and_lock_(bev);
+ bufferevent_incref_and_lock_(bev);
if (cbinfo->n_added)
bev_async_consider_writing(bev_async);
- bufferevent_decref_and_unlock_(bev);
+ bufferevent_decref_and_unlock_(bev);
}
static void
@@ -333,12 +333,12 @@ be_async_inbuf_callback(struct evbuffer *buf,
/* If we drained data from the inbuf and were not reading before,
* we may want to read now */
- bufferevent_incref_and_lock_(bev);
+ bufferevent_incref_and_lock_(bev);
if (cbinfo->n_deleted)
bev_async_consider_reading(bev_async);
- bufferevent_decref_and_unlock_(bev);
+ bufferevent_decref_and_unlock_(bev);
}
static int
@@ -402,11 +402,11 @@ be_async_destruct(struct bufferevent *bev)
bev_async_del_read(bev_async);
bev_async_del_write(bev_async);
- fd = evbuffer_overlapped_get_fd_(bev->input);
- if (fd != (evutil_socket_t)EVUTIL_INVALID_SOCKET &&
- (bev_p->options & BEV_OPT_CLOSE_ON_FREE)) {
+ fd = evbuffer_overlapped_get_fd_(bev->input);
+ if (fd != (evutil_socket_t)EVUTIL_INVALID_SOCKET &&
+ (bev_p->options & BEV_OPT_CLOSE_ON_FREE)) {
evutil_closesocket(fd);
- evbuffer_overlapped_set_fd_(bev->input, EVUTIL_INVALID_SOCKET);
+ evbuffer_overlapped_set_fd_(bev->input, EVUTIL_INVALID_SOCKET);
}
}
@@ -418,7 +418,7 @@ bev_async_set_wsa_error(struct bufferevent *bev, struct event_overlapped *eo)
DWORD bytes, flags;
evutil_socket_t fd;
- fd = evbuffer_overlapped_get_fd_(bev->input);
+ fd = evbuffer_overlapped_get_fd_(bev->input);
WSAGetOverlappedResult(fd, &eo->overlapped, &bytes, FALSE, &flags);
}
@@ -441,20 +441,20 @@ connect_complete(struct event_overlapped *eo, ev_uintptr_t key,
EVUTIL_ASSERT(bev_a->bev.connecting);
bev_a->bev.connecting = 0;
- sock = evbuffer_overlapped_get_fd_(bev_a->bev.bev.input);
+ sock = evbuffer_overlapped_get_fd_(bev_a->bev.bev.input);
/* XXXX Handle error? */
setsockopt(sock, SOL_SOCKET, SO_UPDATE_CONNECT_CONTEXT, NULL, 0);
if (ok)
- bufferevent_async_set_connected_(bev);
+ bufferevent_async_set_connected_(bev);
else
bev_async_set_wsa_error(bev, eo);
- be_async_run_eventcb(bev, ok ? BEV_EVENT_CONNECTED : BEV_EVENT_ERROR, 0);
+ be_async_run_eventcb(bev, ok ? BEV_EVENT_CONNECTED : BEV_EVENT_ERROR, 0);
- event_base_del_virtual_(bev->ev_base);
+ event_base_del_virtual_(bev->ev_base);
- bufferevent_decref_and_unlock_(bev);
+ bufferevent_decref_and_unlock_(bev);
}
static void
@@ -469,10 +469,10 @@ read_complete(struct event_overlapped *eo, ev_uintptr_t key,
EVUTIL_ASSERT(bev_a->read_in_progress);
amount_unread = bev_a->read_in_progress - nbytes;
- evbuffer_commit_read_(bev->input, nbytes);
+ evbuffer_commit_read_(bev->input, nbytes);
bev_a->read_in_progress = 0;
if (amount_unread)
- bufferevent_decrement_read_buckets_(&bev_a->bev, -amount_unread);
+ bufferevent_decrement_read_buckets_(&bev_a->bev, -amount_unread);
if (!ok)
bev_async_set_wsa_error(bev, eo);
@@ -480,20 +480,20 @@ read_complete(struct event_overlapped *eo, ev_uintptr_t key,
if (bev_a->ok) {
if (ok && nbytes) {
BEV_RESET_GENERIC_READ_TIMEOUT(bev);
- be_async_trigger_nolock(bev, EV_READ, 0);
+ be_async_trigger_nolock(bev, EV_READ, 0);
bev_async_consider_reading(bev_a);
} else if (!ok) {
what |= BEV_EVENT_ERROR;
bev_a->ok = 0;
- be_async_run_eventcb(bev, what, 0);
+ be_async_run_eventcb(bev, what, 0);
} else if (!nbytes) {
what |= BEV_EVENT_EOF;
bev_a->ok = 0;
- be_async_run_eventcb(bev, what, 0);
+ be_async_run_eventcb(bev, what, 0);
}
}
- bufferevent_decref_and_unlock_(bev);
+ bufferevent_decref_and_unlock_(bev);
}
static void
@@ -509,11 +509,11 @@ write_complete(struct event_overlapped *eo, ev_uintptr_t key,
EVUTIL_ASSERT(bev_a->write_in_progress);
amount_unwritten = bev_a->write_in_progress - nbytes;
- evbuffer_commit_write_(bev->output, nbytes);
+ evbuffer_commit_write_(bev->output, nbytes);
bev_a->write_in_progress = 0;
if (amount_unwritten)
- bufferevent_decrement_write_buckets_(&bev_a->bev,
+ bufferevent_decrement_write_buckets_(&bev_a->bev,
-amount_unwritten);
@@ -523,24 +523,24 @@ write_complete(struct event_overlapped *eo, ev_uintptr_t key,
if (bev_a->ok) {
if (ok && nbytes) {
BEV_RESET_GENERIC_WRITE_TIMEOUT(bev);
- be_async_trigger_nolock(bev, EV_WRITE, 0);
+ be_async_trigger_nolock(bev, EV_WRITE, 0);
bev_async_consider_writing(bev_a);
} else if (!ok) {
what |= BEV_EVENT_ERROR;
bev_a->ok = 0;
- be_async_run_eventcb(bev, what, 0);
+ be_async_run_eventcb(bev, what, 0);
} else if (!nbytes) {
what |= BEV_EVENT_EOF;
bev_a->ok = 0;
- be_async_run_eventcb(bev, what, 0);
+ be_async_run_eventcb(bev, what, 0);
}
}
- bufferevent_decref_and_unlock_(bev);
+ bufferevent_decref_and_unlock_(bev);
}
struct bufferevent *
-bufferevent_async_new_(struct event_base *base,
+bufferevent_async_new_(struct event_base *base,
evutil_socket_t fd, int options)
{
struct bufferevent_async *bev_a;
@@ -549,11 +549,11 @@ bufferevent_async_new_(struct event_base *base,
options |= BEV_OPT_THREADSAFE;
- if (!(iocp = event_base_get_iocp_(base)))
+ if (!(iocp = event_base_get_iocp_(base)))
return NULL;
- if (fd >= 0 && event_iocp_port_associate_(iocp, fd, 1)<0) {
- if (fatal_error(GetLastError()))
+ if (fd >= 0 && event_iocp_port_associate_(iocp, fd, 1)<0) {
+ if (fatal_error(GetLastError()))
return NULL;
}
@@ -561,29 +561,29 @@ bufferevent_async_new_(struct event_base *base,
return NULL;
bev = &bev_a->bev.bev;
- if (!(bev->input = evbuffer_overlapped_new_(fd))) {
+ if (!(bev->input = evbuffer_overlapped_new_(fd))) {
mm_free(bev_a);
return NULL;
}
- if (!(bev->output = evbuffer_overlapped_new_(fd))) {
+ if (!(bev->output = evbuffer_overlapped_new_(fd))) {
evbuffer_free(bev->input);
mm_free(bev_a);
return NULL;
}
- if (bufferevent_init_common_(&bev_a->bev, base, &bufferevent_ops_async,
+ if (bufferevent_init_common_(&bev_a->bev, base, &bufferevent_ops_async,
options)<0)
goto err;
evbuffer_add_cb(bev->input, be_async_inbuf_callback, bev);
evbuffer_add_cb(bev->output, be_async_outbuf_callback, bev);
- event_overlapped_init_(&bev_a->connect_overlapped, connect_complete);
- event_overlapped_init_(&bev_a->read_overlapped, read_complete);
- event_overlapped_init_(&bev_a->write_overlapped, write_complete);
-
- bufferevent_init_generic_timeout_cbs_(bev);
+ event_overlapped_init_(&bev_a->connect_overlapped, connect_complete);
+ event_overlapped_init_(&bev_a->read_overlapped, read_complete);
+ event_overlapped_init_(&bev_a->write_overlapped, write_complete);
+ bufferevent_init_generic_timeout_cbs_(bev);
+
bev_a->ok = fd >= 0;
return bev;
@@ -593,7 +593,7 @@ err:
}
void
-bufferevent_async_set_connected_(struct bufferevent *bev)
+bufferevent_async_set_connected_(struct bufferevent *bev)
{
struct bufferevent_async *bev_async = upcast(bev);
bev_async->ok = 1;
@@ -602,13 +602,13 @@ bufferevent_async_set_connected_(struct bufferevent *bev)
}
int
-bufferevent_async_can_connect_(struct bufferevent *bev)
+bufferevent_async_can_connect_(struct bufferevent *bev)
{
const struct win32_extension_fns *ext =
- event_get_win32_extension_fns_();
+ event_get_win32_extension_fns_();
if (BEV_IS_ASYNC(bev) &&
- event_base_get_iocp_(bev->ev_base) &&
+ event_base_get_iocp_(bev->ev_base) &&
ext && ext->ConnectEx)
return 1;
@@ -616,14 +616,14 @@ bufferevent_async_can_connect_(struct bufferevent *bev)
}
int
-bufferevent_async_connect_(struct bufferevent *bev, evutil_socket_t fd,
+bufferevent_async_connect_(struct bufferevent *bev, evutil_socket_t fd,
const struct sockaddr *sa, int socklen)
{
BOOL rc;
struct bufferevent_async *bev_async = upcast(bev);
struct sockaddr_storage ss;
const struct win32_extension_fns *ext =
- event_get_win32_extension_fns_();
+ event_get_win32_extension_fns_();
EVUTIL_ASSERT(ext && ext->ConnectEx && fd >= 0 && sa != NULL);
@@ -648,15 +648,15 @@ bufferevent_async_connect_(struct bufferevent *bev, evutil_socket_t fd,
WSAGetLastError() != WSAEINVAL)
return -1;
- event_base_add_virtual_(bev->ev_base);
- bufferevent_incref_(bev);
+ event_base_add_virtual_(bev->ev_base);
+ bufferevent_incref_(bev);
rc = ext->ConnectEx(fd, sa, socklen, NULL, 0, NULL,
&bev_async->connect_overlapped.overlapped);
if (rc || WSAGetLastError() == ERROR_IO_PENDING)
return 0;
- event_base_del_virtual_(bev->ev_base);
- bufferevent_decref_(bev);
+ event_base_del_virtual_(bev->ev_base);
+ bufferevent_decref_(bev);
return -1;
}
@@ -667,32 +667,32 @@ be_async_ctrl(struct bufferevent *bev, enum bufferevent_ctrl_op op,
{
switch (op) {
case BEV_CTRL_GET_FD:
- data->fd = evbuffer_overlapped_get_fd_(bev->input);
+ data->fd = evbuffer_overlapped_get_fd_(bev->input);
return 0;
case BEV_CTRL_SET_FD: {
- struct bufferevent_async *bev_a = upcast(bev);
+ struct bufferevent_async *bev_a = upcast(bev);
struct event_iocp_port *iocp;
- if (data->fd == evbuffer_overlapped_get_fd_(bev->input))
+ if (data->fd == evbuffer_overlapped_get_fd_(bev->input))
return 0;
- if (!(iocp = event_base_get_iocp_(bev->ev_base)))
+ if (!(iocp = event_base_get_iocp_(bev->ev_base)))
return -1;
- if (event_iocp_port_associate_(iocp, data->fd, 1) < 0) {
- if (fatal_error(GetLastError()))
- return -1;
- }
- evbuffer_overlapped_set_fd_(bev->input, data->fd);
- evbuffer_overlapped_set_fd_(bev->output, data->fd);
- bev_a->ok = data->fd >= 0;
+ if (event_iocp_port_associate_(iocp, data->fd, 1) < 0) {
+ if (fatal_error(GetLastError()))
+ return -1;
+ }
+ evbuffer_overlapped_set_fd_(bev->input, data->fd);
+ evbuffer_overlapped_set_fd_(bev->output, data->fd);
+ bev_a->ok = data->fd >= 0;
return 0;
}
case BEV_CTRL_CANCEL_ALL: {
struct bufferevent_async *bev_a = upcast(bev);
- evutil_socket_t fd = evbuffer_overlapped_get_fd_(bev->input);
- if (fd != (evutil_socket_t)EVUTIL_INVALID_SOCKET &&
+ evutil_socket_t fd = evbuffer_overlapped_get_fd_(bev->input);
+ if (fd != (evutil_socket_t)EVUTIL_INVALID_SOCKET &&
(bev_a->bev.options & BEV_OPT_CLOSE_ON_FREE)) {
closesocket(fd);
- evbuffer_overlapped_set_fd_(bev->input, EVUTIL_INVALID_SOCKET);
+ evbuffer_overlapped_set_fd_(bev->input, EVUTIL_INVALID_SOCKET);
}
bev_a->ok = 0;
return 0;
diff --git a/contrib/libs/libevent/bufferevent_filter.c b/contrib/libs/libevent/bufferevent_filter.c
index a7bdedddfe..ad21a391fa 100644
--- a/contrib/libs/libevent/bufferevent_filter.c
+++ b/contrib/libs/libevent/bufferevent_filter.c
@@ -26,13 +26,13 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "evconfig-private.h"
-
+#include "evconfig-private.h"
+
#include <sys/types.h>
#include "event2/event-config.h"
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -40,11 +40,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef EVENT__HAVE_STDARG_H
+#ifdef EVENT__HAVE_STDARG_H
#include <stdarg.h>
#endif
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
@@ -61,7 +61,7 @@
/* prototypes */
static int be_filter_enable(struct bufferevent *, short);
static int be_filter_disable(struct bufferevent *, short);
-static void be_filter_unlink(struct bufferevent *);
+static void be_filter_unlink(struct bufferevent *);
static void be_filter_destruct(struct bufferevent *);
static void be_filter_readcb(struct bufferevent *, void *);
@@ -71,9 +71,9 @@ static int be_filter_flush(struct bufferevent *bufev,
short iotype, enum bufferevent_flush_mode mode);
static int be_filter_ctrl(struct bufferevent *, enum bufferevent_ctrl_op, union bufferevent_ctrl_data *);
-static void bufferevent_filtered_inbuf_cb(struct evbuffer *buf,
- const struct evbuffer_cb_info *cbinfo, void *arg);
-
+static void bufferevent_filtered_inbuf_cb(struct evbuffer *buf,
+ const struct evbuffer_cb_info *cbinfo, void *arg);
+
static void bufferevent_filtered_outbuf_cb(struct evbuffer *buf,
const struct evbuffer_cb_info *info, void *arg);
@@ -82,8 +82,8 @@ struct bufferevent_filtered {
/** The bufferevent that we read/write filtered data from/to. */
struct bufferevent *underlying;
- /** A callback on our inbuf to notice somebory removes data */
- struct evbuffer_cb_entry *inbuf_cb;
+ /** A callback on our inbuf to notice somebory removes data */
+ struct evbuffer_cb_entry *inbuf_cb;
/** A callback on our outbuf to notice when somebody adds data */
struct evbuffer_cb_entry *outbuf_cb;
/** True iff we have received an EOF callback from the underlying
@@ -105,9 +105,9 @@ const struct bufferevent_ops bufferevent_ops_filter = {
evutil_offsetof(struct bufferevent_filtered, bev.bev),
be_filter_enable,
be_filter_disable,
- be_filter_unlink,
+ be_filter_unlink,
be_filter_destruct,
- bufferevent_generic_adj_timeouts_,
+ bufferevent_generic_adj_timeouts_,
be_filter_flush,
be_filter_ctrl,
};
@@ -118,11 +118,11 @@ static inline struct bufferevent_filtered *
upcast(struct bufferevent *bev)
{
struct bufferevent_filtered *bev_f;
- if (!BEV_IS_FILTER(bev))
+ if (!BEV_IS_FILTER(bev))
return NULL;
bev_f = (void*)( ((char*)bev) -
evutil_offsetof(struct bufferevent_filtered, bev.bev));
- EVUTIL_ASSERT(BEV_IS_FILTER(&bev_f->bev.bev));
+ EVUTIL_ASSERT(BEV_IS_FILTER(&bev_f->bev.bev));
return bev_f;
}
@@ -160,7 +160,7 @@ be_null_filter(struct evbuffer *src, struct evbuffer *dst, ev_ssize_t lim,
enum bufferevent_flush_mode state, void *ctx)
{
(void)state;
- if (evbuffer_remove_buffer(src, dst, lim) >= 0)
+ if (evbuffer_remove_buffer(src, dst, lim) >= 0)
return BEV_OK;
else
return BEV_ERROR;
@@ -189,13 +189,13 @@ bufferevent_filter_new(struct bufferevent *underlying,
if (!bufev_f)
return NULL;
- if (bufferevent_init_common_(&bufev_f->bev, underlying->ev_base,
+ if (bufferevent_init_common_(&bufev_f->bev, underlying->ev_base,
&bufferevent_ops_filter, tmp_options) < 0) {
mm_free(bufev_f);
return NULL;
}
if (options & BEV_OPT_THREADSAFE) {
- bufferevent_enable_locking_(downcast(bufev_f), NULL);
+ bufferevent_enable_locking_(downcast(bufev_f), NULL);
}
bufev_f->underlying = underlying;
@@ -208,31 +208,31 @@ bufferevent_filter_new(struct bufferevent *underlying,
bufferevent_setcb(bufev_f->underlying,
be_filter_readcb, be_filter_writecb, be_filter_eventcb, bufev_f);
- bufev_f->inbuf_cb = evbuffer_add_cb(downcast(bufev_f)->input,
- bufferevent_filtered_inbuf_cb, bufev_f);
- evbuffer_cb_clear_flags(downcast(bufev_f)->input, bufev_f->inbuf_cb,
- EVBUFFER_CB_ENABLED);
-
+ bufev_f->inbuf_cb = evbuffer_add_cb(downcast(bufev_f)->input,
+ bufferevent_filtered_inbuf_cb, bufev_f);
+ evbuffer_cb_clear_flags(downcast(bufev_f)->input, bufev_f->inbuf_cb,
+ EVBUFFER_CB_ENABLED);
+
bufev_f->outbuf_cb = evbuffer_add_cb(downcast(bufev_f)->output,
bufferevent_filtered_outbuf_cb, bufev_f);
- bufferevent_init_generic_timeout_cbs_(downcast(bufev_f));
- bufferevent_incref_(underlying);
+ bufferevent_init_generic_timeout_cbs_(downcast(bufev_f));
+ bufferevent_incref_(underlying);
bufferevent_enable(underlying, EV_READ|EV_WRITE);
- bufferevent_suspend_read_(underlying, BEV_SUSPEND_FILT_READ);
+ bufferevent_suspend_read_(underlying, BEV_SUSPEND_FILT_READ);
return downcast(bufev_f);
}
static void
-be_filter_unlink(struct bufferevent *bev)
+be_filter_unlink(struct bufferevent *bev)
{
struct bufferevent_filtered *bevf = upcast(bev);
EVUTIL_ASSERT(bevf);
if (bevf->bev.options & BEV_OPT_CLOSE_ON_FREE) {
- /* Yes, there is also a decref in bufferevent_decref_.
+ /* Yes, there is also a decref in bufferevent_decref_.
* That decref corresponds to the incref when we set
* underlying for the first time. This decref is an
* extra one to remove the last reference.
@@ -248,25 +248,25 @@ be_filter_unlink(struct bufferevent *bev)
if (bevf->underlying->errorcb == be_filter_eventcb)
bufferevent_setcb(bevf->underlying,
NULL, NULL, NULL, NULL);
- bufferevent_unsuspend_read_(bevf->underlying,
+ bufferevent_unsuspend_read_(bevf->underlying,
BEV_SUSPEND_FILT_READ);
}
}
-}
-
-static void
-be_filter_destruct(struct bufferevent *bev)
-{
- struct bufferevent_filtered *bevf = upcast(bev);
- EVUTIL_ASSERT(bevf);
- if (bevf->free_context)
- bevf->free_context(bevf->context);
-
- if (bevf->inbuf_cb)
- evbuffer_remove_cb_entry(bev->input, bevf->inbuf_cb);
-
- if (bevf->outbuf_cb)
- evbuffer_remove_cb_entry(bev->output, bevf->outbuf_cb);
+}
+
+static void
+be_filter_destruct(struct bufferevent *bev)
+{
+ struct bufferevent_filtered *bevf = upcast(bev);
+ EVUTIL_ASSERT(bevf);
+ if (bevf->free_context)
+ bevf->free_context(bevf->context);
+
+ if (bevf->inbuf_cb)
+ evbuffer_remove_cb_entry(bev->input, bevf->inbuf_cb);
+
+ if (bevf->outbuf_cb)
+ evbuffer_remove_cb_entry(bev->output, bevf->outbuf_cb);
}
static int
@@ -278,7 +278,7 @@ be_filter_enable(struct bufferevent *bev, short event)
if (event & EV_READ) {
BEV_RESET_GENERIC_READ_TIMEOUT(bev);
- bufferevent_unsuspend_read_(bevf->underlying,
+ bufferevent_unsuspend_read_(bevf->underlying,
BEV_SUSPEND_FILT_READ);
}
return 0;
@@ -292,7 +292,7 @@ be_filter_disable(struct bufferevent *bev, short event)
BEV_DEL_GENERIC_WRITE_TIMEOUT(bev);
if (event & EV_READ) {
BEV_DEL_GENERIC_READ_TIMEOUT(bev);
- bufferevent_suspend_read_(bevf->underlying,
+ bufferevent_suspend_read_(bevf->underlying,
BEV_SUSPEND_FILT_READ);
}
return 0;
@@ -361,8 +361,8 @@ be_filter_process_output(struct bufferevent_filtered *bevf,
/* disable the callback that calls this function
when the user adds to the output buffer. */
- evbuffer_cb_clear_flags(bufev->output, bevf->outbuf_cb,
- EVBUFFER_CB_ENABLED);
+ evbuffer_cb_clear_flags(bufev->output, bevf->outbuf_cb,
+ EVBUFFER_CB_ENABLED);
do {
int processed = 0;
@@ -393,9 +393,9 @@ be_filter_process_output(struct bufferevent_filtered *bevf,
/* Or if we have filled the underlying output buffer. */
!be_underlying_writebuf_full(bevf,state));
- if (processed) {
+ if (processed) {
/* call the write callback.*/
- bufferevent_trigger_nolock_(bufev, EV_WRITE, 0);
+ bufferevent_trigger_nolock_(bufev, EV_WRITE, 0);
if (res == BEV_OK &&
(bufev->enabled & EV_WRITE) &&
@@ -428,145 +428,145 @@ bufferevent_filtered_outbuf_cb(struct evbuffer *buf,
int processed_any = 0;
/* Somebody added more data to the output buffer. Try to
* process it, if we should. */
- bufferevent_incref_and_lock_(bev);
+ bufferevent_incref_and_lock_(bev);
be_filter_process_output(bevf, BEV_NORMAL, &processed_any);
- bufferevent_decref_and_unlock_(bev);
+ bufferevent_decref_and_unlock_(bev);
}
}
static void
-be_filter_read_nolock_(struct bufferevent *underlying, void *me_)
+be_filter_read_nolock_(struct bufferevent *underlying, void *me_)
{
- struct bufferevent_filtered *bevf = me_;
+ struct bufferevent_filtered *bevf = me_;
enum bufferevent_filter_result res;
enum bufferevent_flush_mode state;
struct bufferevent *bufev = downcast(bevf);
- struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
int processed_any = 0;
- // It's possible our refcount is 0 at this point if another thread free'd our filterevent
- EVUTIL_ASSERT(bufev_private->refcnt >= 0);
-
- // If our refcount is > 0
- if (bufev_private->refcnt > 0) {
-
- if (bevf->got_eof)
- state = BEV_FINISHED;
- else
- state = BEV_NORMAL;
-
- /* XXXX use return value */
- res = be_filter_process_input(bevf, state, &processed_any);
- (void)res;
-
- /* XXX This should be in process_input, not here. There are
- * other places that can call process-input, and they should
- * force readcb calls as needed. */
- if (processed_any) {
- bufferevent_trigger_nolock_(bufev, EV_READ, 0);
- if (evbuffer_get_length(underlying->input) > 0 &&
- be_readbuf_full(bevf, state)) {
- /* data left in underlying buffer and filter input buffer
- * hit its read high watermark.
- * Schedule callback to avoid data gets stuck in underlying
- * input buffer.
- */
- evbuffer_cb_set_flags(bufev->input, bevf->inbuf_cb,
- EVBUFFER_CB_ENABLED);
- }
- }
- }
-}
-
-/* Called when the size of our inbuf changes. */
-static void
-bufferevent_filtered_inbuf_cb(struct evbuffer *buf,
- const struct evbuffer_cb_info *cbinfo, void *arg)
-{
- struct bufferevent_filtered *bevf = arg;
- enum bufferevent_flush_mode state;
- struct bufferevent *bev = downcast(bevf);
-
- BEV_LOCK(bev);
-
+ // It's possible our refcount is 0 at this point if another thread free'd our filterevent
+ EVUTIL_ASSERT(bufev_private->refcnt >= 0);
+
+ // If our refcount is > 0
+ if (bufev_private->refcnt > 0) {
+
+ if (bevf->got_eof)
+ state = BEV_FINISHED;
+ else
+ state = BEV_NORMAL;
+
+ /* XXXX use return value */
+ res = be_filter_process_input(bevf, state, &processed_any);
+ (void)res;
+
+ /* XXX This should be in process_input, not here. There are
+ * other places that can call process-input, and they should
+ * force readcb calls as needed. */
+ if (processed_any) {
+ bufferevent_trigger_nolock_(bufev, EV_READ, 0);
+ if (evbuffer_get_length(underlying->input) > 0 &&
+ be_readbuf_full(bevf, state)) {
+ /* data left in underlying buffer and filter input buffer
+ * hit its read high watermark.
+ * Schedule callback to avoid data gets stuck in underlying
+ * input buffer.
+ */
+ evbuffer_cb_set_flags(bufev->input, bevf->inbuf_cb,
+ EVBUFFER_CB_ENABLED);
+ }
+ }
+ }
+}
+
+/* Called when the size of our inbuf changes. */
+static void
+bufferevent_filtered_inbuf_cb(struct evbuffer *buf,
+ const struct evbuffer_cb_info *cbinfo, void *arg)
+{
+ struct bufferevent_filtered *bevf = arg;
+ enum bufferevent_flush_mode state;
+ struct bufferevent *bev = downcast(bevf);
+
+ BEV_LOCK(bev);
+
if (bevf->got_eof)
state = BEV_FINISHED;
else
state = BEV_NORMAL;
- if (!be_readbuf_full(bevf, state)) {
- /* opportunity to read data which was left in underlying
- * input buffer because filter input buffer hit read
- * high watermark.
- */
- evbuffer_cb_clear_flags(bev->input, bevf->inbuf_cb,
- EVBUFFER_CB_ENABLED);
- if (evbuffer_get_length(bevf->underlying->input) > 0)
- be_filter_read_nolock_(bevf->underlying, bevf);
- }
+ if (!be_readbuf_full(bevf, state)) {
+ /* opportunity to read data which was left in underlying
+ * input buffer because filter input buffer hit read
+ * high watermark.
+ */
+ evbuffer_cb_clear_flags(bev->input, bevf->inbuf_cb,
+ EVBUFFER_CB_ENABLED);
+ if (evbuffer_get_length(bevf->underlying->input) > 0)
+ be_filter_read_nolock_(bevf->underlying, bevf);
+ }
- BEV_UNLOCK(bev);
-}
-
-/* Called when the underlying socket has read. */
-static void
-be_filter_readcb(struct bufferevent *underlying, void *me_)
-{
- struct bufferevent_filtered *bevf = me_;
- struct bufferevent *bev = downcast(bevf);
-
- BEV_LOCK(bev);
-
- be_filter_read_nolock_(underlying, me_);
-
- BEV_UNLOCK(bev);
+ BEV_UNLOCK(bev);
}
+/* Called when the underlying socket has read. */
+static void
+be_filter_readcb(struct bufferevent *underlying, void *me_)
+{
+ struct bufferevent_filtered *bevf = me_;
+ struct bufferevent *bev = downcast(bevf);
+
+ BEV_LOCK(bev);
+
+ be_filter_read_nolock_(underlying, me_);
+
+ BEV_UNLOCK(bev);
+}
+
/* Called when the underlying socket has drained enough that we can write to
it. */
static void
-be_filter_writecb(struct bufferevent *underlying, void *me_)
+be_filter_writecb(struct bufferevent *underlying, void *me_)
{
- struct bufferevent_filtered *bevf = me_;
+ struct bufferevent_filtered *bevf = me_;
struct bufferevent *bev = downcast(bevf);
- struct bufferevent_private *bufev_private = BEV_UPCAST(bev);
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bev);
int processed_any = 0;
- BEV_LOCK(bev);
-
- // It's possible our refcount is 0 at this point if another thread free'd our filterevent
- EVUTIL_ASSERT(bufev_private->refcnt >= 0);
-
- // If our refcount is > 0
- if (bufev_private->refcnt > 0) {
- be_filter_process_output(bevf, BEV_NORMAL, &processed_any);
- }
-
- BEV_UNLOCK(bev);
+ BEV_LOCK(bev);
+
+ // It's possible our refcount is 0 at this point if another thread free'd our filterevent
+ EVUTIL_ASSERT(bufev_private->refcnt >= 0);
+
+ // If our refcount is > 0
+ if (bufev_private->refcnt > 0) {
+ be_filter_process_output(bevf, BEV_NORMAL, &processed_any);
+ }
+
+ BEV_UNLOCK(bev);
}
/* Called when the underlying socket has given us an error */
static void
-be_filter_eventcb(struct bufferevent *underlying, short what, void *me_)
+be_filter_eventcb(struct bufferevent *underlying, short what, void *me_)
{
- struct bufferevent_filtered *bevf = me_;
+ struct bufferevent_filtered *bevf = me_;
struct bufferevent *bev = downcast(bevf);
- struct bufferevent_private *bufev_private = BEV_UPCAST(bev);
-
- BEV_LOCK(bev);
-
- // It's possible our refcount is 0 at this point if another thread free'd our filterevent
- EVUTIL_ASSERT(bufev_private->refcnt >= 0);
-
- // If our refcount is > 0
- if (bufev_private->refcnt > 0) {
-
- /* All we can really to is tell our own eventcb. */
- bufferevent_run_eventcb_(bev, what, 0);
- }
-
- BEV_UNLOCK(bev);
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bev);
+
+ BEV_LOCK(bev);
+
+ // It's possible our refcount is 0 at this point if another thread free'd our filterevent
+ EVUTIL_ASSERT(bufev_private->refcnt >= 0);
+
+ // If our refcount is > 0
+ if (bufev_private->refcnt > 0) {
+
+ /* All we can really to is tell our own eventcb. */
+ bufferevent_run_eventcb_(bev, what, 0);
+ }
+
+ BEV_UNLOCK(bev);
}
static int
@@ -577,7 +577,7 @@ be_filter_flush(struct bufferevent *bufev,
int processed_any = 0;
EVUTIL_ASSERT(bevf);
- bufferevent_incref_and_lock_(bufev);
+ bufferevent_incref_and_lock_(bufev);
if (iotype & EV_READ) {
be_filter_process_input(bevf, mode, &processed_any);
@@ -589,7 +589,7 @@ be_filter_flush(struct bufferevent *bufev,
/* XXX does this want to recursively call lower-level flushes? */
bufferevent_flush(bevf->underlying, iotype, mode);
- bufferevent_decref_and_unlock_(bufev);
+ bufferevent_decref_and_unlock_(bufev);
return processed_any;
}
@@ -604,22 +604,22 @@ be_filter_ctrl(struct bufferevent *bev, enum bufferevent_ctrl_op op,
bevf = upcast(bev);
data->ptr = bevf->underlying;
return 0;
- case BEV_CTRL_SET_FD:
+ case BEV_CTRL_SET_FD:
case BEV_CTRL_GET_FD:
- bevf = upcast(bev);
-
- if (bevf->underlying &&
- bevf->underlying->be_ops &&
- bevf->underlying->be_ops->ctrl) {
- return (bevf->underlying->be_ops->ctrl)(bevf->underlying, op, data);
- }
- EVUTIL_FALLTHROUGH;
-
+ bevf = upcast(bev);
+
+ if (bevf->underlying &&
+ bevf->underlying->be_ops &&
+ bevf->underlying->be_ops->ctrl) {
+ return (bevf->underlying->be_ops->ctrl)(bevf->underlying, op, data);
+ }
+ EVUTIL_FALLTHROUGH;
+
case BEV_CTRL_CANCEL_ALL:
- EVUTIL_FALLTHROUGH;
+ EVUTIL_FALLTHROUGH;
default:
return -1;
}
-
- return -1;
+
+ return -1;
}
diff --git a/contrib/libs/libevent/bufferevent_openssl.c b/contrib/libs/libevent/bufferevent_openssl.c
index b51b834bca..30ecd07062 100644
--- a/contrib/libs/libevent/bufferevent_openssl.c
+++ b/contrib/libs/libevent/bufferevent_openssl.c
@@ -24,17 +24,17 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// Get rid of OSX 10.7 and greater deprecation warnings.
-#if defined(__APPLE__) && defined(__clang__)
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-#endif
+// Get rid of OSX 10.7 and greater deprecation warnings.
+#if defined(__APPLE__) && defined(__clang__)
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#endif
#include "event2/event-config.h"
-#include "evconfig-private.h"
-
-#include <sys/types.h>
+#include "evconfig-private.h"
-#ifdef EVENT__HAVE_SYS_TIME_H
+#include <sys/types.h>
+
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -42,14 +42,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef EVENT__HAVE_STDARG_H
+#ifdef EVENT__HAVE_STDARG_H
#include <stdarg.h>
#endif
-#ifdef EVENT__HAVE_UNISTD_H
+#ifdef EVENT__HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
@@ -154,7 +154,7 @@ bio_bufferevent_read(BIO *b, char *out, int outlen)
return r;
}
-/* Called to write data into the BIO */
+/* Called to write data into the BIO */
static int
bio_bufferevent_write(BIO *b, const char *in, int inlen)
{
@@ -250,7 +250,7 @@ BIO_s_bufferevent(void)
/* Create a new BIO to wrap communication around a bufferevent. If close_flag
* is true, the bufferevent will be freed when the BIO is closed. */
static BIO *
-BIO_new_bufferevent(struct bufferevent *bufferevent)
+BIO_new_bufferevent(struct bufferevent *bufferevent)
{
BIO *result;
if (!bufferevent)
@@ -259,9 +259,9 @@ BIO_new_bufferevent(struct bufferevent *bufferevent)
return NULL;
BIO_set_init(result, 1);
BIO_set_data(result, bufferevent);
- /* We don't tell the BIO to close the bufferevent; we do it ourselves on
- * be_openssl_destruct() */
- BIO_set_shutdown(result, 0);
+ /* We don't tell the BIO to close the bufferevent; we do it ourselves on
+ * be_openssl_destruct() */
+ BIO_set_shutdown(result, 0);
return result;
}
@@ -317,20 +317,20 @@ struct bufferevent_openssl {
unsigned read_blocked_on_write : 1;
/* When we next get data, we should say "write" instead of "read". */
unsigned write_blocked_on_read : 1;
- /* Treat TCP close before SSL close on SSL >= v3 as clean EOF. */
+ /* Treat TCP close before SSL close on SSL >= v3 as clean EOF. */
unsigned allow_dirty_shutdown : 1;
/* XXX */
unsigned n_errors : 2;
/* Are we currently connecting, accepting, or doing IO? */
unsigned state : 2;
- /* If we reset fd, we sould reset state too */
- unsigned old_state : 2;
+ /* If we reset fd, we sould reset state too */
+ unsigned old_state : 2;
};
static int be_openssl_enable(struct bufferevent *, short);
static int be_openssl_disable(struct bufferevent *, short);
-static void be_openssl_unlink(struct bufferevent *);
+static void be_openssl_unlink(struct bufferevent *);
static void be_openssl_destruct(struct bufferevent *);
static int be_openssl_adj_timeouts(struct bufferevent *);
static int be_openssl_flush(struct bufferevent *bufev,
@@ -342,7 +342,7 @@ const struct bufferevent_ops bufferevent_ops_openssl = {
evutil_offsetof(struct bufferevent_openssl, bev.bev),
be_openssl_enable,
be_openssl_disable,
- be_openssl_unlink,
+ be_openssl_unlink,
be_openssl_destruct,
be_openssl_adj_timeouts,
be_openssl_flush,
@@ -355,11 +355,11 @@ static inline struct bufferevent_openssl *
upcast(struct bufferevent *bev)
{
struct bufferevent_openssl *bev_o;
- if (!BEV_IS_OPENSSL(bev))
+ if (!BEV_IS_OPENSSL(bev))
return NULL;
bev_o = (void*)( ((char*)bev) -
evutil_offsetof(struct bufferevent_openssl, bev.bev));
- EVUTIL_ASSERT(BEV_IS_OPENSSL(&bev_o->bev.bev));
+ EVUTIL_ASSERT(BEV_IS_OPENSSL(&bev_o->bev.bev));
return bev_o;
}
@@ -383,15 +383,15 @@ static int
start_reading(struct bufferevent_openssl *bev_ssl)
{
if (bev_ssl->underlying) {
- bufferevent_unsuspend_read_(bev_ssl->underlying,
+ bufferevent_unsuspend_read_(bev_ssl->underlying,
BEV_SUSPEND_FILT_READ);
return 0;
} else {
struct bufferevent *bev = &bev_ssl->bev.bev;
int r;
- r = bufferevent_add_event_(&bev->ev_read, &bev->timeout_read);
+ r = bufferevent_add_event_(&bev->ev_read, &bev->timeout_read);
if (r == 0 && bev_ssl->read_blocked_on_write)
- r = bufferevent_add_event_(&bev->ev_write,
+ r = bufferevent_add_event_(&bev->ev_write,
&bev->timeout_write);
return r;
}
@@ -405,15 +405,15 @@ start_writing(struct bufferevent_openssl *bev_ssl)
{
int r = 0;
if (bev_ssl->underlying) {
- if (bev_ssl->write_blocked_on_read) {
- bufferevent_unsuspend_read_(bev_ssl->underlying,
- BEV_SUSPEND_FILT_READ);
- }
+ if (bev_ssl->write_blocked_on_read) {
+ bufferevent_unsuspend_read_(bev_ssl->underlying,
+ BEV_SUSPEND_FILT_READ);
+ }
} else {
struct bufferevent *bev = &bev_ssl->bev.bev;
- r = bufferevent_add_event_(&bev->ev_write, &bev->timeout_write);
+ r = bufferevent_add_event_(&bev->ev_write, &bev->timeout_write);
if (!r && bev_ssl->write_blocked_on_read)
- r = bufferevent_add_event_(&bev->ev_read,
+ r = bufferevent_add_event_(&bev->ev_read,
&bev->timeout_read);
}
return r;
@@ -425,7 +425,7 @@ stop_reading(struct bufferevent_openssl *bev_ssl)
if (bev_ssl->write_blocked_on_read)
return;
if (bev_ssl->underlying) {
- bufferevent_suspend_read_(bev_ssl->underlying,
+ bufferevent_suspend_read_(bev_ssl->underlying,
BEV_SUSPEND_FILT_READ);
} else {
struct bufferevent *bev = &bev_ssl->bev.bev;
@@ -439,8 +439,8 @@ stop_writing(struct bufferevent_openssl *bev_ssl)
if (bev_ssl->read_blocked_on_write)
return;
if (bev_ssl->underlying) {
- bufferevent_unsuspend_read_(bev_ssl->underlying,
- BEV_SUSPEND_FILT_READ);
+ bufferevent_unsuspend_read_(bev_ssl->underlying,
+ BEV_SUSPEND_FILT_READ);
} else {
struct bufferevent *bev = &bev_ssl->bev.bev;
event_del(&bev->ev_write);
@@ -493,7 +493,7 @@ clear_wbor(struct bufferevent_openssl *bev_ssl)
}
static void
-conn_closed(struct bufferevent_openssl *bev_ssl, int when, int errcode, int ret)
+conn_closed(struct bufferevent_openssl *bev_ssl, int when, int errcode, int ret)
{
int event = BEV_EVENT_ERROR;
int dirty_shutdown = 0;
@@ -509,17 +509,17 @@ conn_closed(struct bufferevent_openssl *bev_ssl, int when, int errcode, int ret)
break;
case SSL_ERROR_SYSCALL:
/* IO error; possibly a dirty shutdown. */
- if ((ret == 0 || ret == -1) && ERR_peek_error() == 0)
+ if ((ret == 0 || ret == -1) && ERR_peek_error() == 0)
dirty_shutdown = 1;
- put_error(bev_ssl, errcode);
+ put_error(bev_ssl, errcode);
break;
case SSL_ERROR_SSL:
/* Protocol error. */
- put_error(bev_ssl, errcode);
+ put_error(bev_ssl, errcode);
break;
case SSL_ERROR_WANT_X509_LOOKUP:
/* XXXX handle this. */
- put_error(bev_ssl, errcode);
+ put_error(bev_ssl, errcode);
break;
case SSL_ERROR_NONE:
case SSL_ERROR_WANT_READ:
@@ -542,20 +542,20 @@ conn_closed(struct bufferevent_openssl *bev_ssl, int when, int errcode, int ret)
stop_reading(bev_ssl);
stop_writing(bev_ssl);
- /* when is BEV_EVENT_{READING|WRITING} */
- event = when | event;
- bufferevent_run_eventcb_(&bev_ssl->bev.bev, event, 0);
+ /* when is BEV_EVENT_{READING|WRITING} */
+ event = when | event;
+ bufferevent_run_eventcb_(&bev_ssl->bev.bev, event, 0);
}
static void
init_bio_counts(struct bufferevent_openssl *bev_ssl)
{
- BIO *rbio, *wbio;
-
- wbio = SSL_get_wbio(bev_ssl->ssl);
- bev_ssl->counts.n_written = wbio ? BIO_number_written(wbio) : 0;
- rbio = SSL_get_rbio(bev_ssl->ssl);
- bev_ssl->counts.n_read = rbio ? BIO_number_read(rbio) : 0;
+ BIO *rbio, *wbio;
+
+ wbio = SSL_get_wbio(bev_ssl->ssl);
+ bev_ssl->counts.n_written = wbio ? BIO_number_written(wbio) : 0;
+ rbio = SSL_get_rbio(bev_ssl->ssl);
+ bev_ssl->counts.n_read = rbio ? BIO_number_read(rbio) : 0;
}
static inline void
@@ -567,9 +567,9 @@ decrement_buckets(struct bufferevent_openssl *bev_ssl)
unsigned long w = num_w - bev_ssl->counts.n_written;
unsigned long r = num_r - bev_ssl->counts.n_read;
if (w)
- bufferevent_decrement_write_buckets_(&bev_ssl->bev, w);
+ bufferevent_decrement_write_buckets_(&bev_ssl->bev, w);
if (r)
- bufferevent_decrement_read_buckets_(&bev_ssl->bev, r);
+ bufferevent_decrement_read_buckets_(&bev_ssl->bev, r);
bev_ssl->counts.n_written = num_w;
bev_ssl->counts.n_read = num_r;
}
@@ -592,7 +592,7 @@ do_read(struct bufferevent_openssl *bev_ssl, int n_to_read) {
if (bev_ssl->bev.read_suspended)
return 0;
- atmost = bufferevent_get_read_max_(&bev_ssl->bev);
+ atmost = bufferevent_get_read_max_(&bev_ssl->bev);
if (n_to_read > atmost)
n_to_read = atmost;
@@ -603,7 +603,7 @@ do_read(struct bufferevent_openssl *bev_ssl, int n_to_read) {
for (i=0; i<n; ++i) {
if (bev_ssl->bev.read_suspended)
break;
- ERR_clear_error();
+ ERR_clear_error();
r = SSL_read(bev_ssl->ssl, space[i].iov_base, space[i].iov_len);
if (r>0) {
result |= OP_MADE_PROGRESS;
@@ -631,7 +631,7 @@ do_read(struct bufferevent_openssl *bev_ssl, int n_to_read) {
return OP_ERR | result;
break;
default:
- conn_closed(bev_ssl, BEV_EVENT_READING, err, r);
+ conn_closed(bev_ssl, BEV_EVENT_READING, err, r);
break;
}
result |= OP_BLOCKED;
@@ -662,7 +662,7 @@ do_write(struct bufferevent_openssl *bev_ssl, int atmost)
if (bev_ssl->last_write > 0)
atmost = bev_ssl->last_write;
else
- atmost = bufferevent_get_write_max_(&bev_ssl->bev);
+ atmost = bufferevent_get_write_max_(&bev_ssl->bev);
n = evbuffer_peek(output, atmost, NULL, space, 8);
if (n < 0)
@@ -680,7 +680,7 @@ do_write(struct bufferevent_openssl *bev_ssl, int atmost)
if (space[i].iov_len == 0)
continue;
- ERR_clear_error();
+ ERR_clear_error();
r = SSL_write(bev_ssl->ssl, space[i].iov_base,
space[i].iov_len);
if (r > 0) {
@@ -711,7 +711,7 @@ do_write(struct bufferevent_openssl *bev_ssl, int atmost)
bev_ssl->last_write = space[i].iov_len;
break;
default:
- conn_closed(bev_ssl, BEV_EVENT_WRITING, err, r);
+ conn_closed(bev_ssl, BEV_EVENT_WRITING, err, r);
bev_ssl->last_write = -1;
break;
}
@@ -724,7 +724,7 @@ do_write(struct bufferevent_openssl *bev_ssl, int atmost)
if (bev_ssl->underlying)
BEV_RESET_GENERIC_WRITE_TIMEOUT(bev);
- bufferevent_trigger_nolock_(bev, EV_WRITE, BEV_OPT_DEFER_CALLBACKS);
+ bufferevent_trigger_nolock_(bev, EV_WRITE, BEV_OPT_DEFER_CALLBACKS);
}
return result;
}
@@ -768,7 +768,7 @@ bytes_to_read(struct bufferevent_openssl *bev)
}
/* Respect the rate limit */
- limit = bufferevent_get_read_max_(&bev->bev);
+ limit = bufferevent_get_read_max_(&bev->bev);
if (result > limit) {
result = limit;
}
@@ -807,7 +807,7 @@ consider_reading(struct bufferevent_openssl *bev_ssl)
if (bev_ssl->bev.read_suspended)
break;
-
+
/* Read all pending data. This won't hit the network
* again, and will (most importantly) put us in a state
* where we don't need to read anything else until the
@@ -839,7 +839,7 @@ consider_reading(struct bufferevent_openssl *bev_ssl)
if (all_result_flags & OP_MADE_PROGRESS) {
struct bufferevent *bev = &bev_ssl->bev.bev;
- bufferevent_trigger_nolock_(bev, EV_READ, 0);
+ bufferevent_trigger_nolock_(bev, EV_READ, 0);
}
if (!bev_ssl->underlying) {
@@ -864,7 +864,7 @@ consider_writing(struct bufferevent_openssl *bev_ssl)
if (r & OP_MADE_PROGRESS) {
struct bufferevent *bev = &bev_ssl->bev.bev;
- bufferevent_trigger_nolock_(bev, EV_READ, 0);
+ bufferevent_trigger_nolock_(bev, EV_READ, 0);
}
if (r & (OP_ERR|OP_BLOCKED))
break;
@@ -936,49 +936,49 @@ be_openssl_eventcb(struct bufferevent *bev_base, short what, void *ctx)
eat it. */
}
if (event)
- bufferevent_run_eventcb_(&bev_ssl->bev.bev, event, 0);
+ bufferevent_run_eventcb_(&bev_ssl->bev.bev, event, 0);
}
static void
be_openssl_readeventcb(evutil_socket_t fd, short what, void *ptr)
{
struct bufferevent_openssl *bev_ssl = ptr;
- bufferevent_incref_and_lock_(&bev_ssl->bev.bev);
+ bufferevent_incref_and_lock_(&bev_ssl->bev.bev);
if (what == EV_TIMEOUT) {
- bufferevent_run_eventcb_(&bev_ssl->bev.bev,
- BEV_EVENT_TIMEOUT|BEV_EVENT_READING, 0);
+ bufferevent_run_eventcb_(&bev_ssl->bev.bev,
+ BEV_EVENT_TIMEOUT|BEV_EVENT_READING, 0);
} else {
consider_reading(bev_ssl);
}
- bufferevent_decref_and_unlock_(&bev_ssl->bev.bev);
+ bufferevent_decref_and_unlock_(&bev_ssl->bev.bev);
}
static void
be_openssl_writeeventcb(evutil_socket_t fd, short what, void *ptr)
{
struct bufferevent_openssl *bev_ssl = ptr;
- bufferevent_incref_and_lock_(&bev_ssl->bev.bev);
+ bufferevent_incref_and_lock_(&bev_ssl->bev.bev);
if (what == EV_TIMEOUT) {
- bufferevent_run_eventcb_(&bev_ssl->bev.bev,
- BEV_EVENT_TIMEOUT|BEV_EVENT_WRITING, 0);
+ bufferevent_run_eventcb_(&bev_ssl->bev.bev,
+ BEV_EVENT_TIMEOUT|BEV_EVENT_WRITING, 0);
} else {
consider_writing(bev_ssl);
}
- bufferevent_decref_and_unlock_(&bev_ssl->bev.bev);
-}
-
-static evutil_socket_t
-be_openssl_auto_fd(struct bufferevent_openssl *bev_ssl, evutil_socket_t fd)
-{
- if (!bev_ssl->underlying) {
- struct bufferevent *bev = &bev_ssl->bev.bev;
- if (event_initialized(&bev->ev_read) && fd < 0) {
- fd = event_get_fd(&bev->ev_read);
- }
- }
- return fd;
+ bufferevent_decref_and_unlock_(&bev_ssl->bev.bev);
}
+static evutil_socket_t
+be_openssl_auto_fd(struct bufferevent_openssl *bev_ssl, evutil_socket_t fd)
+{
+ if (!bev_ssl->underlying) {
+ struct bufferevent *bev = &bev_ssl->bev.bev;
+ if (event_initialized(&bev->ev_read) && fd < 0) {
+ fd = event_get_fd(&bev->ev_read);
+ }
+ }
+ return fd;
+}
+
static int
set_open_callbacks(struct bufferevent_openssl *bev_ssl, evutil_socket_t fd)
{
@@ -990,27 +990,27 @@ set_open_callbacks(struct bufferevent_openssl *bev_ssl, evutil_socket_t fd)
} else {
struct bufferevent *bev = &bev_ssl->bev.bev;
int rpending=0, wpending=0, r1=0, r2=0;
-
- if (event_initialized(&bev->ev_read)) {
+
+ if (event_initialized(&bev->ev_read)) {
rpending = event_pending(&bev->ev_read, EV_READ, NULL);
wpending = event_pending(&bev->ev_write, EV_WRITE, NULL);
-
+
event_del(&bev->ev_read);
event_del(&bev->ev_write);
}
-
+
event_assign(&bev->ev_read, bev->ev_base, fd,
- EV_READ|EV_PERSIST|EV_FINALIZE,
- be_openssl_readeventcb, bev_ssl);
+ EV_READ|EV_PERSIST|EV_FINALIZE,
+ be_openssl_readeventcb, bev_ssl);
event_assign(&bev->ev_write, bev->ev_base, fd,
- EV_WRITE|EV_PERSIST|EV_FINALIZE,
- be_openssl_writeeventcb, bev_ssl);
-
+ EV_WRITE|EV_PERSIST|EV_FINALIZE,
+ be_openssl_writeeventcb, bev_ssl);
+
if (rpending)
- r1 = bufferevent_add_event_(&bev->ev_read, &bev->timeout_read);
+ r1 = bufferevent_add_event_(&bev->ev_read, &bev->timeout_read);
if (wpending)
- r2 = bufferevent_add_event_(&bev->ev_write, &bev->timeout_write);
-
+ r2 = bufferevent_add_event_(&bev->ev_write, &bev->timeout_write);
+
return (r1<0 || r2<0) ? -1 : 0;
}
}
@@ -1027,34 +1027,34 @@ do_handshake(struct bufferevent_openssl *bev_ssl)
return -1;
case BUFFEREVENT_SSL_CONNECTING:
case BUFFEREVENT_SSL_ACCEPTING:
- ERR_clear_error();
+ ERR_clear_error();
r = SSL_do_handshake(bev_ssl->ssl);
break;
}
decrement_buckets(bev_ssl);
if (r==1) {
- evutil_socket_t fd = event_get_fd(&bev_ssl->bev.bev.ev_read);
+ evutil_socket_t fd = event_get_fd(&bev_ssl->bev.bev.ev_read);
/* We're done! */
bev_ssl->state = BUFFEREVENT_SSL_OPEN;
- set_open_callbacks(bev_ssl, fd); /* XXXX handle failure */
+ set_open_callbacks(bev_ssl, fd); /* XXXX handle failure */
/* Call do_read and do_write as needed */
bufferevent_enable(&bev_ssl->bev.bev, bev_ssl->bev.bev.enabled);
- bufferevent_run_eventcb_(&bev_ssl->bev.bev,
- BEV_EVENT_CONNECTED, 0);
+ bufferevent_run_eventcb_(&bev_ssl->bev.bev,
+ BEV_EVENT_CONNECTED, 0);
return 1;
} else {
int err = SSL_get_error(bev_ssl->ssl, r);
print_err(err);
switch (err) {
case SSL_ERROR_WANT_WRITE:
- stop_reading(bev_ssl);
- return start_writing(bev_ssl);
+ stop_reading(bev_ssl);
+ return start_writing(bev_ssl);
case SSL_ERROR_WANT_READ:
- stop_writing(bev_ssl);
- return start_reading(bev_ssl);
+ stop_writing(bev_ssl);
+ return start_reading(bev_ssl);
default:
- conn_closed(bev_ssl, BEV_EVENT_READING, err, r);
+ conn_closed(bev_ssl, BEV_EVENT_READING, err, r);
return -1;
}
}
@@ -1072,12 +1072,12 @@ be_openssl_handshakeeventcb(evutil_socket_t fd, short what, void *ptr)
{
struct bufferevent_openssl *bev_ssl = ptr;
- bufferevent_incref_and_lock_(&bev_ssl->bev.bev);
+ bufferevent_incref_and_lock_(&bev_ssl->bev.bev);
if (what & EV_TIMEOUT) {
- bufferevent_run_eventcb_(&bev_ssl->bev.bev, BEV_EVENT_TIMEOUT, 0);
+ bufferevent_run_eventcb_(&bev_ssl->bev.bev, BEV_EVENT_TIMEOUT, 0);
} else
do_handshake(bev_ssl);/* XXX handle failure */
- bufferevent_decref_and_unlock_(&bev_ssl->bev.bev);
+ bufferevent_decref_and_unlock_(&bev_ssl->bev.bev);
}
static int
@@ -1088,31 +1088,31 @@ set_handshake_callbacks(struct bufferevent_openssl *bev_ssl, evutil_socket_t fd)
be_openssl_handshakecb, be_openssl_handshakecb,
be_openssl_eventcb,
bev_ssl);
-
- if (fd < 0)
- return 0;
-
- if (bufferevent_setfd(bev_ssl->underlying, fd))
- return 1;
-
+
+ if (fd < 0)
+ return 0;
+
+ if (bufferevent_setfd(bev_ssl->underlying, fd))
+ return 1;
+
return do_handshake(bev_ssl);
} else {
struct bufferevent *bev = &bev_ssl->bev.bev;
-
- if (event_initialized(&bev->ev_read)) {
+
+ if (event_initialized(&bev->ev_read)) {
event_del(&bev->ev_read);
event_del(&bev->ev_write);
}
-
+
event_assign(&bev->ev_read, bev->ev_base, fd,
- EV_READ|EV_PERSIST|EV_FINALIZE,
- be_openssl_handshakeeventcb, bev_ssl);
+ EV_READ|EV_PERSIST|EV_FINALIZE,
+ be_openssl_handshakeeventcb, bev_ssl);
event_assign(&bev->ev_write, bev->ev_base, fd,
- EV_WRITE|EV_PERSIST|EV_FINALIZE,
- be_openssl_handshakeeventcb, bev_ssl);
- if (fd >= 0)
- bufferevent_enable(bev, bev->enabled);
- return 0;
+ EV_WRITE|EV_PERSIST|EV_FINALIZE,
+ be_openssl_handshakeeventcb, bev_ssl);
+ if (fd >= 0)
+ bufferevent_enable(bev, bev->enabled);
+ return 0;
}
}
@@ -1125,7 +1125,7 @@ bufferevent_ssl_renegotiate(struct bufferevent *bev)
if (SSL_renegotiate(bev_ssl->ssl) < 0)
return -1;
bev_ssl->state = BUFFEREVENT_SSL_CONNECTING;
- if (set_handshake_callbacks(bev_ssl, be_openssl_auto_fd(bev_ssl, -1)) < 0)
+ if (set_handshake_callbacks(bev_ssl, be_openssl_auto_fd(bev_ssl, -1)) < 0)
return -1;
if (!bev_ssl->underlying)
return do_handshake(bev_ssl);
@@ -1142,14 +1142,14 @@ be_openssl_outbuf_cb(struct evbuffer *buf,
if (cbinfo->n_added && bev_ssl->state == BUFFEREVENT_SSL_OPEN) {
if (cbinfo->orig_size == 0)
- r = bufferevent_add_event_(&bev_ssl->bev.bev.ev_write,
+ r = bufferevent_add_event_(&bev_ssl->bev.bev.ev_write,
&bev_ssl->bev.bev.timeout_write);
-
- if (bev_ssl->underlying)
- consider_writing(bev_ssl);
+
+ if (bev_ssl->underlying)
+ consider_writing(bev_ssl);
}
/* XXX Handle r < 0 */
- (void)r;
+ (void)r;
}
@@ -1198,7 +1198,7 @@ be_openssl_disable(struct bufferevent *bev, short events)
}
static void
-be_openssl_unlink(struct bufferevent *bev)
+be_openssl_unlink(struct bufferevent *bev)
{
struct bufferevent_openssl *bev_ssl = upcast(bev);
@@ -1209,9 +1209,9 @@ be_openssl_unlink(struct bufferevent *bev)
"bufferevent with too few references");
} else {
bufferevent_free(bev_ssl->underlying);
- /* We still have a reference to it, via our
- * BIO. So we don't drop this. */
- // bev_ssl->underlying = NULL;
+ /* We still have a reference to it, via our
+ * BIO. So we don't drop this. */
+ // bev_ssl->underlying = NULL;
}
}
} else {
@@ -1219,39 +1219,39 @@ be_openssl_unlink(struct bufferevent *bev)
if (bev_ssl->underlying->errorcb == be_openssl_eventcb)
bufferevent_setcb(bev_ssl->underlying,
NULL,NULL,NULL,NULL);
- bufferevent_unsuspend_read_(bev_ssl->underlying,
+ bufferevent_unsuspend_read_(bev_ssl->underlying,
BEV_SUSPEND_FILT_READ);
}
}
}
-static void
-be_openssl_destruct(struct bufferevent *bev)
-{
- struct bufferevent_openssl *bev_ssl = upcast(bev);
-
- if (bev_ssl->bev.options & BEV_OPT_CLOSE_ON_FREE) {
- if (! bev_ssl->underlying) {
- evutil_socket_t fd = EVUTIL_INVALID_SOCKET;
- BIO *bio = SSL_get_wbio(bev_ssl->ssl);
- if (bio)
- fd = BIO_get_fd(bio, NULL);
- if (fd >= 0)
- evutil_closesocket(fd);
- }
- SSL_free(bev_ssl->ssl);
- }
-}
-
+static void
+be_openssl_destruct(struct bufferevent *bev)
+{
+ struct bufferevent_openssl *bev_ssl = upcast(bev);
+
+ if (bev_ssl->bev.options & BEV_OPT_CLOSE_ON_FREE) {
+ if (! bev_ssl->underlying) {
+ evutil_socket_t fd = EVUTIL_INVALID_SOCKET;
+ BIO *bio = SSL_get_wbio(bev_ssl->ssl);
+ if (bio)
+ fd = BIO_get_fd(bio, NULL);
+ if (fd >= 0)
+ evutil_closesocket(fd);
+ }
+ SSL_free(bev_ssl->ssl);
+ }
+}
+
static int
be_openssl_adj_timeouts(struct bufferevent *bev)
{
struct bufferevent_openssl *bev_ssl = upcast(bev);
- if (bev_ssl->underlying) {
- return bufferevent_generic_adj_timeouts_(bev);
- } else {
- return bufferevent_generic_adj_existing_timeouts_(bev);
+ if (bev_ssl->underlying) {
+ return bufferevent_generic_adj_timeouts_(bev);
+ } else {
+ return bufferevent_generic_adj_existing_timeouts_(bev);
}
}
@@ -1264,61 +1264,61 @@ be_openssl_flush(struct bufferevent *bufev,
}
static int
-be_openssl_set_fd(struct bufferevent_openssl *bev_ssl,
- enum bufferevent_ssl_state state, evutil_socket_t fd)
-{
- bev_ssl->state = state;
-
- switch (state) {
- case BUFFEREVENT_SSL_ACCEPTING:
- if (!SSL_clear(bev_ssl->ssl))
- return -1;
- SSL_set_accept_state(bev_ssl->ssl);
- if (set_handshake_callbacks(bev_ssl, fd) < 0)
- return -1;
- break;
- case BUFFEREVENT_SSL_CONNECTING:
- if (!SSL_clear(bev_ssl->ssl))
- return -1;
- SSL_set_connect_state(bev_ssl->ssl);
- if (set_handshake_callbacks(bev_ssl, fd) < 0)
- return -1;
- break;
- case BUFFEREVENT_SSL_OPEN:
- if (set_open_callbacks(bev_ssl, fd) < 0)
- return -1;
- break;
- default:
- return -1;
- }
-
- return 0;
-}
-
-static int
+be_openssl_set_fd(struct bufferevent_openssl *bev_ssl,
+ enum bufferevent_ssl_state state, evutil_socket_t fd)
+{
+ bev_ssl->state = state;
+
+ switch (state) {
+ case BUFFEREVENT_SSL_ACCEPTING:
+ if (!SSL_clear(bev_ssl->ssl))
+ return -1;
+ SSL_set_accept_state(bev_ssl->ssl);
+ if (set_handshake_callbacks(bev_ssl, fd) < 0)
+ return -1;
+ break;
+ case BUFFEREVENT_SSL_CONNECTING:
+ if (!SSL_clear(bev_ssl->ssl))
+ return -1;
+ SSL_set_connect_state(bev_ssl->ssl);
+ if (set_handshake_callbacks(bev_ssl, fd) < 0)
+ return -1;
+ break;
+ case BUFFEREVENT_SSL_OPEN:
+ if (set_open_callbacks(bev_ssl, fd) < 0)
+ return -1;
+ break;
+ default:
+ return -1;
+ }
+
+ return 0;
+}
+
+static int
be_openssl_ctrl(struct bufferevent *bev,
enum bufferevent_ctrl_op op, union bufferevent_ctrl_data *data)
{
struct bufferevent_openssl *bev_ssl = upcast(bev);
switch (op) {
case BEV_CTRL_SET_FD:
- if (!bev_ssl->underlying) {
- BIO *bio;
- bio = BIO_new_socket((int)data->fd, 0);
- SSL_set_bio(bev_ssl->ssl, bio, bio);
- } else {
+ if (!bev_ssl->underlying) {
BIO *bio;
- if (!(bio = BIO_new_bufferevent(bev_ssl->underlying)))
- return -1;
+ bio = BIO_new_socket((int)data->fd, 0);
SSL_set_bio(bev_ssl->ssl, bio, bio);
+ } else {
+ BIO *bio;
+ if (!(bio = BIO_new_bufferevent(bev_ssl->underlying)))
+ return -1;
+ SSL_set_bio(bev_ssl->ssl, bio, bio);
}
-
- return be_openssl_set_fd(bev_ssl, bev_ssl->old_state, data->fd);
- case BEV_CTRL_GET_FD:
- if (bev_ssl->underlying) {
- data->fd = event_get_fd(&bev_ssl->underlying->ev_read);
- } else {
- data->fd = event_get_fd(&bev->ev_read);
+
+ return be_openssl_set_fd(bev_ssl, bev_ssl->old_state, data->fd);
+ case BEV_CTRL_GET_FD:
+ if (bev_ssl->underlying) {
+ data->fd = event_get_fd(&bev_ssl->underlying->ev_read);
+ } else {
+ data->fd = event_get_fd(&bev->ev_read);
}
return 0;
case BEV_CTRL_GET_UNDERLYING:
@@ -1351,16 +1351,16 @@ bufferevent_openssl_new_impl(struct event_base *base,
struct bufferevent_private *bev_p = NULL;
int tmp_options = options & ~BEV_OPT_THREADSAFE;
- /* Only one can be set. */
+ /* Only one can be set. */
if (underlying != NULL && fd >= 0)
- goto err;
+ goto err;
if (!(bev_ssl = mm_calloc(1, sizeof(struct bufferevent_openssl))))
goto err;
bev_p = &bev_ssl->bev;
- if (bufferevent_init_common_(bev_p, base,
+ if (bufferevent_init_common_(bev_p, base,
&bufferevent_ops_openssl, tmp_options) < 0)
goto err;
@@ -1375,38 +1375,38 @@ bufferevent_openssl_new_impl(struct event_base *base,
be_openssl_outbuf_cb, bev_ssl);
if (options & BEV_OPT_THREADSAFE)
- bufferevent_enable_locking_(&bev_ssl->bev.bev, NULL);
+ bufferevent_enable_locking_(&bev_ssl->bev.bev, NULL);
if (underlying) {
- bufferevent_init_generic_timeout_cbs_(&bev_ssl->bev.bev);
- bufferevent_incref_(underlying);
+ bufferevent_init_generic_timeout_cbs_(&bev_ssl->bev.bev);
+ bufferevent_incref_(underlying);
}
- bev_ssl->old_state = state;
+ bev_ssl->old_state = state;
bev_ssl->last_write = -1;
init_bio_counts(bev_ssl);
- fd = be_openssl_auto_fd(bev_ssl, fd);
- if (be_openssl_set_fd(bev_ssl, state, fd))
+ fd = be_openssl_auto_fd(bev_ssl, fd);
+ if (be_openssl_set_fd(bev_ssl, state, fd))
goto err;
if (underlying) {
bufferevent_setwatermark(underlying, EV_READ, 0, 0);
bufferevent_enable(underlying, EV_READ|EV_WRITE);
if (state == BUFFEREVENT_SSL_OPEN)
- bufferevent_suspend_read_(underlying,
+ bufferevent_suspend_read_(underlying,
BEV_SUSPEND_FILT_READ);
}
return &bev_ssl->bev.bev;
err:
- if (options & BEV_OPT_CLOSE_ON_FREE)
- SSL_free(ssl);
- if (bev_ssl) {
- bev_ssl->ssl = NULL;
+ if (options & BEV_OPT_CLOSE_ON_FREE)
+ SSL_free(ssl);
+ if (bev_ssl) {
+ bev_ssl->ssl = NULL;
bufferevent_free(&bev_ssl->bev.bev);
- }
+ }
return NULL;
}
@@ -1418,23 +1418,23 @@ bufferevent_openssl_filter_new(struct event_base *base,
int options)
{
BIO *bio;
- struct bufferevent *bev;
-
+ struct bufferevent *bev;
+
if (!underlying)
- goto err;
- if (!(bio = BIO_new_bufferevent(underlying)))
- goto err;
+ goto err;
+ if (!(bio = BIO_new_bufferevent(underlying)))
+ goto err;
SSL_set_bio(ssl, bio, bio);
- bev = bufferevent_openssl_new_impl(
+ bev = bufferevent_openssl_new_impl(
base, underlying, -1, ssl, state, options);
- return bev;
-
-err:
- if (options & BEV_OPT_CLOSE_ON_FREE)
- SSL_free(ssl);
- return NULL;
+ return bev;
+
+err:
+ if (options & BEV_OPT_CLOSE_ON_FREE)
+ SSL_free(ssl);
+ return NULL;
}
struct bufferevent *
@@ -1461,14 +1461,14 @@ bufferevent_openssl_socket_new(struct event_base *base,
} else {
/* We specified an fd different from that of the SSL.
This is probably an error on our part. Fail. */
- goto err;
+ goto err;
}
- BIO_set_close(bio, 0);
+ BIO_set_close(bio, 0);
} else {
/* The SSL isn't configured with a BIO with an fd. */
if (fd >= 0) {
/* ... and we have an fd we want to use. */
- bio = BIO_new_socket((int)fd, 0);
+ bio = BIO_new_socket((int)fd, 0);
SSL_set_bio(ssl, bio, bio);
} else {
/* Leave the fd unset. */
@@ -1477,38 +1477,38 @@ bufferevent_openssl_socket_new(struct event_base *base,
return bufferevent_openssl_new_impl(
base, NULL, fd, ssl, state, options);
-
-err:
- if (options & BEV_OPT_CLOSE_ON_FREE)
- SSL_free(ssl);
- return NULL;
-}
-
-int
-bufferevent_openssl_get_allow_dirty_shutdown(struct bufferevent *bev)
-{
- int allow_dirty_shutdown = -1;
- struct bufferevent_openssl *bev_ssl;
- BEV_LOCK(bev);
- bev_ssl = upcast(bev);
- if (bev_ssl)
- allow_dirty_shutdown = bev_ssl->allow_dirty_shutdown;
- BEV_UNLOCK(bev);
- return allow_dirty_shutdown;
-}
-
-void
-bufferevent_openssl_set_allow_dirty_shutdown(struct bufferevent *bev,
- int allow_dirty_shutdown)
-{
- struct bufferevent_openssl *bev_ssl;
- BEV_LOCK(bev);
- bev_ssl = upcast(bev);
- if (bev_ssl)
- bev_ssl->allow_dirty_shutdown = !!allow_dirty_shutdown;
- BEV_UNLOCK(bev);
+
+err:
+ if (options & BEV_OPT_CLOSE_ON_FREE)
+ SSL_free(ssl);
+ return NULL;
}
+int
+bufferevent_openssl_get_allow_dirty_shutdown(struct bufferevent *bev)
+{
+ int allow_dirty_shutdown = -1;
+ struct bufferevent_openssl *bev_ssl;
+ BEV_LOCK(bev);
+ bev_ssl = upcast(bev);
+ if (bev_ssl)
+ allow_dirty_shutdown = bev_ssl->allow_dirty_shutdown;
+ BEV_UNLOCK(bev);
+ return allow_dirty_shutdown;
+}
+
+void
+bufferevent_openssl_set_allow_dirty_shutdown(struct bufferevent *bev,
+ int allow_dirty_shutdown)
+{
+ struct bufferevent_openssl *bev_ssl;
+ BEV_LOCK(bev);
+ bev_ssl = upcast(bev);
+ if (bev_ssl)
+ bev_ssl->allow_dirty_shutdown = !!allow_dirty_shutdown;
+ BEV_UNLOCK(bev);
+}
+
unsigned long
bufferevent_get_openssl_error(struct bufferevent *bev)
{
diff --git a/contrib/libs/libevent/bufferevent_pair.c b/contrib/libs/libevent/bufferevent_pair.c
index f88cd751de..d1c1d8ec8c 100644
--- a/contrib/libs/libevent/bufferevent_pair.c
+++ b/contrib/libs/libevent/bufferevent_pair.c
@@ -23,12 +23,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "event2/event-config.h"
+#include "evconfig-private.h"
#include <sys/types.h>
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
@@ -45,8 +45,8 @@
struct bufferevent_pair {
struct bufferevent_private bev;
struct bufferevent_pair *partner;
- /* For ->destruct() lock checking */
- struct bufferevent_pair *unlinked_partner;
+ /* For ->destruct() lock checking */
+ struct bufferevent_pair *unlinked_partner;
};
@@ -56,10 +56,10 @@ static inline struct bufferevent_pair *
upcast(struct bufferevent *bev)
{
struct bufferevent_pair *bev_p;
- if (!BEV_IS_PAIR(bev))
+ if (!BEV_IS_PAIR(bev))
return NULL;
bev_p = EVUTIL_UPCAST(bev, struct bufferevent_pair, bev.bev);
- EVUTIL_ASSERT(BEV_IS_PAIR(&bev_p->bev.bev));
+ EVUTIL_ASSERT(BEV_IS_PAIR(&bev_p->bev.bev));
return bev_p;
}
@@ -69,10 +69,10 @@ static inline void
incref_and_lock(struct bufferevent *b)
{
struct bufferevent_pair *bevp;
- bufferevent_incref_and_lock_(b);
+ bufferevent_incref_and_lock_(b);
bevp = upcast(b);
if (bevp->partner)
- bufferevent_incref_and_lock_(downcast(bevp->partner));
+ bufferevent_incref_and_lock_(downcast(bevp->partner));
}
static inline void
@@ -80,8 +80,8 @@ decref_and_unlock(struct bufferevent *b)
{
struct bufferevent_pair *bevp = upcast(b);
if (bevp->partner)
- bufferevent_decref_and_unlock_(downcast(bevp->partner));
- bufferevent_decref_and_unlock_(b);
+ bufferevent_decref_and_unlock_(downcast(bevp->partner));
+ bufferevent_decref_and_unlock_(b);
}
/* XXX Handle close */
@@ -96,7 +96,7 @@ bufferevent_pair_elt_new(struct event_base *base,
struct bufferevent_pair *bufev;
if (! (bufev = mm_calloc(1, sizeof(struct bufferevent_pair))))
return NULL;
- if (bufferevent_init_common_(&bufev->bev, base, &bufferevent_ops_pair,
+ if (bufferevent_init_common_(&bufev->bev, base, &bufferevent_ops_pair,
options)) {
mm_free(bufev);
return NULL;
@@ -106,7 +106,7 @@ bufferevent_pair_elt_new(struct event_base *base,
return NULL;
}
- bufferevent_init_generic_timeout_cbs_(&bufev->bev.bev);
+ bufferevent_init_generic_timeout_cbs_(&bufev->bev.bev);
return bufev;
}
@@ -132,7 +132,7 @@ bufferevent_pair_new(struct event_base *base, int options,
if (options & BEV_OPT_THREADSAFE) {
/*XXXX check return */
- bufferevent_enable_locking_(downcast(bufev2), bufev1->bev.lock);
+ bufferevent_enable_locking_(downcast(bufev2), bufev1->bev.lock);
}
bufev1->partner = bufev2;
@@ -153,7 +153,7 @@ static void
be_pair_transfer(struct bufferevent *src, struct bufferevent *dst,
int ignore_wm)
{
- size_t dst_size;
+ size_t dst_size;
size_t n;
evbuffer_unfreeze(src->output, 1);
@@ -184,8 +184,8 @@ be_pair_transfer(struct bufferevent *src, struct bufferevent *dst,
BEV_DEL_GENERIC_WRITE_TIMEOUT(dst);
}
- bufferevent_trigger_nolock_(dst, EV_READ, 0);
- bufferevent_trigger_nolock_(src, EV_WRITE, 0);
+ bufferevent_trigger_nolock_(dst, EV_READ, 0);
+ bufferevent_trigger_nolock_(src, EV_WRITE, 0);
done:
evbuffer_freeze(src->output, 1);
evbuffer_freeze(dst->input, 0);
@@ -255,50 +255,50 @@ be_pair_disable(struct bufferevent *bev, short events)
if (events & EV_READ) {
BEV_DEL_GENERIC_READ_TIMEOUT(bev);
}
- if (events & EV_WRITE) {
+ if (events & EV_WRITE) {
BEV_DEL_GENERIC_WRITE_TIMEOUT(bev);
- }
+ }
return 0;
}
static void
-be_pair_unlink(struct bufferevent *bev)
+be_pair_unlink(struct bufferevent *bev)
{
struct bufferevent_pair *bev_p = upcast(bev);
if (bev_p->partner) {
- bev_p->unlinked_partner = bev_p->partner;
+ bev_p->unlinked_partner = bev_p->partner;
bev_p->partner->partner = NULL;
bev_p->partner = NULL;
}
-}
-
-/* Free *shared* lock in the latest be (since we share it between two of them). */
-static void
-be_pair_destruct(struct bufferevent *bev)
-{
- struct bufferevent_pair *bev_p = upcast(bev);
-
- /* Transfer ownership of the lock into partner, otherwise we will use
- * already free'd lock during freeing second bev, see next example:
- *
- * bev1->own_lock = 1
- * bev2->own_lock = 0
- * bev2->lock = bev1->lock
- *
- * bufferevent_free(bev1) # refcnt == 0 -> unlink
- * bufferevent_free(bev2) # refcnt == 0 -> unlink
- *
- * event_base_free() -> finilizers -> EVTHREAD_FREE_LOCK(bev1->lock)
- * -> BEV_LOCK(bev2->lock) <-- already freed
- *
- * Where bev1 == pair[0], bev2 == pair[1].
- */
- if (bev_p->unlinked_partner && bev_p->bev.own_lock) {
- bev_p->unlinked_partner->bev.own_lock = 1;
- bev_p->bev.own_lock = 0;
- }
- bev_p->unlinked_partner = NULL;
+}
+
+/* Free *shared* lock in the latest be (since we share it between two of them). */
+static void
+be_pair_destruct(struct bufferevent *bev)
+{
+ struct bufferevent_pair *bev_p = upcast(bev);
+
+ /* Transfer ownership of the lock into partner, otherwise we will use
+ * already free'd lock during freeing second bev, see next example:
+ *
+ * bev1->own_lock = 1
+ * bev2->own_lock = 0
+ * bev2->lock = bev1->lock
+ *
+ * bufferevent_free(bev1) # refcnt == 0 -> unlink
+ * bufferevent_free(bev2) # refcnt == 0 -> unlink
+ *
+ * event_base_free() -> finilizers -> EVTHREAD_FREE_LOCK(bev1->lock)
+ * -> BEV_LOCK(bev2->lock) <-- already freed
+ *
+ * Where bev1 == pair[0], bev2 == pair[1].
+ */
+ if (bev_p->unlinked_partner && bev_p->bev.own_lock) {
+ bev_p->unlinked_partner->bev.own_lock = 1;
+ bev_p->bev.own_lock = 0;
+ }
+ bev_p->unlinked_partner = NULL;
}
static int
@@ -307,17 +307,17 @@ be_pair_flush(struct bufferevent *bev, short iotype,
{
struct bufferevent_pair *bev_p = upcast(bev);
struct bufferevent *partner;
-
+
if (!bev_p->partner)
return -1;
if (mode == BEV_NORMAL)
return 0;
- incref_and_lock(bev);
-
- partner = downcast(bev_p->partner);
-
+ incref_and_lock(bev);
+
+ partner = downcast(bev_p->partner);
+
if ((iotype & EV_READ) != 0)
be_pair_transfer(partner, bev, 1);
@@ -325,12 +325,12 @@ be_pair_flush(struct bufferevent *bev, short iotype,
be_pair_transfer(bev, partner, 1);
if (mode == BEV_FINISHED) {
- short what = BEV_EVENT_EOF;
- if (iotype & EV_READ)
- what |= BEV_EVENT_WRITING;
- if (iotype & EV_WRITE)
- what |= BEV_EVENT_READING;
- bufferevent_run_eventcb_(partner, what, 0);
+ short what = BEV_EVENT_EOF;
+ if (iotype & EV_READ)
+ what |= BEV_EVENT_WRITING;
+ if (iotype & EV_WRITE)
+ what |= BEV_EVENT_READING;
+ bufferevent_run_eventcb_(partner, what, 0);
}
decref_and_unlock(bev);
return 0;
@@ -357,9 +357,9 @@ const struct bufferevent_ops bufferevent_ops_pair = {
evutil_offsetof(struct bufferevent_pair, bev.bev),
be_pair_enable,
be_pair_disable,
- be_pair_unlink,
+ be_pair_unlink,
be_pair_destruct,
- bufferevent_generic_adj_timeouts_,
+ bufferevent_generic_adj_timeouts_,
be_pair_flush,
NULL, /* ctrl */
};
diff --git a/contrib/libs/libevent/bufferevent_ratelim.c b/contrib/libs/libevent/bufferevent_ratelim.c
index 2587496853..915fd3a32e 100644
--- a/contrib/libs/libevent/bufferevent_ratelim.c
+++ b/contrib/libs/libevent/bufferevent_ratelim.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "evconfig-private.h"
+#include "evconfig-private.h"
#include <sys/types.h>
#include <limits.h>
@@ -47,7 +47,7 @@
#include "event-internal.h"
int
-ev_token_bucket_init_(struct ev_token_bucket *bucket,
+ev_token_bucket_init_(struct ev_token_bucket *bucket,
const struct ev_token_bucket_cfg *cfg,
ev_uint32_t current_tick,
int reinitialize)
@@ -71,7 +71,7 @@ ev_token_bucket_init_(struct ev_token_bucket *bucket,
}
int
-ev_token_bucket_update_(struct ev_token_bucket *bucket,
+ev_token_bucket_update_(struct ev_token_bucket *bucket,
const struct ev_token_bucket_cfg *cfg,
ev_uint32_t current_tick)
{
@@ -117,14 +117,14 @@ bufferevent_update_buckets(struct bufferevent_private *bev)
struct timeval now;
unsigned tick;
event_base_gettimeofday_cached(bev->bev.ev_base, &now);
- tick = ev_token_bucket_get_tick_(&now, bev->rate_limiting->cfg);
+ tick = ev_token_bucket_get_tick_(&now, bev->rate_limiting->cfg);
if (tick != bev->rate_limiting->limit.last_updated)
- ev_token_bucket_update_(&bev->rate_limiting->limit,
+ ev_token_bucket_update_(&bev->rate_limiting->limit,
bev->rate_limiting->cfg, tick);
}
ev_uint32_t
-ev_token_bucket_get_tick_(const struct timeval *tv,
+ev_token_bucket_get_tick_(const struct timeval *tv,
const struct ev_token_bucket_cfg *cfg)
{
/* This computation uses two multiplies and a divide. We could do
@@ -178,27 +178,27 @@ ev_token_bucket_cfg_free(struct ev_token_bucket_cfg *cfg)
mm_free(cfg);
}
-/* Default values for max_single_read & max_single_write variables. */
-#define MAX_SINGLE_READ_DEFAULT 16384
-#define MAX_SINGLE_WRITE_DEFAULT 16384
+/* Default values for max_single_read & max_single_write variables. */
+#define MAX_SINGLE_READ_DEFAULT 16384
+#define MAX_SINGLE_WRITE_DEFAULT 16384
#define LOCK_GROUP(g) EVLOCK_LOCK((g)->lock, 0)
#define UNLOCK_GROUP(g) EVLOCK_UNLOCK((g)->lock, 0)
-static int bev_group_suspend_reading_(struct bufferevent_rate_limit_group *g);
-static int bev_group_suspend_writing_(struct bufferevent_rate_limit_group *g);
-static void bev_group_unsuspend_reading_(struct bufferevent_rate_limit_group *g);
-static void bev_group_unsuspend_writing_(struct bufferevent_rate_limit_group *g);
+static int bev_group_suspend_reading_(struct bufferevent_rate_limit_group *g);
+static int bev_group_suspend_writing_(struct bufferevent_rate_limit_group *g);
+static void bev_group_unsuspend_reading_(struct bufferevent_rate_limit_group *g);
+static void bev_group_unsuspend_writing_(struct bufferevent_rate_limit_group *g);
/** Helper: figure out the maximum amount we should write if is_write, or
the maximum amount we should read if is_read. Return that maximum, or
0 if our bucket is wholly exhausted.
*/
static inline ev_ssize_t
-bufferevent_get_rlim_max_(struct bufferevent_private *bev, int is_write)
+bufferevent_get_rlim_max_(struct bufferevent_private *bev, int is_write)
{
/* needs lock on bev. */
- ev_ssize_t max_so_far = is_write?bev->max_single_write:bev->max_single_read;
+ ev_ssize_t max_so_far = is_write?bev->max_single_write:bev->max_single_read;
#define LIM(x) \
(is_write ? (x).write_limit : (x).read_limit)
@@ -235,10 +235,10 @@ bufferevent_get_rlim_max_(struct bufferevent_private *bev, int is_write)
* particular bufferevent while suspending the whole
* group. */
if (is_write)
- bufferevent_suspend_write_(&bev->bev,
+ bufferevent_suspend_write_(&bev->bev,
BEV_SUSPEND_BW_GROUP);
else
- bufferevent_suspend_read_(&bev->bev,
+ bufferevent_suspend_read_(&bev->bev,
BEV_SUSPEND_BW_GROUP);
share = 0;
} else {
@@ -258,19 +258,19 @@ bufferevent_get_rlim_max_(struct bufferevent_private *bev, int is_write)
}
ev_ssize_t
-bufferevent_get_read_max_(struct bufferevent_private *bev)
+bufferevent_get_read_max_(struct bufferevent_private *bev)
{
- return bufferevent_get_rlim_max_(bev, 0);
+ return bufferevent_get_rlim_max_(bev, 0);
}
ev_ssize_t
-bufferevent_get_write_max_(struct bufferevent_private *bev)
+bufferevent_get_write_max_(struct bufferevent_private *bev)
{
- return bufferevent_get_rlim_max_(bev, 1);
+ return bufferevent_get_rlim_max_(bev, 1);
}
int
-bufferevent_decrement_read_buckets_(struct bufferevent_private *bev, ev_ssize_t bytes)
+bufferevent_decrement_read_buckets_(struct bufferevent_private *bev, ev_ssize_t bytes)
{
/* XXXXX Make sure all users of this function check its return value */
int r = 0;
@@ -281,14 +281,14 @@ bufferevent_decrement_read_buckets_(struct bufferevent_private *bev, ev_ssize_t
if (bev->rate_limiting->cfg) {
bev->rate_limiting->limit.read_limit -= bytes;
if (bev->rate_limiting->limit.read_limit <= 0) {
- bufferevent_suspend_read_(&bev->bev, BEV_SUSPEND_BW);
+ bufferevent_suspend_read_(&bev->bev, BEV_SUSPEND_BW);
if (event_add(&bev->rate_limiting->refill_bucket_event,
&bev->rate_limiting->cfg->tick_timeout) < 0)
r = -1;
} else if (bev->read_suspended & BEV_SUSPEND_BW) {
if (!(bev->write_suspended & BEV_SUSPEND_BW))
event_del(&bev->rate_limiting->refill_bucket_event);
- bufferevent_unsuspend_read_(&bev->bev, BEV_SUSPEND_BW);
+ bufferevent_unsuspend_read_(&bev->bev, BEV_SUSPEND_BW);
}
}
@@ -297,9 +297,9 @@ bufferevent_decrement_read_buckets_(struct bufferevent_private *bev, ev_ssize_t
bev->rate_limiting->group->rate_limit.read_limit -= bytes;
bev->rate_limiting->group->total_read += bytes;
if (bev->rate_limiting->group->rate_limit.read_limit <= 0) {
- bev_group_suspend_reading_(bev->rate_limiting->group);
+ bev_group_suspend_reading_(bev->rate_limiting->group);
} else if (bev->rate_limiting->group->read_suspended) {
- bev_group_unsuspend_reading_(bev->rate_limiting->group);
+ bev_group_unsuspend_reading_(bev->rate_limiting->group);
}
UNLOCK_GROUP(bev->rate_limiting->group);
}
@@ -308,7 +308,7 @@ bufferevent_decrement_read_buckets_(struct bufferevent_private *bev, ev_ssize_t
}
int
-bufferevent_decrement_write_buckets_(struct bufferevent_private *bev, ev_ssize_t bytes)
+bufferevent_decrement_write_buckets_(struct bufferevent_private *bev, ev_ssize_t bytes)
{
/* XXXXX Make sure all users of this function check its return value */
int r = 0;
@@ -319,14 +319,14 @@ bufferevent_decrement_write_buckets_(struct bufferevent_private *bev, ev_ssize_t
if (bev->rate_limiting->cfg) {
bev->rate_limiting->limit.write_limit -= bytes;
if (bev->rate_limiting->limit.write_limit <= 0) {
- bufferevent_suspend_write_(&bev->bev, BEV_SUSPEND_BW);
+ bufferevent_suspend_write_(&bev->bev, BEV_SUSPEND_BW);
if (event_add(&bev->rate_limiting->refill_bucket_event,
&bev->rate_limiting->cfg->tick_timeout) < 0)
r = -1;
} else if (bev->write_suspended & BEV_SUSPEND_BW) {
if (!(bev->read_suspended & BEV_SUSPEND_BW))
event_del(&bev->rate_limiting->refill_bucket_event);
- bufferevent_unsuspend_write_(&bev->bev, BEV_SUSPEND_BW);
+ bufferevent_unsuspend_write_(&bev->bev, BEV_SUSPEND_BW);
}
}
@@ -335,9 +335,9 @@ bufferevent_decrement_write_buckets_(struct bufferevent_private *bev, ev_ssize_t
bev->rate_limiting->group->rate_limit.write_limit -= bytes;
bev->rate_limiting->group->total_written += bytes;
if (bev->rate_limiting->group->rate_limit.write_limit <= 0) {
- bev_group_suspend_writing_(bev->rate_limiting->group);
+ bev_group_suspend_writing_(bev->rate_limiting->group);
} else if (bev->rate_limiting->group->write_suspended) {
- bev_group_unsuspend_writing_(bev->rate_limiting->group);
+ bev_group_unsuspend_writing_(bev->rate_limiting->group);
}
UNLOCK_GROUP(bev->rate_limiting->group);
}
@@ -347,22 +347,22 @@ bufferevent_decrement_write_buckets_(struct bufferevent_private *bev, ev_ssize_t
/** Stop reading on every bufferevent in <b>g</b> */
static int
-bev_group_suspend_reading_(struct bufferevent_rate_limit_group *g)
+bev_group_suspend_reading_(struct bufferevent_rate_limit_group *g)
{
/* Needs group lock */
struct bufferevent_private *bev;
g->read_suspended = 1;
g->pending_unsuspend_read = 0;
- /* Note that in this loop we call EVLOCK_TRY_LOCK_ instead of BEV_LOCK,
+ /* Note that in this loop we call EVLOCK_TRY_LOCK_ instead of BEV_LOCK,
to prevent a deadlock. (Ordinarily, the group lock nests inside
the bufferevent locks. If we are unable to lock any individual
bufferevent, it will find out later when it looks at its limit
- and sees that its group is suspended.)
+ and sees that its group is suspended.)
*/
- LIST_FOREACH(bev, &g->members, rate_limiting->next_in_group) {
- if (EVLOCK_TRY_LOCK_(bev->lock)) {
- bufferevent_suspend_read_(&bev->bev,
+ LIST_FOREACH(bev, &g->members, rate_limiting->next_in_group) {
+ if (EVLOCK_TRY_LOCK_(bev->lock)) {
+ bufferevent_suspend_read_(&bev->bev,
BEV_SUSPEND_BW_GROUP);
EVLOCK_UNLOCK(bev->lock, 0);
}
@@ -372,15 +372,15 @@ bev_group_suspend_reading_(struct bufferevent_rate_limit_group *g)
/** Stop writing on every bufferevent in <b>g</b> */
static int
-bev_group_suspend_writing_(struct bufferevent_rate_limit_group *g)
+bev_group_suspend_writing_(struct bufferevent_rate_limit_group *g)
{
/* Needs group lock */
struct bufferevent_private *bev;
g->write_suspended = 1;
g->pending_unsuspend_write = 0;
- LIST_FOREACH(bev, &g->members, rate_limiting->next_in_group) {
- if (EVLOCK_TRY_LOCK_(bev->lock)) {
- bufferevent_suspend_write_(&bev->bev,
+ LIST_FOREACH(bev, &g->members, rate_limiting->next_in_group) {
+ if (EVLOCK_TRY_LOCK_(bev->lock)) {
+ bufferevent_suspend_write_(&bev->bev,
BEV_SUSPEND_BW_GROUP);
EVLOCK_UNLOCK(bev->lock, 0);
}
@@ -391,7 +391,7 @@ bev_group_suspend_writing_(struct bufferevent_rate_limit_group *g)
/** Timer callback invoked on a single bufferevent with one or more exhausted
buckets when they are ready to refill. */
static void
-bev_refill_callback_(evutil_socket_t fd, short what, void *arg)
+bev_refill_callback_(evutil_socket_t fd, short what, void *arg)
{
unsigned tick;
struct timeval now;
@@ -405,22 +405,22 @@ bev_refill_callback_(evutil_socket_t fd, short what, void *arg)
/* First, update the bucket */
event_base_gettimeofday_cached(bev->bev.ev_base, &now);
- tick = ev_token_bucket_get_tick_(&now,
+ tick = ev_token_bucket_get_tick_(&now,
bev->rate_limiting->cfg);
- ev_token_bucket_update_(&bev->rate_limiting->limit,
+ ev_token_bucket_update_(&bev->rate_limiting->limit,
bev->rate_limiting->cfg,
tick);
/* Now unsuspend any read/write operations as appropriate. */
if ((bev->read_suspended & BEV_SUSPEND_BW)) {
if (bev->rate_limiting->limit.read_limit > 0)
- bufferevent_unsuspend_read_(&bev->bev, BEV_SUSPEND_BW);
+ bufferevent_unsuspend_read_(&bev->bev, BEV_SUSPEND_BW);
else
again = 1;
}
if ((bev->write_suspended & BEV_SUSPEND_BW)) {
if (bev->rate_limiting->limit.write_limit > 0)
- bufferevent_unsuspend_write_(&bev->bev, BEV_SUSPEND_BW);
+ bufferevent_unsuspend_write_(&bev->bev, BEV_SUSPEND_BW);
else
again = 1;
}
@@ -438,12 +438,12 @@ bev_refill_callback_(evutil_socket_t fd, short what, void *arg)
BEV_UNLOCK(&bev->bev);
}
-/** Helper: grab a random element from a bufferevent group.
- *
- * Requires that we hold the lock on the group.
- */
+/** Helper: grab a random element from a bufferevent group.
+ *
+ * Requires that we hold the lock on the group.
+ */
static struct bufferevent_private *
-bev_group_random_element_(struct bufferevent_rate_limit_group *group)
+bev_group_random_element_(struct bufferevent_rate_limit_group *group)
{
int which;
struct bufferevent_private *bev;
@@ -453,13 +453,13 @@ bev_group_random_element_(struct bufferevent_rate_limit_group *group)
if (!group->n_members)
return NULL;
- EVUTIL_ASSERT(! LIST_EMPTY(&group->members));
+ EVUTIL_ASSERT(! LIST_EMPTY(&group->members));
- which = evutil_weakrand_range_(&group->weakrand_seed, group->n_members);
+ which = evutil_weakrand_range_(&group->weakrand_seed, group->n_members);
- bev = LIST_FIRST(&group->members);
+ bev = LIST_FIRST(&group->members);
while (which--)
- bev = LIST_NEXT(bev, rate_limiting->next_in_group);
+ bev = LIST_NEXT(bev, rate_limiting->next_in_group);
return bev;
}
@@ -473,27 +473,27 @@ bev_group_random_element_(struct bufferevent_rate_limit_group *group)
*/
#define FOREACH_RANDOM_ORDER(block) \
do { \
- first = bev_group_random_element_(g); \
- for (bev = first; bev != LIST_END(&g->members); \
- bev = LIST_NEXT(bev, rate_limiting->next_in_group)) { \
+ first = bev_group_random_element_(g); \
+ for (bev = first; bev != LIST_END(&g->members); \
+ bev = LIST_NEXT(bev, rate_limiting->next_in_group)) { \
block ; \
} \
- for (bev = LIST_FIRST(&g->members); bev && bev != first; \
- bev = LIST_NEXT(bev, rate_limiting->next_in_group)) { \
+ for (bev = LIST_FIRST(&g->members); bev && bev != first; \
+ bev = LIST_NEXT(bev, rate_limiting->next_in_group)) { \
block ; \
} \
} while (0)
static void
-bev_group_unsuspend_reading_(struct bufferevent_rate_limit_group *g)
+bev_group_unsuspend_reading_(struct bufferevent_rate_limit_group *g)
{
int again = 0;
struct bufferevent_private *bev, *first;
g->read_suspended = 0;
FOREACH_RANDOM_ORDER({
- if (EVLOCK_TRY_LOCK_(bev->lock)) {
- bufferevent_unsuspend_read_(&bev->bev,
+ if (EVLOCK_TRY_LOCK_(bev->lock)) {
+ bufferevent_unsuspend_read_(&bev->bev,
BEV_SUSPEND_BW_GROUP);
EVLOCK_UNLOCK(bev->lock, 0);
} else {
@@ -504,15 +504,15 @@ bev_group_unsuspend_reading_(struct bufferevent_rate_limit_group *g)
}
static void
-bev_group_unsuspend_writing_(struct bufferevent_rate_limit_group *g)
+bev_group_unsuspend_writing_(struct bufferevent_rate_limit_group *g)
{
int again = 0;
struct bufferevent_private *bev, *first;
g->write_suspended = 0;
FOREACH_RANDOM_ORDER({
- if (EVLOCK_TRY_LOCK_(bev->lock)) {
- bufferevent_unsuspend_write_(&bev->bev,
+ if (EVLOCK_TRY_LOCK_(bev->lock)) {
+ bufferevent_unsuspend_write_(&bev->bev,
BEV_SUSPEND_BW_GROUP);
EVLOCK_UNLOCK(bev->lock, 0);
} else {
@@ -526,7 +526,7 @@ bev_group_unsuspend_writing_(struct bufferevent_rate_limit_group *g)
and unsuspend group members as needed.
*/
static void
-bev_group_refill_callback_(evutil_socket_t fd, short what, void *arg)
+bev_group_refill_callback_(evutil_socket_t fd, short what, void *arg)
{
struct bufferevent_rate_limit_group *g = arg;
unsigned tick;
@@ -536,16 +536,16 @@ bev_group_refill_callback_(evutil_socket_t fd, short what, void *arg)
LOCK_GROUP(g);
- tick = ev_token_bucket_get_tick_(&now, &g->rate_limit_cfg);
- ev_token_bucket_update_(&g->rate_limit, &g->rate_limit_cfg, tick);
+ tick = ev_token_bucket_get_tick_(&now, &g->rate_limit_cfg);
+ ev_token_bucket_update_(&g->rate_limit, &g->rate_limit_cfg, tick);
if (g->pending_unsuspend_read ||
(g->read_suspended && (g->rate_limit.read_limit >= g->min_share))) {
- bev_group_unsuspend_reading_(g);
+ bev_group_unsuspend_reading_(g);
}
if (g->pending_unsuspend_write ||
(g->write_suspended && (g->rate_limit.write_limit >= g->min_share))){
- bev_group_unsuspend_writing_(g);
+ bev_group_unsuspend_writing_(g);
}
/* XXXX Rather than waiting to the next tick to unsuspend stuff
@@ -560,7 +560,7 @@ int
bufferevent_set_rate_limit(struct bufferevent *bev,
struct ev_token_bucket_cfg *cfg)
{
- struct bufferevent_private *bevp = BEV_UPCAST(bev);
+ struct bufferevent_private *bevp = BEV_UPCAST(bev);
int r = -1;
struct bufferevent_rate_limit *rlim;
struct timeval now;
@@ -574,8 +574,8 @@ bufferevent_set_rate_limit(struct bufferevent *bev,
if (bevp->rate_limiting) {
rlim = bevp->rate_limiting;
rlim->cfg = NULL;
- bufferevent_unsuspend_read_(bev, BEV_SUSPEND_BW);
- bufferevent_unsuspend_write_(bev, BEV_SUSPEND_BW);
+ bufferevent_unsuspend_read_(bev, BEV_SUSPEND_BW);
+ bufferevent_unsuspend_write_(bev, BEV_SUSPEND_BW);
if (event_initialized(&rlim->refill_bucket_event))
event_del(&rlim->refill_bucket_event);
}
@@ -584,7 +584,7 @@ bufferevent_set_rate_limit(struct bufferevent *bev,
}
event_base_gettimeofday_cached(bev->ev_base, &now);
- tick = ev_token_bucket_get_tick_(&now, cfg);
+ tick = ev_token_bucket_get_tick_(&now, cfg);
if (bevp->rate_limiting && bevp->rate_limiting->cfg == cfg) {
/* no-op */
@@ -602,25 +602,25 @@ bufferevent_set_rate_limit(struct bufferevent *bev,
reinit = rlim->cfg != NULL;
rlim->cfg = cfg;
- ev_token_bucket_init_(&rlim->limit, cfg, tick, reinit);
+ ev_token_bucket_init_(&rlim->limit, cfg, tick, reinit);
if (reinit) {
EVUTIL_ASSERT(event_initialized(&rlim->refill_bucket_event));
event_del(&rlim->refill_bucket_event);
}
- event_assign(&rlim->refill_bucket_event, bev->ev_base,
- -1, EV_FINALIZE, bev_refill_callback_, bevp);
+ event_assign(&rlim->refill_bucket_event, bev->ev_base,
+ -1, EV_FINALIZE, bev_refill_callback_, bevp);
if (rlim->limit.read_limit > 0) {
- bufferevent_unsuspend_read_(bev, BEV_SUSPEND_BW);
+ bufferevent_unsuspend_read_(bev, BEV_SUSPEND_BW);
} else {
- bufferevent_suspend_read_(bev, BEV_SUSPEND_BW);
+ bufferevent_suspend_read_(bev, BEV_SUSPEND_BW);
suspended=1;
}
if (rlim->limit.write_limit > 0) {
- bufferevent_unsuspend_write_(bev, BEV_SUSPEND_BW);
+ bufferevent_unsuspend_write_(bev, BEV_SUSPEND_BW);
} else {
- bufferevent_suspend_write_(bev, BEV_SUSPEND_BW);
+ bufferevent_suspend_write_(bev, BEV_SUSPEND_BW);
suspended = 1;
}
@@ -643,18 +643,18 @@ bufferevent_rate_limit_group_new(struct event_base *base,
ev_uint32_t tick;
event_base_gettimeofday_cached(base, &now);
- tick = ev_token_bucket_get_tick_(&now, cfg);
+ tick = ev_token_bucket_get_tick_(&now, cfg);
g = mm_calloc(1, sizeof(struct bufferevent_rate_limit_group));
if (!g)
return NULL;
memcpy(&g->rate_limit_cfg, cfg, sizeof(g->rate_limit_cfg));
- LIST_INIT(&g->members);
+ LIST_INIT(&g->members);
- ev_token_bucket_init_(&g->rate_limit, cfg, tick, 0);
+ ev_token_bucket_init_(&g->rate_limit, cfg, tick, 0);
- event_assign(&g->master_refill_event, base, -1, EV_PERSIST|EV_FINALIZE,
- bev_group_refill_callback_, g);
+ event_assign(&g->master_refill_event, base, -1, EV_PERSIST|EV_FINALIZE,
+ bev_group_refill_callback_, g);
/*XXXX handle event_add failure */
event_add(&g->master_refill_event, &cfg->tick_timeout);
@@ -662,9 +662,9 @@ bufferevent_rate_limit_group_new(struct event_base *base,
bufferevent_rate_limit_group_set_min_share(g, 64);
- evutil_weakrand_seed_(&g->weakrand_seed,
- (ev_uint32_t) ((now.tv_sec + now.tv_usec) + (ev_intptr_t)g));
-
+ evutil_weakrand_seed_(&g->weakrand_seed,
+ (ev_uint32_t) ((now.tv_sec + now.tv_usec) + (ev_intptr_t)g));
+
return g;
}
@@ -736,7 +736,7 @@ bufferevent_add_to_rate_limit_group(struct bufferevent *bev,
struct bufferevent_rate_limit_group *g)
{
int wsuspend, rsuspend;
- struct bufferevent_private *bevp = BEV_UPCAST(bev);
+ struct bufferevent_private *bevp = BEV_UPCAST(bev);
BEV_LOCK(bev);
if (!bevp->rate_limiting) {
@@ -746,8 +746,8 @@ bufferevent_add_to_rate_limit_group(struct bufferevent *bev,
BEV_UNLOCK(bev);
return -1;
}
- event_assign(&rlim->refill_bucket_event, bev->ev_base,
- -1, EV_FINALIZE, bev_refill_callback_, bevp);
+ event_assign(&rlim->refill_bucket_event, bev->ev_base,
+ -1, EV_FINALIZE, bev_refill_callback_, bevp);
bevp->rate_limiting = rlim;
}
@@ -761,7 +761,7 @@ bufferevent_add_to_rate_limit_group(struct bufferevent *bev,
LOCK_GROUP(g);
bevp->rate_limiting->group = g;
++g->n_members;
- LIST_INSERT_HEAD(&g->members, bevp, rate_limiting->next_in_group);
+ LIST_INSERT_HEAD(&g->members, bevp, rate_limiting->next_in_group);
rsuspend = g->read_suspended;
wsuspend = g->write_suspended;
@@ -769,9 +769,9 @@ bufferevent_add_to_rate_limit_group(struct bufferevent *bev,
UNLOCK_GROUP(g);
if (rsuspend)
- bufferevent_suspend_read_(bev, BEV_SUSPEND_BW_GROUP);
+ bufferevent_suspend_read_(bev, BEV_SUSPEND_BW_GROUP);
if (wsuspend)
- bufferevent_suspend_write_(bev, BEV_SUSPEND_BW_GROUP);
+ bufferevent_suspend_write_(bev, BEV_SUSPEND_BW_GROUP);
BEV_UNLOCK(bev);
return 0;
@@ -780,14 +780,14 @@ bufferevent_add_to_rate_limit_group(struct bufferevent *bev,
int
bufferevent_remove_from_rate_limit_group(struct bufferevent *bev)
{
- return bufferevent_remove_from_rate_limit_group_internal_(bev, 1);
+ return bufferevent_remove_from_rate_limit_group_internal_(bev, 1);
}
int
-bufferevent_remove_from_rate_limit_group_internal_(struct bufferevent *bev,
+bufferevent_remove_from_rate_limit_group_internal_(struct bufferevent *bev,
int unsuspend)
{
- struct bufferevent_private *bevp = BEV_UPCAST(bev);
+ struct bufferevent_private *bevp = BEV_UPCAST(bev);
BEV_LOCK(bev);
if (bevp->rate_limiting && bevp->rate_limiting->group) {
struct bufferevent_rate_limit_group *g =
@@ -795,12 +795,12 @@ bufferevent_remove_from_rate_limit_group_internal_(struct bufferevent *bev,
LOCK_GROUP(g);
bevp->rate_limiting->group = NULL;
--g->n_members;
- LIST_REMOVE(bevp, rate_limiting->next_in_group);
+ LIST_REMOVE(bevp, rate_limiting->next_in_group);
UNLOCK_GROUP(g);
}
if (unsuspend) {
- bufferevent_unsuspend_read_(bev, BEV_SUSPEND_BW_GROUP);
- bufferevent_unsuspend_write_(bev, BEV_SUSPEND_BW_GROUP);
+ bufferevent_unsuspend_read_(bev, BEV_SUSPEND_BW_GROUP);
+ bufferevent_unsuspend_write_(bev, BEV_SUSPEND_BW_GROUP);
}
BEV_UNLOCK(bev);
return 0;
@@ -814,7 +814,7 @@ bufferevent_remove_from_rate_limit_group_internal_(struct bufferevent *bev,
* === */
/* Mostly you don't want to use this function from inside libevent;
- * bufferevent_get_read_max_() is more likely what you want*/
+ * bufferevent_get_read_max_() is more likely what you want*/
ev_ssize_t
bufferevent_get_read_limit(struct bufferevent *bev)
{
@@ -833,7 +833,7 @@ bufferevent_get_read_limit(struct bufferevent *bev)
}
/* Mostly you don't want to use this function from inside libevent;
- * bufferevent_get_write_max_() is more likely what you want*/
+ * bufferevent_get_write_max_() is more likely what you want*/
ev_ssize_t
bufferevent_get_write_limit(struct bufferevent *bev)
{
@@ -851,62 +851,62 @@ bufferevent_get_write_limit(struct bufferevent *bev)
return r;
}
-int
-bufferevent_set_max_single_read(struct bufferevent *bev, size_t size)
-{
- struct bufferevent_private *bevp;
- BEV_LOCK(bev);
- bevp = BEV_UPCAST(bev);
- if (size == 0 || size > EV_SSIZE_MAX)
- bevp->max_single_read = MAX_SINGLE_READ_DEFAULT;
- else
- bevp->max_single_read = size;
- BEV_UNLOCK(bev);
- return 0;
-}
-
-int
-bufferevent_set_max_single_write(struct bufferevent *bev, size_t size)
-{
- struct bufferevent_private *bevp;
- BEV_LOCK(bev);
- bevp = BEV_UPCAST(bev);
- if (size == 0 || size > EV_SSIZE_MAX)
- bevp->max_single_write = MAX_SINGLE_WRITE_DEFAULT;
- else
- bevp->max_single_write = size;
- BEV_UNLOCK(bev);
- return 0;
-}
-
-ev_ssize_t
-bufferevent_get_max_single_read(struct bufferevent *bev)
-{
- ev_ssize_t r;
-
- BEV_LOCK(bev);
- r = BEV_UPCAST(bev)->max_single_read;
- BEV_UNLOCK(bev);
- return r;
-}
-
-ev_ssize_t
-bufferevent_get_max_single_write(struct bufferevent *bev)
-{
- ev_ssize_t r;
-
- BEV_LOCK(bev);
- r = BEV_UPCAST(bev)->max_single_write;
- BEV_UNLOCK(bev);
- return r;
-}
-
+int
+bufferevent_set_max_single_read(struct bufferevent *bev, size_t size)
+{
+ struct bufferevent_private *bevp;
+ BEV_LOCK(bev);
+ bevp = BEV_UPCAST(bev);
+ if (size == 0 || size > EV_SSIZE_MAX)
+ bevp->max_single_read = MAX_SINGLE_READ_DEFAULT;
+ else
+ bevp->max_single_read = size;
+ BEV_UNLOCK(bev);
+ return 0;
+}
+
+int
+bufferevent_set_max_single_write(struct bufferevent *bev, size_t size)
+{
+ struct bufferevent_private *bevp;
+ BEV_LOCK(bev);
+ bevp = BEV_UPCAST(bev);
+ if (size == 0 || size > EV_SSIZE_MAX)
+ bevp->max_single_write = MAX_SINGLE_WRITE_DEFAULT;
+ else
+ bevp->max_single_write = size;
+ BEV_UNLOCK(bev);
+ return 0;
+}
+
ev_ssize_t
+bufferevent_get_max_single_read(struct bufferevent *bev)
+{
+ ev_ssize_t r;
+
+ BEV_LOCK(bev);
+ r = BEV_UPCAST(bev)->max_single_read;
+ BEV_UNLOCK(bev);
+ return r;
+}
+
+ev_ssize_t
+bufferevent_get_max_single_write(struct bufferevent *bev)
+{
+ ev_ssize_t r;
+
+ BEV_LOCK(bev);
+ r = BEV_UPCAST(bev)->max_single_write;
+ BEV_UNLOCK(bev);
+ return r;
+}
+
+ev_ssize_t
bufferevent_get_max_to_read(struct bufferevent *bev)
{
ev_ssize_t r;
BEV_LOCK(bev);
- r = bufferevent_get_read_max_(BEV_UPCAST(bev));
+ r = bufferevent_get_read_max_(BEV_UPCAST(bev));
BEV_UNLOCK(bev);
return r;
}
@@ -916,31 +916,31 @@ bufferevent_get_max_to_write(struct bufferevent *bev)
{
ev_ssize_t r;
BEV_LOCK(bev);
- r = bufferevent_get_write_max_(BEV_UPCAST(bev));
+ r = bufferevent_get_write_max_(BEV_UPCAST(bev));
BEV_UNLOCK(bev);
return r;
}
-const struct ev_token_bucket_cfg *
-bufferevent_get_token_bucket_cfg(const struct bufferevent *bev) {
- struct bufferevent_private *bufev_private = BEV_UPCAST(bev);
- struct ev_token_bucket_cfg *cfg;
-
- BEV_LOCK(bev);
-
- if (bufev_private->rate_limiting) {
- cfg = bufev_private->rate_limiting->cfg;
- } else {
- cfg = NULL;
- }
-
- BEV_UNLOCK(bev);
-
- return cfg;
-}
-
+const struct ev_token_bucket_cfg *
+bufferevent_get_token_bucket_cfg(const struct bufferevent *bev) {
+ struct bufferevent_private *bufev_private = BEV_UPCAST(bev);
+ struct ev_token_bucket_cfg *cfg;
+
+ BEV_LOCK(bev);
+
+ if (bufev_private->rate_limiting) {
+ cfg = bufev_private->rate_limiting->cfg;
+ } else {
+ cfg = NULL;
+ }
+
+ BEV_UNLOCK(bev);
+
+ return cfg;
+}
+
/* Mostly you don't want to use this function from inside libevent;
- * bufferevent_get_read_max_() is more likely what you want*/
+ * bufferevent_get_read_max_() is more likely what you want*/
ev_ssize_t
bufferevent_rate_limit_group_get_read_limit(
struct bufferevent_rate_limit_group *grp)
@@ -953,7 +953,7 @@ bufferevent_rate_limit_group_get_read_limit(
}
/* Mostly you don't want to use this function from inside libevent;
- * bufferevent_get_write_max_() is more likely what you want. */
+ * bufferevent_get_write_max_() is more likely what you want. */
ev_ssize_t
bufferevent_rate_limit_group_get_write_limit(
struct bufferevent_rate_limit_group *grp)
@@ -978,14 +978,14 @@ bufferevent_decrement_read_limit(struct bufferevent *bev, ev_ssize_t decr)
new_limit = (bevp->rate_limiting->limit.read_limit -= decr);
if (old_limit > 0 && new_limit <= 0) {
- bufferevent_suspend_read_(bev, BEV_SUSPEND_BW);
+ bufferevent_suspend_read_(bev, BEV_SUSPEND_BW);
if (event_add(&bevp->rate_limiting->refill_bucket_event,
&bevp->rate_limiting->cfg->tick_timeout) < 0)
r = -1;
} else if (old_limit <= 0 && new_limit > 0) {
if (!(bevp->write_suspended & BEV_SUSPEND_BW))
event_del(&bevp->rate_limiting->refill_bucket_event);
- bufferevent_unsuspend_read_(bev, BEV_SUSPEND_BW);
+ bufferevent_unsuspend_read_(bev, BEV_SUSPEND_BW);
}
BEV_UNLOCK(bev);
@@ -1007,14 +1007,14 @@ bufferevent_decrement_write_limit(struct bufferevent *bev, ev_ssize_t decr)
new_limit = (bevp->rate_limiting->limit.write_limit -= decr);
if (old_limit > 0 && new_limit <= 0) {
- bufferevent_suspend_write_(bev, BEV_SUSPEND_BW);
+ bufferevent_suspend_write_(bev, BEV_SUSPEND_BW);
if (event_add(&bevp->rate_limiting->refill_bucket_event,
&bevp->rate_limiting->cfg->tick_timeout) < 0)
r = -1;
} else if (old_limit <= 0 && new_limit > 0) {
if (!(bevp->read_suspended & BEV_SUSPEND_BW))
event_del(&bevp->rate_limiting->refill_bucket_event);
- bufferevent_unsuspend_write_(bev, BEV_SUSPEND_BW);
+ bufferevent_unsuspend_write_(bev, BEV_SUSPEND_BW);
}
BEV_UNLOCK(bev);
@@ -1032,9 +1032,9 @@ bufferevent_rate_limit_group_decrement_read(
new_limit = (grp->rate_limit.read_limit -= decr);
if (old_limit > 0 && new_limit <= 0) {
- bev_group_suspend_reading_(grp);
+ bev_group_suspend_reading_(grp);
} else if (old_limit <= 0 && new_limit > 0) {
- bev_group_unsuspend_reading_(grp);
+ bev_group_unsuspend_reading_(grp);
}
UNLOCK_GROUP(grp);
@@ -1052,9 +1052,9 @@ bufferevent_rate_limit_group_decrement_write(
new_limit = (grp->rate_limit.write_limit -= decr);
if (old_limit > 0 && new_limit <= 0) {
- bev_group_suspend_writing_(grp);
+ bev_group_suspend_writing_(grp);
} else if (old_limit <= 0 && new_limit > 0) {
- bev_group_unsuspend_writing_(grp);
+ bev_group_unsuspend_writing_(grp);
}
UNLOCK_GROUP(grp);
@@ -1077,13 +1077,13 @@ bufferevent_rate_limit_group_reset_totals(struct bufferevent_rate_limit_group *g
{
grp->total_read = grp->total_written = 0;
}
-
-int
-bufferevent_ratelim_init_(struct bufferevent_private *bev)
-{
- bev->rate_limiting = NULL;
- bev->max_single_read = MAX_SINGLE_READ_DEFAULT;
- bev->max_single_write = MAX_SINGLE_WRITE_DEFAULT;
-
- return 0;
-}
+
+int
+bufferevent_ratelim_init_(struct bufferevent_private *bev)
+{
+ bev->rate_limiting = NULL;
+ bev->max_single_read = MAX_SINGLE_READ_DEFAULT;
+ bev->max_single_write = MAX_SINGLE_WRITE_DEFAULT;
+
+ return 0;
+}
diff --git a/contrib/libs/libevent/bufferevent_sock.c b/contrib/libs/libevent/bufferevent_sock.c
index 003a5d3d0d..148a45fa7c 100644
--- a/contrib/libs/libevent/bufferevent_sock.c
+++ b/contrib/libs/libevent/bufferevent_sock.c
@@ -26,12 +26,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "event2/event-config.h"
-#include "evconfig-private.h"
-
+#include "event2/event-config.h"
+#include "evconfig-private.h"
+
#include <sys/types.h>
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -39,27 +39,27 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef EVENT__HAVE_STDARG_H
+#ifdef EVENT__HAVE_STDARG_H
#include <stdarg.h>
#endif
-#ifdef EVENT__HAVE_UNISTD_H
+#ifdef EVENT__HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
-#ifdef EVENT__HAVE_SYS_SOCKET_H
+#ifdef EVENT__HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#ifdef EVENT__HAVE_NETINET_IN_H
+#ifdef EVENT__HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
-#ifdef EVENT__HAVE_NETINET_IN6_H
-#error #include <netinet/in6.h>
-#endif
+#ifdef EVENT__HAVE_NETINET_IN6_H
+#error #include <netinet/in6.h>
+#endif
#include "event2/util.h"
#include "event2/bufferevent.h"
@@ -71,7 +71,7 @@
#include "mm-internal.h"
#include "bufferevent-internal.h"
#include "util-internal.h"
-#ifdef _WIN32
+#ifdef _WIN32
#include "iocp-internal.h"
#endif
@@ -89,49 +89,49 @@ const struct bufferevent_ops bufferevent_ops_socket = {
evutil_offsetof(struct bufferevent_private, bev),
be_socket_enable,
be_socket_disable,
- NULL, /* unlink */
+ NULL, /* unlink */
be_socket_destruct,
- bufferevent_generic_adj_existing_timeouts_,
+ bufferevent_generic_adj_existing_timeouts_,
be_socket_flush,
be_socket_ctrl,
};
-const struct sockaddr*
-bufferevent_socket_get_conn_address_(struct bufferevent *bev)
-{
- struct bufferevent_private *bev_p = BEV_UPCAST(bev);
- return (struct sockaddr *)&bev_p->conn_address;
-}
-
-void
-bufferevent_socket_set_conn_address_fd_(struct bufferevent *bev,
- evutil_socket_t fd)
-{
- struct bufferevent_private *bev_p = BEV_UPCAST(bev);
-
- socklen_t len = sizeof(bev_p->conn_address);
-
- struct sockaddr *addr = (struct sockaddr *)&bev_p->conn_address;
- if (addr->sa_family != AF_UNSPEC)
- getpeername(fd, addr, &len);
-}
-
-void
-bufferevent_socket_set_conn_address_(struct bufferevent *bev,
- struct sockaddr *addr, size_t addrlen)
-{
- struct bufferevent_private *bev_p = BEV_UPCAST(bev);
- EVUTIL_ASSERT(addrlen <= sizeof(bev_p->conn_address));
- memcpy(&bev_p->conn_address, addr, addrlen);
-}
-
+const struct sockaddr*
+bufferevent_socket_get_conn_address_(struct bufferevent *bev)
+{
+ struct bufferevent_private *bev_p = BEV_UPCAST(bev);
+ return (struct sockaddr *)&bev_p->conn_address;
+}
+
+void
+bufferevent_socket_set_conn_address_fd_(struct bufferevent *bev,
+ evutil_socket_t fd)
+{
+ struct bufferevent_private *bev_p = BEV_UPCAST(bev);
+
+ socklen_t len = sizeof(bev_p->conn_address);
+
+ struct sockaddr *addr = (struct sockaddr *)&bev_p->conn_address;
+ if (addr->sa_family != AF_UNSPEC)
+ getpeername(fd, addr, &len);
+}
+
+void
+bufferevent_socket_set_conn_address_(struct bufferevent *bev,
+ struct sockaddr *addr, size_t addrlen)
+{
+ struct bufferevent_private *bev_p = BEV_UPCAST(bev);
+ EVUTIL_ASSERT(addrlen <= sizeof(bev_p->conn_address));
+ memcpy(&bev_p->conn_address, addr, addrlen);
+}
+
static void
bufferevent_socket_outbuf_cb(struct evbuffer *buf,
const struct evbuffer_cb_info *cbinfo,
void *arg)
{
struct bufferevent *bufev = arg;
- struct bufferevent_private *bufev_p = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_p = BEV_UPCAST(bufev);
if (cbinfo->n_added &&
(bufev->enabled & EV_WRITE) &&
@@ -139,7 +139,7 @@ bufferevent_socket_outbuf_cb(struct evbuffer *buf,
!bufev_p->write_suspended) {
/* Somebody added data to the buffer, and we would like to
* write, and we were not writing. So, start writing. */
- if (bufferevent_add_event_(&bufev->ev_write, &bufev->timeout_write) == -1) {
+ if (bufferevent_add_event_(&bufev->ev_write, &bufev->timeout_write) == -1) {
/* Should we log this? */
}
}
@@ -149,13 +149,13 @@ static void
bufferevent_readcb(evutil_socket_t fd, short event, void *arg)
{
struct bufferevent *bufev = arg;
- struct bufferevent_private *bufev_p = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_p = BEV_UPCAST(bufev);
struct evbuffer *input;
int res = 0;
short what = BEV_EVENT_READING;
ev_ssize_t howmuch = -1, readmax=-1;
- bufferevent_incref_and_lock_(bufev);
+ bufferevent_incref_and_lock_(bufev);
if (event == EV_TIMEOUT) {
/* Note that we only check for event==EV_TIMEOUT. If
@@ -179,7 +179,7 @@ bufferevent_readcb(evutil_socket_t fd, short event, void *arg)
goto done;
}
}
- readmax = bufferevent_get_read_max_(bufev_p);
+ readmax = bufferevent_get_read_max_(bufev_p);
if (howmuch < 0 || howmuch > readmax) /* The use of -1 for "unlimited"
* uglifies this code. XXXX */
howmuch = readmax;
@@ -194,10 +194,10 @@ bufferevent_readcb(evutil_socket_t fd, short event, void *arg)
int err = evutil_socket_geterror(fd);
if (EVUTIL_ERR_RW_RETRIABLE(err))
goto reschedule;
- if (EVUTIL_ERR_CONNECT_REFUSED(err)) {
- bufev_p->connection_refused = 1;
- goto done;
- }
+ if (EVUTIL_ERR_CONNECT_REFUSED(err)) {
+ bufev_p->connection_refused = 1;
+ goto done;
+ }
/* error case */
what |= BEV_EVENT_ERROR;
} else if (res == 0) {
@@ -208,10 +208,10 @@ bufferevent_readcb(evutil_socket_t fd, short event, void *arg)
if (res <= 0)
goto error;
- bufferevent_decrement_read_buckets_(bufev_p, res);
+ bufferevent_decrement_read_buckets_(bufev_p, res);
/* Invoke the user callback - must always be called last */
- bufferevent_trigger_nolock_(bufev, EV_READ, 0);
+ bufferevent_trigger_nolock_(bufev, EV_READ, 0);
goto done;
@@ -220,23 +220,23 @@ bufferevent_readcb(evutil_socket_t fd, short event, void *arg)
error:
bufferevent_disable(bufev, EV_READ);
- bufferevent_run_eventcb_(bufev, what, 0);
+ bufferevent_run_eventcb_(bufev, what, 0);
done:
- bufferevent_decref_and_unlock_(bufev);
+ bufferevent_decref_and_unlock_(bufev);
}
static void
bufferevent_writecb(evutil_socket_t fd, short event, void *arg)
{
struct bufferevent *bufev = arg;
- struct bufferevent_private *bufev_p = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_p = BEV_UPCAST(bufev);
int res = 0;
short what = BEV_EVENT_WRITING;
int connected = 0;
ev_ssize_t atmost = -1;
- bufferevent_incref_and_lock_(bufev);
+ bufferevent_incref_and_lock_(bufev);
if (event == EV_TIMEOUT) {
/* Note that we only check for event==EV_TIMEOUT. If
@@ -246,12 +246,12 @@ bufferevent_writecb(evutil_socket_t fd, short event, void *arg)
goto error;
}
if (bufev_p->connecting) {
- int c = evutil_socket_finished_connecting_(fd);
+ int c = evutil_socket_finished_connecting_(fd);
/* we need to fake the error if the connection was refused
* immediately - usually connection to localhost on BSD */
if (bufev_p->connection_refused) {
- bufev_p->connection_refused = 0;
- c = -1;
+ bufev_p->connection_refused = 0;
+ c = -1;
}
if (c == 0)
@@ -261,22 +261,22 @@ bufferevent_writecb(evutil_socket_t fd, short event, void *arg)
if (c < 0) {
event_del(&bufev->ev_write);
event_del(&bufev->ev_read);
- bufferevent_run_eventcb_(bufev, BEV_EVENT_ERROR, 0);
+ bufferevent_run_eventcb_(bufev, BEV_EVENT_ERROR, 0);
goto done;
} else {
connected = 1;
- bufferevent_socket_set_conn_address_fd_(bufev, fd);
-#ifdef _WIN32
+ bufferevent_socket_set_conn_address_fd_(bufev, fd);
+#ifdef _WIN32
if (BEV_IS_ASYNC(bufev)) {
event_del(&bufev->ev_write);
- bufferevent_async_set_connected_(bufev);
- bufferevent_run_eventcb_(bufev,
- BEV_EVENT_CONNECTED, 0);
+ bufferevent_async_set_connected_(bufev);
+ bufferevent_run_eventcb_(bufev,
+ BEV_EVENT_CONNECTED, 0);
goto done;
}
#endif
- bufferevent_run_eventcb_(bufev,
- BEV_EVENT_CONNECTED, 0);
+ bufferevent_run_eventcb_(bufev,
+ BEV_EVENT_CONNECTED, 0);
if (!(bufev->enabled & EV_WRITE) ||
bufev_p->write_suspended) {
event_del(&bufev->ev_write);
@@ -285,7 +285,7 @@ bufferevent_writecb(evutil_socket_t fd, short event, void *arg)
}
}
- atmost = bufferevent_get_write_max_(bufev_p);
+ atmost = bufferevent_get_write_max_(bufev_p);
if (bufev_p->write_suspended)
goto done;
@@ -309,7 +309,7 @@ bufferevent_writecb(evutil_socket_t fd, short event, void *arg)
if (res <= 0)
goto error;
- bufferevent_decrement_write_buckets_(bufev_p, res);
+ bufferevent_decrement_write_buckets_(bufev_p, res);
}
if (evbuffer_get_length(bufev->output) == 0) {
@@ -320,8 +320,8 @@ bufferevent_writecb(evutil_socket_t fd, short event, void *arg)
* Invoke the user callback if our buffer is drained or below the
* low watermark.
*/
- if (res || !connected) {
- bufferevent_trigger_nolock_(bufev, EV_WRITE, 0);
+ if (res || !connected) {
+ bufferevent_trigger_nolock_(bufev, EV_WRITE, 0);
}
goto done;
@@ -334,10 +334,10 @@ bufferevent_writecb(evutil_socket_t fd, short event, void *arg)
error:
bufferevent_disable(bufev, EV_WRITE);
- bufferevent_run_eventcb_(bufev, what, 0);
+ bufferevent_run_eventcb_(bufev, what, 0);
done:
- bufferevent_decref_and_unlock_(bufev);
+ bufferevent_decref_and_unlock_(bufev);
}
struct bufferevent *
@@ -347,15 +347,15 @@ bufferevent_socket_new(struct event_base *base, evutil_socket_t fd,
struct bufferevent_private *bufev_p;
struct bufferevent *bufev;
-#ifdef _WIN32
- if (base && event_base_get_iocp_(base))
- return bufferevent_async_new_(base, fd, options);
+#ifdef _WIN32
+ if (base && event_base_get_iocp_(base))
+ return bufferevent_async_new_(base, fd, options);
#endif
if ((bufev_p = mm_calloc(1, sizeof(struct bufferevent_private)))== NULL)
return NULL;
- if (bufferevent_init_common_(bufev_p, base, &bufferevent_ops_socket,
+ if (bufferevent_init_common_(bufev_p, base, &bufferevent_ops_socket,
options) < 0) {
mm_free(bufev_p);
return NULL;
@@ -364,9 +364,9 @@ bufferevent_socket_new(struct event_base *base, evutil_socket_t fd,
evbuffer_set_flags(bufev->output, EVBUFFER_FLAG_DRAINS_TO_FD);
event_assign(&bufev->ev_read, bufev->ev_base, fd,
- EV_READ|EV_PERSIST|EV_FINALIZE, bufferevent_readcb, bufev);
+ EV_READ|EV_PERSIST|EV_FINALIZE, bufferevent_readcb, bufev);
event_assign(&bufev->ev_write, bufev->ev_base, fd,
- EV_WRITE|EV_PERSIST|EV_FINALIZE, bufferevent_writecb, bufev);
+ EV_WRITE|EV_PERSIST|EV_FINALIZE, bufferevent_writecb, bufev);
evbuffer_add_cb(bufev->output, bufferevent_socket_outbuf_cb, bufev);
@@ -378,32 +378,32 @@ bufferevent_socket_new(struct event_base *base, evutil_socket_t fd,
int
bufferevent_socket_connect(struct bufferevent *bev,
- const struct sockaddr *sa, int socklen)
+ const struct sockaddr *sa, int socklen)
{
- struct bufferevent_private *bufev_p = BEV_UPCAST(bev);
+ struct bufferevent_private *bufev_p = BEV_UPCAST(bev);
evutil_socket_t fd;
int r = 0;
int result=-1;
int ownfd = 0;
- bufferevent_incref_and_lock_(bev);
+ bufferevent_incref_and_lock_(bev);
fd = bufferevent_getfd(bev);
if (fd < 0) {
if (!sa)
goto done;
- fd = evutil_socket_(sa->sa_family,
- SOCK_STREAM|EVUTIL_SOCK_NONBLOCK, 0);
+ fd = evutil_socket_(sa->sa_family,
+ SOCK_STREAM|EVUTIL_SOCK_NONBLOCK, 0);
if (fd < 0)
- goto freesock;
+ goto freesock;
ownfd = 1;
}
if (sa) {
-#ifdef _WIN32
- if (bufferevent_async_can_connect_(bev)) {
+#ifdef _WIN32
+ if (bufferevent_async_can_connect_(bev)) {
bufferevent_setfd(bev, fd);
- r = bufferevent_async_connect_(bev, fd, sa, socklen);
+ r = bufferevent_async_connect_(bev, fd, sa, socklen);
if (r < 0)
goto freesock;
bufev_p->connecting = 1;
@@ -411,17 +411,17 @@ bufferevent_socket_connect(struct bufferevent *bev,
goto done;
} else
#endif
- r = evutil_socket_connect_(&fd, sa, socklen);
+ r = evutil_socket_connect_(&fd, sa, socklen);
if (r < 0)
goto freesock;
}
-#ifdef _WIN32
+#ifdef _WIN32
/* ConnectEx() isn't always around, even when IOCP is enabled.
* Here, we borrow the socket object's write handler to fall back
* on a non-blocking connect() when ConnectEx() is unavailable. */
if (BEV_IS_ASYNC(bev)) {
event_assign(&bev->ev_write, bev->ev_base, fd,
- EV_WRITE|EV_PERSIST|EV_FINALIZE, bufferevent_writecb, bev);
+ EV_WRITE|EV_PERSIST|EV_FINALIZE, bufferevent_writecb, bev);
}
#endif
bufferevent_setfd(bev, fd);
@@ -435,12 +435,12 @@ bufferevent_socket_connect(struct bufferevent *bev,
/* The connect succeeded already. How very BSD of it. */
result = 0;
bufev_p->connecting = 1;
- bufferevent_trigger_nolock_(bev, EV_WRITE, BEV_OPT_DEFER_CALLBACKS);
+ bufferevent_trigger_nolock_(bev, EV_WRITE, BEV_OPT_DEFER_CALLBACKS);
} else {
/* The connect failed already. How very BSD of it. */
result = 0;
- bufferevent_run_eventcb_(bev, BEV_EVENT_ERROR, BEV_OPT_DEFER_CALLBACKS);
- bufferevent_disable(bev, EV_WRITE|EV_READ);
+ bufferevent_run_eventcb_(bev, BEV_EVENT_ERROR, BEV_OPT_DEFER_CALLBACKS);
+ bufferevent_disable(bev, EV_WRITE|EV_READ);
}
goto done;
@@ -449,7 +449,7 @@ freesock:
if (ownfd)
evutil_closesocket(fd);
done:
- bufferevent_decref_and_unlock_(bev);
+ bufferevent_decref_and_unlock_(bev);
return result;
}
@@ -458,24 +458,24 @@ bufferevent_connect_getaddrinfo_cb(int result, struct evutil_addrinfo *ai,
void *arg)
{
struct bufferevent *bev = arg;
- struct bufferevent_private *bev_p = BEV_UPCAST(bev);
+ struct bufferevent_private *bev_p = BEV_UPCAST(bev);
int r;
BEV_LOCK(bev);
- bufferevent_unsuspend_write_(bev, BEV_SUSPEND_LOOKUP);
- bufferevent_unsuspend_read_(bev, BEV_SUSPEND_LOOKUP);
-
- bev_p->dns_request = NULL;
+ bufferevent_unsuspend_write_(bev, BEV_SUSPEND_LOOKUP);
+ bufferevent_unsuspend_read_(bev, BEV_SUSPEND_LOOKUP);
- if (result == EVUTIL_EAI_CANCEL) {
- bev_p->dns_error = result;
- bufferevent_decref_and_unlock_(bev);
- return;
- }
+ bev_p->dns_request = NULL;
+
+ if (result == EVUTIL_EAI_CANCEL) {
+ bev_p->dns_error = result;
+ bufferevent_decref_and_unlock_(bev);
+ return;
+ }
if (result != 0) {
bev_p->dns_error = result;
- bufferevent_run_eventcb_(bev, BEV_EVENT_ERROR, 0);
- bufferevent_decref_and_unlock_(bev);
+ bufferevent_run_eventcb_(bev, BEV_EVENT_ERROR, 0);
+ bufferevent_decref_and_unlock_(bev);
if (ai)
evutil_freeaddrinfo(ai);
return;
@@ -486,11 +486,11 @@ bufferevent_connect_getaddrinfo_cb(int result, struct evutil_addrinfo *ai,
while (found_ai->ai_addr->sa_family != AF_INET6 && found_ai->ai_next != NULL) {
found_ai = found_ai->ai_next;
}
- bufferevent_socket_set_conn_address_(bev, found_ai->ai_addr, (int)found_ai->ai_addrlen);
+ bufferevent_socket_set_conn_address_(bev, found_ai->ai_addr, (int)found_ai->ai_addrlen);
r = bufferevent_socket_connect(bev, found_ai->ai_addr, (int)found_ai->ai_addrlen);
- if (r < 0)
- bufferevent_run_eventcb_(bev, BEV_EVENT_ERROR, 0);
- bufferevent_decref_and_unlock_(bev);
+ if (r < 0)
+ bufferevent_run_eventcb_(bev, BEV_EVENT_ERROR, 0);
+ bufferevent_decref_and_unlock_(bev);
evutil_freeaddrinfo(ai);
}
@@ -500,7 +500,7 @@ bufferevent_socket_connect_hostname(struct bufferevent *bev,
{
char portbuf[10];
struct evutil_addrinfo hint;
- struct bufferevent_private *bev_p = BEV_UPCAST(bev);
+ struct bufferevent_private *bev_p = BEV_UPCAST(bev);
if (family != AF_INET && family != AF_INET6 && family != AF_UNSPEC)
return -1;
@@ -512,27 +512,27 @@ bufferevent_socket_connect_hostname(struct bufferevent *bev,
hint.ai_protocol = IPPROTO_TCP;
hint.ai_socktype = SOCK_STREAM;
- evutil_snprintf(portbuf, sizeof(portbuf), "%d", port);
-
- BEV_LOCK(bev);
- bev_p->dns_error = 0;
-
- bufferevent_suspend_write_(bev, BEV_SUSPEND_LOOKUP);
- bufferevent_suspend_read_(bev, BEV_SUSPEND_LOOKUP);
+ evutil_snprintf(portbuf, sizeof(portbuf), "%d", port);
- bufferevent_incref_(bev);
- bev_p->dns_request = evutil_getaddrinfo_async_(evdns_base, hostname,
- portbuf, &hint, bufferevent_connect_getaddrinfo_cb, bev);
- BEV_UNLOCK(bev);
+ BEV_LOCK(bev);
+ bev_p->dns_error = 0;
- return 0;
+ bufferevent_suspend_write_(bev, BEV_SUSPEND_LOOKUP);
+ bufferevent_suspend_read_(bev, BEV_SUSPEND_LOOKUP);
+
+ bufferevent_incref_(bev);
+ bev_p->dns_request = evutil_getaddrinfo_async_(evdns_base, hostname,
+ portbuf, &hint, bufferevent_connect_getaddrinfo_cb, bev);
+ BEV_UNLOCK(bev);
+
+ return 0;
}
int
bufferevent_socket_get_dns_error(struct bufferevent *bev)
{
int rv;
- struct bufferevent_private *bev_p = BEV_UPCAST(bev);
+ struct bufferevent_private *bev_p = BEV_UPCAST(bev);
BEV_LOCK(bev);
rv = bev_p->dns_error;
@@ -571,11 +571,11 @@ bufferevent_new(evutil_socket_t fd,
static int
be_socket_enable(struct bufferevent *bufev, short event)
{
- if (event & EV_READ &&
- bufferevent_add_event_(&bufev->ev_read, &bufev->timeout_read) == -1)
+ if (event & EV_READ &&
+ bufferevent_add_event_(&bufev->ev_read, &bufev->timeout_read) == -1)
return -1;
- if (event & EV_WRITE &&
- bufferevent_add_event_(&bufev->ev_write, &bufev->timeout_write) == -1)
+ if (event & EV_WRITE &&
+ bufferevent_add_event_(&bufev->ev_write, &bufev->timeout_write) == -1)
return -1;
return 0;
}
@@ -583,7 +583,7 @@ be_socket_enable(struct bufferevent *bufev, short event)
static int
be_socket_disable(struct bufferevent *bufev, short event)
{
- struct bufferevent_private *bufev_p = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_p = BEV_UPCAST(bufev);
if (event & EV_READ) {
if (event_del(&bufev->ev_read) == -1)
return -1;
@@ -599,16 +599,16 @@ be_socket_disable(struct bufferevent *bufev, short event)
static void
be_socket_destruct(struct bufferevent *bufev)
{
- struct bufferevent_private *bufev_p = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_p = BEV_UPCAST(bufev);
evutil_socket_t fd;
- EVUTIL_ASSERT(BEV_IS_SOCKET(bufev));
+ EVUTIL_ASSERT(BEV_IS_SOCKET(bufev));
fd = event_get_fd(&bufev->ev_read);
if ((bufev_p->options & BEV_OPT_CLOSE_ON_FREE) && fd >= 0)
EVUTIL_CLOSESOCKET(fd);
- evutil_getaddrinfo_cancel_async_(bufev_p->dns_request);
+ evutil_getaddrinfo_cancel_async_(bufev_p->dns_request);
}
static int
@@ -622,27 +622,27 @@ be_socket_flush(struct bufferevent *bev, short iotype,
static void
be_socket_setfd(struct bufferevent *bufev, evutil_socket_t fd)
{
- struct bufferevent_private *bufev_p = BEV_UPCAST(bufev);
-
+ struct bufferevent_private *bufev_p = BEV_UPCAST(bufev);
+
BEV_LOCK(bufev);
- EVUTIL_ASSERT(BEV_IS_SOCKET(bufev));
+ EVUTIL_ASSERT(BEV_IS_SOCKET(bufev));
event_del(&bufev->ev_read);
event_del(&bufev->ev_write);
- evbuffer_unfreeze(bufev->input, 0);
- evbuffer_unfreeze(bufev->output, 1);
-
+ evbuffer_unfreeze(bufev->input, 0);
+ evbuffer_unfreeze(bufev->output, 1);
+
event_assign(&bufev->ev_read, bufev->ev_base, fd,
- EV_READ|EV_PERSIST|EV_FINALIZE, bufferevent_readcb, bufev);
+ EV_READ|EV_PERSIST|EV_FINALIZE, bufferevent_readcb, bufev);
event_assign(&bufev->ev_write, bufev->ev_base, fd,
- EV_WRITE|EV_PERSIST|EV_FINALIZE, bufferevent_writecb, bufev);
+ EV_WRITE|EV_PERSIST|EV_FINALIZE, bufferevent_writecb, bufev);
if (fd >= 0)
bufferevent_enable(bufev, bufev->enabled);
- evutil_getaddrinfo_cancel_async_(bufev_p->dns_request);
-
+ evutil_getaddrinfo_cancel_async_(bufev_p->dns_request);
+
BEV_UNLOCK(bufev);
}
@@ -651,7 +651,7 @@ int
bufferevent_priority_set(struct bufferevent *bufev, int priority)
{
int r = -1;
- struct bufferevent_private *bufev_p = BEV_UPCAST(bufev);
+ struct bufferevent_private *bufev_p = BEV_UPCAST(bufev);
BEV_LOCK(bufev);
if (BEV_IS_ASYNC(bufev) || BEV_IS_FILTER(bufev) || BEV_IS_PAIR(bufev))
@@ -662,8 +662,8 @@ bufferevent_priority_set(struct bufferevent *bufev, int priority)
if (event_priority_set(&bufev->ev_write, priority) == -1)
goto done;
- event_deferred_cb_set_priority_(&bufev_p->deferred, priority);
-
+ event_deferred_cb_set_priority_(&bufev_p->deferred, priority);
+
r = 0;
done:
BEV_UNLOCK(bufev);
@@ -677,7 +677,7 @@ bufferevent_base_set(struct event_base *base, struct bufferevent *bufev)
int res = -1;
BEV_LOCK(bufev);
- if (!BEV_IS_SOCKET(bufev))
+ if (!BEV_IS_SOCKET(bufev))
goto done;
bufev->ev_base = base;
diff --git a/contrib/libs/libevent/changelist-internal.h b/contrib/libs/libevent/changelist-internal.h
index 98fc52aebf..6e9dc36673 100644
--- a/contrib/libs/libevent/changelist-internal.h
+++ b/contrib/libs/libevent/changelist-internal.h
@@ -23,8 +23,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef CHANGELIST_INTERNAL_H_INCLUDED_
-#define CHANGELIST_INTERNAL_H_INCLUDED_
+#ifndef CHANGELIST_INTERNAL_H_INCLUDED_
+#define CHANGELIST_INTERNAL_H_INCLUDED_
/*
A "changelist" is a list of all the fd status changes that should be made
@@ -62,7 +62,7 @@ struct event_change {
* and write_change is unused. */
ev_uint8_t read_change;
ev_uint8_t write_change;
- ev_uint8_t close_change;
+ ev_uint8_t close_change;
};
/* Flags for read_change and write_change. */
@@ -83,20 +83,20 @@ struct event_change {
#define EVENT_CHANGELIST_FDINFO_SIZE sizeof(int)
/** Set up the data fields in a changelist. */
-void event_changelist_init_(struct event_changelist *changelist);
+void event_changelist_init_(struct event_changelist *changelist);
/** Remove every change in the changelist, and make corresponding changes
* in the event maps in the base. This function is generally used right
* after making all the changes in the changelist. */
-void event_changelist_remove_all_(struct event_changelist *changelist,
+void event_changelist_remove_all_(struct event_changelist *changelist,
struct event_base *base);
/** Free all memory held in a changelist. */
-void event_changelist_freemem_(struct event_changelist *changelist);
+void event_changelist_freemem_(struct event_changelist *changelist);
/** Implementation of eventop_add that queues the event in a changelist. */
-int event_changelist_add_(struct event_base *base, evutil_socket_t fd, short old, short events,
+int event_changelist_add_(struct event_base *base, evutil_socket_t fd, short old, short events,
void *p);
/** Implementation of eventop_del that queues the event in a changelist. */
-int event_changelist_del_(struct event_base *base, evutil_socket_t fd, short old, short events,
+int event_changelist_del_(struct event_base *base, evutil_socket_t fd, short old, short events,
void *p);
#endif
diff --git a/contrib/libs/libevent/config.h b/contrib/libs/libevent/config.h
index 8b87592052..e0f7daa6f9 100644
--- a/contrib/libs/libevent/config.h
+++ b/contrib/libs/libevent/config.h
@@ -1,555 +1,555 @@
-/* config.h. Generated from config.h.in by configure. */
-/* config.h.in. Generated from configure.ac by autoheader. */
-
-/* Define if libevent should build without support for a debug mode */
-/* #undef DISABLE_DEBUG_MODE */
-
-/* Define if libevent should not allow replacing the mm functions */
-/* #undef DISABLE_MM_REPLACEMENT */
-
-/* Define if libevent should not be compiled with thread support */
-/* #undef DISABLE_THREAD_SUPPORT */
-
-/* Define to 1 if you have the `accept4' function. */
-#define HAVE_ACCEPT4 1
-
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define if libevent should build without support for a debug mode */
+/* #undef DISABLE_DEBUG_MODE */
+
+/* Define if libevent should not allow replacing the mm functions */
+/* #undef DISABLE_MM_REPLACEMENT */
+
+/* Define if libevent should not be compiled with thread support */
+/* #undef DISABLE_THREAD_SUPPORT */
+
+/* Define to 1 if you have the `accept4' function. */
+#define HAVE_ACCEPT4 1
+
/* Define to 1 if you have the <afunix.h> header file. */
/* #undef HAVE_AFUNIX_H */
-/* Define to 1 if you have the `arc4random' function. */
-/* #undef HAVE_ARC4RANDOM */
-
-/* Define to 1 if you have the `arc4random_addrandom' function. */
-/* #undef HAVE_ARC4RANDOM_ADDRANDOM */
-
-/* Define to 1 if you have the `arc4random_buf' function. */
-/* #undef HAVE_ARC4RANDOM_BUF */
-
-/* Define to 1 if you have the <arpa/inet.h> header file. */
-#define HAVE_ARPA_INET_H 1
-
-/* Define to 1 if you have the `clock_gettime' function. */
-#define HAVE_CLOCK_GETTIME 1
-
-/* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you
- don't. */
+/* Define to 1 if you have the `arc4random' function. */
+/* #undef HAVE_ARC4RANDOM */
+
+/* Define to 1 if you have the `arc4random_addrandom' function. */
+/* #undef HAVE_ARC4RANDOM_ADDRANDOM */
+
+/* Define to 1 if you have the `arc4random_buf' function. */
+/* #undef HAVE_ARC4RANDOM_BUF */
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#define HAVE_CLOCK_GETTIME 1
+
+/* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you
+ don't. */
/* #undef HAVE_DECL_CTL_KERN */
-
-/* Define to 1 if you have the declaration of `KERN_ARND', and to 0 if you
- don't. */
+
+/* Define to 1 if you have the declaration of `KERN_ARND', and to 0 if you
+ don't. */
/* #undef HAVE_DECL_KERN_ARND */
-
-/* Define if /dev/poll is available */
-/* #undef HAVE_DEVPOLL */
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define if your system supports the epoll system calls */
-#define HAVE_EPOLL 1
-
-/* Define to 1 if you have the `epoll_create1' function. */
-#define HAVE_EPOLL_CREATE1 1
-
-/* Define to 1 if you have the `epoll_ctl' function. */
-#define HAVE_EPOLL_CTL 1
-
-/* Define to 1 if you have the <errno.h> header file. */
-#define HAVE_ERRNO_H 1
-
-/* Define to 1 if you have the `eventfd' function. */
-#define HAVE_EVENTFD 1
-
-/* Define if your system supports event ports */
-/* #undef HAVE_EVENT_PORTS */
-
-/* Define to 1 if you have the `fcntl' function. */
-#define HAVE_FCNTL 1
-
-/* Define to 1 if you have the <fcntl.h> header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define to 1 if the system has the type `fd_mask'. */
-#define HAVE_FD_MASK 1
-
-/* Do we have getaddrinfo()? */
-#define HAVE_GETADDRINFO 1
-
-/* Define to 1 if you have the `getegid' function. */
-#define HAVE_GETEGID 1
-
-/* Define to 1 if you have the `geteuid' function. */
-#define HAVE_GETEUID 1
-
-/* Define this if you have any gethostbyname_r() */
-/* #undef HAVE_GETHOSTBYNAME_R */
-
-/* Define this if gethostbyname_r takes 3 arguments */
-/* #undef HAVE_GETHOSTBYNAME_R_3_ARG */
-
-/* Define this if gethostbyname_r takes 5 arguments */
-/* #undef HAVE_GETHOSTBYNAME_R_5_ARG */
-
-/* Define this if gethostbyname_r takes 6 arguments */
-/* #undef HAVE_GETHOSTBYNAME_R_6_ARG */
-
-/* Define to 1 if you have the `getifaddrs' function. */
-#define HAVE_GETIFADDRS 1
-
-/* Define to 1 if you have the `getnameinfo' function. */
-#define HAVE_GETNAMEINFO 1
-
-/* Define to 1 if you have the `getprotobynumber' function. */
-#define HAVE_GETPROTOBYNUMBER 1
-
+
+/* Define if /dev/poll is available */
+/* #undef HAVE_DEVPOLL */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define if your system supports the epoll system calls */
+#define HAVE_EPOLL 1
+
+/* Define to 1 if you have the `epoll_create1' function. */
+#define HAVE_EPOLL_CREATE1 1
+
+/* Define to 1 if you have the `epoll_ctl' function. */
+#define HAVE_EPOLL_CTL 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the `eventfd' function. */
+#define HAVE_EVENTFD 1
+
+/* Define if your system supports event ports */
+/* #undef HAVE_EVENT_PORTS */
+
+/* Define to 1 if you have the `fcntl' function. */
+#define HAVE_FCNTL 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if the system has the type `fd_mask'. */
+#define HAVE_FD_MASK 1
+
+/* Do we have getaddrinfo()? */
+#define HAVE_GETADDRINFO 1
+
+/* Define to 1 if you have the `getegid' function. */
+#define HAVE_GETEGID 1
+
+/* Define to 1 if you have the `geteuid' function. */
+#define HAVE_GETEUID 1
+
+/* Define this if you have any gethostbyname_r() */
+/* #undef HAVE_GETHOSTBYNAME_R */
+
+/* Define this if gethostbyname_r takes 3 arguments */
+/* #undef HAVE_GETHOSTBYNAME_R_3_ARG */
+
+/* Define this if gethostbyname_r takes 5 arguments */
+/* #undef HAVE_GETHOSTBYNAME_R_5_ARG */
+
+/* Define this if gethostbyname_r takes 6 arguments */
+/* #undef HAVE_GETHOSTBYNAME_R_6_ARG */
+
+/* Define to 1 if you have the `getifaddrs' function. */
+#define HAVE_GETIFADDRS 1
+
+/* Define to 1 if you have the `getnameinfo' function. */
+#define HAVE_GETNAMEINFO 1
+
+/* Define to 1 if you have the `getprotobynumber' function. */
+#define HAVE_GETPROTOBYNUMBER 1
+
/* Define to 1 if you have the `getrandom' function. */
#define HAVE_GETRANDOM 1
-/* Define to 1 if you have the `getservbyname' function. */
-#define HAVE_GETSERVBYNAME 1
-
-/* Define to 1 if you have the `gettimeofday' function. */
-#define HAVE_GETTIMEOFDAY 1
-
-/* Define to 1 if you have the <ifaddrs.h> header file. */
-#define HAVE_IFADDRS_H 1
-
-/* Define to 1 if you have the `inet_ntop' function. */
-#define HAVE_INET_NTOP 1
-
-/* Define to 1 if you have the `inet_pton' function. */
-#define HAVE_INET_PTON 1
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the `issetugid' function. */
-/* #undef HAVE_ISSETUGID */
-
-/* Define to 1 if you have the `kqueue' function. */
-/* #undef HAVE_KQUEUE */
-
+/* Define to 1 if you have the `getservbyname' function. */
+#define HAVE_GETSERVBYNAME 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the <ifaddrs.h> header file. */
+#define HAVE_IFADDRS_H 1
+
+/* Define to 1 if you have the `inet_ntop' function. */
+#define HAVE_INET_NTOP 1
+
+/* Define to 1 if you have the `inet_pton' function. */
+#define HAVE_INET_PTON 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `issetugid' function. */
+/* #undef HAVE_ISSETUGID */
+
+/* Define to 1 if you have the `kqueue' function. */
+/* #undef HAVE_KQUEUE */
+
/* Define to 1 if you have the `ws2_32' library (-lws2_32). */
/* #undef HAVE_LIBWS2_32 */
-/* Define if the system has zlib */
-#define HAVE_LIBZ 1
-
-/* Define to 1 if you have the `mach_absolute_time' function. */
-/* #undef HAVE_MACH_ABSOLUTE_TIME */
-
+/* Define if the system has zlib */
+#define HAVE_LIBZ 1
+
+/* Define to 1 if you have the `mach_absolute_time' function. */
+/* #undef HAVE_MACH_ABSOLUTE_TIME */
+
/* Define to 1 if you have the <mach/mach.h> header file. */
/* #undef HAVE_MACH_MACH_H */
-/* Define to 1 if you have the <mach/mach_time.h> header file. */
-/* #undef HAVE_MACH_MACH_TIME_H */
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the `mmap' function. */
-#define HAVE_MMAP 1
-
-/* Define to 1 if you have the `nanosleep' function. */
-#define HAVE_NANOSLEEP 1
-
-/* Define to 1 if you have the <netdb.h> header file. */
-#define HAVE_NETDB_H 1
-
-/* Define to 1 if you have the <netinet/in6.h> header file. */
-/* #undef HAVE_NETINET_IN6_H */
-
-/* Define to 1 if you have the <netinet/in.h> header file. */
-#define HAVE_NETINET_IN_H 1
-
-/* Define to 1 if you have the <netinet/tcp.h> header file. */
-#define HAVE_NETINET_TCP_H 1
-
-/* Define if the system has openssl */
-#define HAVE_OPENSSL 1
-
-/* Define to 1 if you have the <openssl/ssl.h> header file. */
-#define HAVE_OPENSSL_SSL_H 1
-
-/* Define to 1 if you have the `pipe' function. */
-#define HAVE_PIPE 1
-
-/* Define to 1 if you have the `pipe2' function. */
-#define HAVE_PIPE2 1
-
-/* Define to 1 if you have the `poll' function. */
-#define HAVE_POLL 1
-
-/* Define to 1 if you have the <poll.h> header file. */
-#define HAVE_POLL_H 1
-
-/* Define to 1 if you have the `port_create' function. */
-/* #undef HAVE_PORT_CREATE */
-
-/* Define to 1 if you have the <port.h> header file. */
-/* #undef HAVE_PORT_H */
-
-/* Define if you have POSIX threads libraries and header files. */
-/* #undef HAVE_PTHREAD */
-
-/* Define if we have pthreads on this system */
-#define HAVE_PTHREADS 1
-
-/* Define to 1 if you have the `putenv' function. */
-#define HAVE_PUTENV 1
-
-/* Define to 1 if the system has the type `sa_family_t'. */
-#define HAVE_SA_FAMILY_T 1
-
-/* Define to 1 if you have the `select' function. */
-#define HAVE_SELECT 1
-
-/* Define to 1 if you have the `sendfile' function. */
-#define HAVE_SENDFILE 1
-
-/* Define to 1 if you have the `setenv' function. */
-#define HAVE_SETENV 1
-
-/* Define if F_SETFD is defined in <fcntl.h> */
-#define HAVE_SETFD 1
-
-/* Define to 1 if you have the `setrlimit' function. */
-#define HAVE_SETRLIMIT 1
-
-/* Define to 1 if you have the `sigaction' function. */
-#define HAVE_SIGACTION 1
-
-/* Define to 1 if you have the `signal' function. */
-#define HAVE_SIGNAL 1
-
-/* Define to 1 if you have the `splice' function. */
-#define HAVE_SPLICE 1
-
-/* Define to 1 if you have the <stdarg.h> header file. */
-#define HAVE_STDARG_H 1
-
-/* Define to 1 if you have the <stddef.h> header file. */
-#define HAVE_STDDEF_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the `strlcpy' function. */
-/* #undef HAVE_STRLCPY */
-
-/* Define to 1 if you have the `strsep' function. */
-#define HAVE_STRSEP 1
-
-/* Define to 1 if you have the `strtok_r' function. */
-#define HAVE_STRTOK_R 1
-
-/* Define to 1 if you have the `strtoll' function. */
-#define HAVE_STRTOLL 1
-
-/* Define to 1 if the system has the type `struct addrinfo'. */
-#define HAVE_STRUCT_ADDRINFO 1
-
-/* Define to 1 if the system has the type `struct in6_addr'. */
-#define HAVE_STRUCT_IN6_ADDR 1
-
-/* Define to 1 if `s6_addr16' is a member of `struct in6_addr'. */
-#define HAVE_STRUCT_IN6_ADDR_S6_ADDR16 1
-
-/* Define to 1 if `s6_addr32' is a member of `struct in6_addr'. */
-#define HAVE_STRUCT_IN6_ADDR_S6_ADDR32 1
-
-/* Define to 1 if the system has the type `struct linger'. */
-#define HAVE_STRUCT_LINGER 1
-
-/* Define to 1 if the system has the type `struct sockaddr_in6'. */
-#define HAVE_STRUCT_SOCKADDR_IN6 1
-
-/* Define to 1 if `sin6_len' is a member of `struct sockaddr_in6'. */
-/* #undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN */
-
-/* Define to 1 if `sin_len' is a member of `struct sockaddr_in'. */
-/* #undef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
-
-/* Define to 1 if the system has the type `struct sockaddr_storage'. */
-#define HAVE_STRUCT_SOCKADDR_STORAGE 1
-
-/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */
-#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
-
-/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */
-/* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */
-
-/* Define to 1 if the system has the type `struct sockaddr_un'. */
-#define HAVE_STRUCT_SOCKADDR_UN 1
-
-/* Define to 1 if you have the `sysctl' function. */
+/* Define to 1 if you have the <mach/mach_time.h> header file. */
+/* #undef HAVE_MACH_MACH_TIME_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mmap' function. */
+#define HAVE_MMAP 1
+
+/* Define to 1 if you have the `nanosleep' function. */
+#define HAVE_NANOSLEEP 1
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#define HAVE_NETDB_H 1
+
+/* Define to 1 if you have the <netinet/in6.h> header file. */
+/* #undef HAVE_NETINET_IN6_H */
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+#define HAVE_NETINET_TCP_H 1
+
+/* Define if the system has openssl */
+#define HAVE_OPENSSL 1
+
+/* Define to 1 if you have the <openssl/ssl.h> header file. */
+#define HAVE_OPENSSL_SSL_H 1
+
+/* Define to 1 if you have the `pipe' function. */
+#define HAVE_PIPE 1
+
+/* Define to 1 if you have the `pipe2' function. */
+#define HAVE_PIPE2 1
+
+/* Define to 1 if you have the `poll' function. */
+#define HAVE_POLL 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* Define to 1 if you have the `port_create' function. */
+/* #undef HAVE_PORT_CREATE */
+
+/* Define to 1 if you have the <port.h> header file. */
+/* #undef HAVE_PORT_H */
+
+/* Define if you have POSIX threads libraries and header files. */
+/* #undef HAVE_PTHREAD */
+
+/* Define if we have pthreads on this system */
+#define HAVE_PTHREADS 1
+
+/* Define to 1 if you have the `putenv' function. */
+#define HAVE_PUTENV 1
+
+/* Define to 1 if the system has the type `sa_family_t'. */
+#define HAVE_SA_FAMILY_T 1
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define to 1 if you have the `sendfile' function. */
+#define HAVE_SENDFILE 1
+
+/* Define to 1 if you have the `setenv' function. */
+#define HAVE_SETENV 1
+
+/* Define if F_SETFD is defined in <fcntl.h> */
+#define HAVE_SETFD 1
+
+/* Define to 1 if you have the `setrlimit' function. */
+#define HAVE_SETRLIMIT 1
+
+/* Define to 1 if you have the `sigaction' function. */
+#define HAVE_SIGACTION 1
+
+/* Define to 1 if you have the `signal' function. */
+#define HAVE_SIGNAL 1
+
+/* Define to 1 if you have the `splice' function. */
+#define HAVE_SPLICE 1
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+/* #undef HAVE_STRLCPY */
+
+/* Define to 1 if you have the `strsep' function. */
+#define HAVE_STRSEP 1
+
+/* Define to 1 if you have the `strtok_r' function. */
+#define HAVE_STRTOK_R 1
+
+/* Define to 1 if you have the `strtoll' function. */
+#define HAVE_STRTOLL 1
+
+/* Define to 1 if the system has the type `struct addrinfo'. */
+#define HAVE_STRUCT_ADDRINFO 1
+
+/* Define to 1 if the system has the type `struct in6_addr'. */
+#define HAVE_STRUCT_IN6_ADDR 1
+
+/* Define to 1 if `s6_addr16' is a member of `struct in6_addr'. */
+#define HAVE_STRUCT_IN6_ADDR_S6_ADDR16 1
+
+/* Define to 1 if `s6_addr32' is a member of `struct in6_addr'. */
+#define HAVE_STRUCT_IN6_ADDR_S6_ADDR32 1
+
+/* Define to 1 if the system has the type `struct linger'. */
+#define HAVE_STRUCT_LINGER 1
+
+/* Define to 1 if the system has the type `struct sockaddr_in6'. */
+#define HAVE_STRUCT_SOCKADDR_IN6 1
+
+/* Define to 1 if `sin6_len' is a member of `struct sockaddr_in6'. */
+/* #undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN */
+
+/* Define to 1 if `sin_len' is a member of `struct sockaddr_in'. */
+/* #undef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
+
+/* Define to 1 if the system has the type `struct sockaddr_storage'. */
+#define HAVE_STRUCT_SOCKADDR_STORAGE 1
+
+/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */
+#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
+
+/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */
+/* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */
+
+/* Define to 1 if the system has the type `struct sockaddr_un'. */
+#define HAVE_STRUCT_SOCKADDR_UN 1
+
+/* Define to 1 if you have the `sysctl' function. */
/* #undef HAVE_SYSCTL */
-
-/* Define to 1 if you have the <sys/devpoll.h> header file. */
-/* #undef HAVE_SYS_DEVPOLL_H */
-
-/* Define to 1 if you have the <sys/epoll.h> header file. */
-#define HAVE_SYS_EPOLL_H 1
-
-/* Define to 1 if you have the <sys/eventfd.h> header file. */
-#define HAVE_SYS_EVENTFD_H 1
-
-/* Define to 1 if you have the <sys/event.h> header file. */
-/* #undef HAVE_SYS_EVENT_H */
-
-/* Define to 1 if you have the <sys/ioctl.h> header file. */
-#define HAVE_SYS_IOCTL_H 1
-
-/* Define to 1 if you have the <sys/mman.h> header file. */
-#define HAVE_SYS_MMAN_H 1
-
-/* Define to 1 if you have the <sys/param.h> header file. */
-#define HAVE_SYS_PARAM_H 1
-
-/* Define to 1 if you have the <sys/queue.h> header file. */
-#define HAVE_SYS_QUEUE_H 1
-
+
+/* Define to 1 if you have the <sys/devpoll.h> header file. */
+/* #undef HAVE_SYS_DEVPOLL_H */
+
+/* Define to 1 if you have the <sys/epoll.h> header file. */
+#define HAVE_SYS_EPOLL_H 1
+
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+#define HAVE_SYS_EVENTFD_H 1
+
+/* Define to 1 if you have the <sys/event.h> header file. */
+/* #undef HAVE_SYS_EVENT_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#define HAVE_SYS_MMAN_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/queue.h> header file. */
+#define HAVE_SYS_QUEUE_H 1
+
/* Define to 1 if you have the <sys/random.h> header file. */
#define HAVE_SYS_RANDOM_H 1
-/* Define to 1 if you have the <sys/resource.h> header file. */
-#define HAVE_SYS_RESOURCE_H 1
-
-/* Define to 1 if you have the <sys/select.h> header file. */
-#define HAVE_SYS_SELECT_H 1
-
-/* Define to 1 if you have the <sys/sendfile.h> header file. */
-#define HAVE_SYS_SENDFILE_H 1
-
-/* Define to 1 if you have the <sys/socket.h> header file. */
-#define HAVE_SYS_SOCKET_H 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/sysctl.h> header file. */
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#define HAVE_SYS_RESOURCE_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/sendfile.h> header file. */
+#define HAVE_SYS_SENDFILE_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/sysctl.h> header file. */
/* #undef HAVE_SYS_SYSCTL_H */
-
-/* Define to 1 if you have the <sys/timerfd.h> header file. */
-#define HAVE_SYS_TIMERFD_H 1
-
-/* Define to 1 if you have the <sys/time.h> header file. */
-#define HAVE_SYS_TIME_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <sys/uio.h> header file. */
-#define HAVE_SYS_UIO_H 1
-
-/* Define to 1 if you have the <sys/un.h> header file. */
-#define HAVE_SYS_UN_H 1
-
-/* Define to 1 if you have the <sys/wait.h> header file. */
-#define HAVE_SYS_WAIT_H 1
-
-/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
-#define HAVE_TAILQFOREACH 1
-
-/* Define if timeradd is defined in <sys/time.h> */
-#define HAVE_TIMERADD 1
-
-/* Define if timerclear is defined in <sys/time.h> */
-#define HAVE_TIMERCLEAR 1
-
-/* Define if timercmp is defined in <sys/time.h> */
-#define HAVE_TIMERCMP 1
-
-/* Define to 1 if you have the `timerfd_create' function. */
-#define HAVE_TIMERFD_CREATE 1
-
-/* Define if timerisset is defined in <sys/time.h> */
-#define HAVE_TIMERISSET 1
-
-/* Define to 1 if the system has the type `uint16_t'. */
-#define HAVE_UINT16_T 1
-
-/* Define to 1 if the system has the type `uint32_t'. */
-#define HAVE_UINT32_T 1
-
-/* Define to 1 if the system has the type `uint64_t'. */
-#define HAVE_UINT64_T 1
-
-/* Define to 1 if the system has the type `uint8_t'. */
-#define HAVE_UINT8_T 1
-
-/* Define to 1 if the system has the type `uintptr_t'. */
-#define HAVE_UINTPTR_T 1
-
-/* Define to 1 if you have the `umask' function. */
-#define HAVE_UMASK 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define to 1 if you have the `unsetenv' function. */
-#define HAVE_UNSETENV 1
-
-/* Define to 1 if you have the `usleep' function. */
-#define HAVE_USLEEP 1
-
-/* Define to 1 if you have the `vasprintf' function. */
-#define HAVE_VASPRINTF 1
-
-/* Define if kqueue works correctly with pipes */
-/* #undef HAVE_WORKING_KQUEUE */
-
-/* Define to 1 if you have the <zlib.h> header file. */
-#define HAVE_ZLIB_H 1
-
+
+/* Define to 1 if you have the <sys/timerfd.h> header file. */
+#define HAVE_SYS_TIMERFD_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define HAVE_SYS_UIO_H 1
+
+/* Define to 1 if you have the <sys/un.h> header file. */
+#define HAVE_SYS_UN_H 1
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
+#define HAVE_TAILQFOREACH 1
+
+/* Define if timeradd is defined in <sys/time.h> */
+#define HAVE_TIMERADD 1
+
+/* Define if timerclear is defined in <sys/time.h> */
+#define HAVE_TIMERCLEAR 1
+
+/* Define if timercmp is defined in <sys/time.h> */
+#define HAVE_TIMERCMP 1
+
+/* Define to 1 if you have the `timerfd_create' function. */
+#define HAVE_TIMERFD_CREATE 1
+
+/* Define if timerisset is defined in <sys/time.h> */
+#define HAVE_TIMERISSET 1
+
+/* Define to 1 if the system has the type `uint16_t'. */
+#define HAVE_UINT16_T 1
+
+/* Define to 1 if the system has the type `uint32_t'. */
+#define HAVE_UINT32_T 1
+
+/* Define to 1 if the system has the type `uint64_t'. */
+#define HAVE_UINT64_T 1
+
+/* Define to 1 if the system has the type `uint8_t'. */
+#define HAVE_UINT8_T 1
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+#define HAVE_UINTPTR_T 1
+
+/* Define to 1 if you have the `umask' function. */
+#define HAVE_UMASK 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `unsetenv' function. */
+#define HAVE_UNSETENV 1
+
+/* Define to 1 if you have the `usleep' function. */
+#define HAVE_USLEEP 1
+
+/* Define to 1 if you have the `vasprintf' function. */
+#define HAVE_VASPRINTF 1
+
+/* Define if kqueue works correctly with pipes */
+/* #undef HAVE_WORKING_KQUEUE */
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#define HAVE_ZLIB_H 1
+
/* Define to 1 if you have the `_gmtime64' function. */
/* #undef HAVE__GMTIME64 */
/* Define to 1 if you have the `_gmtime64_s' function. */
/* #undef HAVE__GMTIME64_S */
-/* Define to 1 if compiler have __FUNCTION__ */
-#define HAVE___FUNCTION__ 1
-
-/* Define to 1 if compiler have __func__ */
-#define HAVE___func__ 1
-
-/* Define to the sub-directory where libtool stores uninstalled libraries. */
-#define LT_OBJDIR ".libs/"
-
-/* Numeric representation of the version */
+/* Define to 1 if compiler have __FUNCTION__ */
+#define HAVE___FUNCTION__ 1
+
+/* Define to 1 if compiler have __func__ */
+#define HAVE___func__ 1
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Numeric representation of the version */
#define NUMERIC_VERSION 0x02010c00
-
-/* Name of package */
-#define PACKAGE "libevent"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT ""
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "libevent"
-
-/* Define to the full name and version of this package. */
+
+/* Name of package */
+#define PACKAGE "libevent"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "libevent"
+
+/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libevent 2.1.12-stable"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "libevent"
-
-/* Define to the home page for this package. */
-#define PACKAGE_URL ""
-
-/* Define to the version of this package. */
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libevent"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
#define PACKAGE_VERSION "2.1.12-stable"
-
-/* Define to necessary symbol if this constant uses a non-standard name on
- your system. */
-/* #undef PTHREAD_CREATE_JOINABLE */
-
-/* The size of `int', as computed by sizeof. */
-#define SIZEOF_INT 4
-
-/* The size of `long', as computed by sizeof. */
-#define SIZEOF_LONG 8
-
-/* The size of `long long', as computed by sizeof. */
-#define SIZEOF_LONG_LONG 8
-
-/* The size of `off_t', as computed by sizeof. */
-#define SIZEOF_OFF_T 8
-
-/* The size of `pthread_t', as computed by sizeof. */
-#define SIZEOF_PTHREAD_T 8
-
-/* The size of `short', as computed by sizeof. */
-#define SIZEOF_SHORT 2
-
-/* The size of `size_t', as computed by sizeof. */
-#define SIZEOF_SIZE_T 8
-
-/* The size of `time_t', as computed by sizeof. */
-#define SIZEOF_TIME_T 8
-
-/* The size of `void *', as computed by sizeof. */
-#define SIZEOF_VOID_P 8
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#define TIME_WITH_SYS_TIME 1
-
-/* Enable extensions on AIX 3, Interix. */
-#ifndef _ALL_SOURCE
-# define _ALL_SOURCE 1
-#endif
-/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-#endif
-/* Enable threading extensions on Solaris. */
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# define _POSIX_PTHREAD_SEMANTICS 1
-#endif
-/* Enable extensions on HP NonStop. */
-#ifndef _TANDEM_SOURCE
-# define _TANDEM_SOURCE 1
-#endif
-/* Enable general extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# define __EXTENSIONS__ 1
-#endif
-
-
-/* Version number of package */
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+ your system. */
+/* #undef PTHREAD_CREATE_JOINABLE */
+
+/* The size of `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of `long', as computed by sizeof. */
+#define SIZEOF_LONG 8
+
+/* The size of `long long', as computed by sizeof. */
+#define SIZEOF_LONG_LONG 8
+
+/* The size of `off_t', as computed by sizeof. */
+#define SIZEOF_OFF_T 8
+
+/* The size of `pthread_t', as computed by sizeof. */
+#define SIZEOF_PTHREAD_T 8
+
+/* The size of `short', as computed by sizeof. */
+#define SIZEOF_SHORT 2
+
+/* The size of `size_t', as computed by sizeof. */
+#define SIZEOF_SIZE_T 8
+
+/* The size of `time_t', as computed by sizeof. */
+#define SIZEOF_TIME_T 8
+
+/* The size of `void *', as computed by sizeof. */
+#define SIZEOF_VOID_P 8
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+
+/* Version number of package */
#define VERSION "2.1.12-stable"
-
-/* Enable large inode numbers on Mac OS X 10.5. */
-#ifndef _DARWIN_USE_64_BIT_INODE
-# define _DARWIN_USE_64_BIT_INODE 1
-#endif
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-/* #undef _FILE_OFFSET_BITS */
-
-/* Define for large files, on AIX-style hosts. */
-/* #undef _LARGE_FILES */
-
-/* Define to 1 if on MINIX. */
-/* #undef _MINIX */
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
- this defined. */
-/* #undef _POSIX_1_SOURCE */
-
-/* Define to 1 if you need to in order for `stat' and other things to work. */
-/* #undef _POSIX_SOURCE */
-
-/* Define to empty if `const' does not conform to ANSI C. */
-/* #undef const */
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
- calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef __cplusplus
-/* #undef inline */
-#endif
-
-/* Define to `int' if <sys/types.h> does not define. */
-/* #undef pid_t */
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-/* #undef size_t */
-
-/* Define to unsigned int if you dont have it */
-/* #undef socklen_t */
-
-/* Define to `int' if <sys/types.h> does not define. */
-/* #undef ssize_t */
+
+/* Enable large inode numbers on Mac OS X 10.5. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to unsigned int if you dont have it */
+/* #undef socklen_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef ssize_t */
diff --git a/contrib/libs/libevent/defer-internal.h b/contrib/libs/libevent/defer-internal.h
index d6f80a1180..a59abd5121 100644
--- a/contrib/libs/libevent/defer-internal.h
+++ b/contrib/libs/libevent/defer-internal.h
@@ -23,51 +23,51 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef DEFER_INTERNAL_H_INCLUDED_
-#define DEFER_INTERNAL_H_INCLUDED_
+#ifndef DEFER_INTERNAL_H_INCLUDED_
+#define DEFER_INTERNAL_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
#endif
#include "event2/event-config.h"
-#include "evconfig-private.h"
-
+#include "evconfig-private.h"
+
#include <sys/queue.h>
-struct event_callback;
-typedef void (*deferred_cb_fn)(struct event_callback *, void *);
+struct event_callback;
+typedef void (*deferred_cb_fn)(struct event_callback *, void *);
/**
- Initialize an empty, non-pending event_callback.
+ Initialize an empty, non-pending event_callback.
- @param deferred The struct event_callback structure to initialize.
- @param priority The priority that the callback should run at.
- @param cb The function to run when the struct event_callback executes.
+ @param deferred The struct event_callback structure to initialize.
+ @param priority The priority that the callback should run at.
+ @param cb The function to run when the struct event_callback executes.
@param arg The function's second argument.
*/
-EVENT2_EXPORT_SYMBOL
-void event_deferred_cb_init_(struct event_callback *, ev_uint8_t, deferred_cb_fn, void *);
+EVENT2_EXPORT_SYMBOL
+void event_deferred_cb_init_(struct event_callback *, ev_uint8_t, deferred_cb_fn, void *);
/**
- Change the priority of a non-pending event_callback.
+ Change the priority of a non-pending event_callback.
*/
-void event_deferred_cb_set_priority_(struct event_callback *, ev_uint8_t);
+void event_deferred_cb_set_priority_(struct event_callback *, ev_uint8_t);
/**
- Cancel a struct event_callback if it is currently scheduled in an event_base.
+ Cancel a struct event_callback if it is currently scheduled in an event_base.
*/
-EVENT2_EXPORT_SYMBOL
-void event_deferred_cb_cancel_(struct event_base *, struct event_callback *);
-/**
- Activate a struct event_callback if it is not currently scheduled in an event_base.
+EVENT2_EXPORT_SYMBOL
+void event_deferred_cb_cancel_(struct event_base *, struct event_callback *);
+/**
+ Activate a struct event_callback if it is not currently scheduled in an event_base.
- Return true if it was not previously scheduled.
- */
-EVENT2_EXPORT_SYMBOL
-int event_deferred_cb_schedule_(struct event_base *, struct event_callback *);
+ Return true if it was not previously scheduled.
+ */
+EVENT2_EXPORT_SYMBOL
+int event_deferred_cb_schedule_(struct event_base *, struct event_callback *);
#ifdef __cplusplus
}
#endif
-#endif /* EVENT_INTERNAL_H_INCLUDED_ */
+#endif /* EVENT_INTERNAL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/devpoll.c b/contrib/libs/libevent/devpoll.c
index 3a2f86d6f1..7c2cfa8eb2 100644
--- a/contrib/libs/libevent/devpoll.c
+++ b/contrib/libs/libevent/devpoll.c
@@ -25,13 +25,13 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
-
-#ifdef EVENT__HAVE_DEVPOLL
+#include "evconfig-private.h"
+#ifdef EVENT__HAVE_DEVPOLL
+
#include <sys/types.h>
#include <sys/resource.h>
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <sys/queue.h>
@@ -132,7 +132,7 @@ devpoll_init(struct event_base *base)
nfiles = rl.rlim_cur;
/* Initialize the kernel queue */
- if ((dpfd = evutil_open_closeonexec_("/dev/poll", O_RDWR, 0)) == -1) {
+ if ((dpfd = evutil_open_closeonexec_("/dev/poll", O_RDWR, 0)) == -1) {
event_warn("open: /dev/poll");
mm_free(devpollop);
return (NULL);
@@ -159,7 +159,7 @@ devpoll_init(struct event_base *base)
return (NULL);
}
- evsig_init_(base);
+ evsig_init_(base);
return (devpollop);
}
@@ -217,7 +217,7 @@ devpoll_dispatch(struct event_base *base, struct timeval *tv)
continue;
/* XXX(niels): not sure if this works for devpoll */
- evmap_io_active_(base, events[i].fd, which);
+ evmap_io_active_(base, events[i].fd, which);
}
return (0);
@@ -296,7 +296,7 @@ devpoll_dealloc(struct event_base *base)
{
struct devpollop *devpollop = base->evbase;
- evsig_dealloc_(base);
+ evsig_dealloc_(base);
if (devpollop->events)
mm_free(devpollop->events);
if (devpollop->changes)
@@ -307,5 +307,5 @@ devpoll_dealloc(struct event_base *base)
memset(devpollop, 0, sizeof(struct devpollop));
mm_free(devpollop);
}
-
-#endif /* EVENT__HAVE_DEVPOLL */
+
+#endif /* EVENT__HAVE_DEVPOLL */
diff --git a/contrib/libs/libevent/epoll.c b/contrib/libs/libevent/epoll.c
index bdec2e4569..adffaa375a 100644
--- a/contrib/libs/libevent/epoll.c
+++ b/contrib/libs/libevent/epoll.c
@@ -25,14 +25,14 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
-
-#ifdef EVENT__HAVE_EPOLL
+#include "evconfig-private.h"
+#ifdef EVENT__HAVE_EPOLL
+
#include <stdint.h>
#include <sys/types.h>
#include <sys/resource.h>
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <sys/queue.h>
@@ -44,12 +44,12 @@
#include <string.h>
#include <unistd.h>
#include <errno.h>
-#ifdef EVENT__HAVE_FCNTL_H
+#ifdef EVENT__HAVE_FCNTL_H
#include <fcntl.h>
#endif
-#ifdef EVENT__HAVE_SYS_TIMERFD_H
-#include <sys/timerfd.h>
-#endif
+#ifdef EVENT__HAVE_SYS_TIMERFD_H
+#include <sys/timerfd.h>
+#endif
#include "event-internal.h"
#include "evsignal-internal.h"
@@ -58,38 +58,38 @@
#include "log-internal.h"
#include "evmap-internal.h"
#include "changelist-internal.h"
-#include "time-internal.h"
-
-/* Since Linux 2.6.17, epoll is able to report about peer half-closed connection
- using special EPOLLRDHUP flag on a read event.
-*/
-#if !defined(EPOLLRDHUP)
-#define EPOLLRDHUP 0
-#define EARLY_CLOSE_IF_HAVE_RDHUP 0
-#else
-#define EARLY_CLOSE_IF_HAVE_RDHUP EV_FEATURE_EARLY_CLOSE
-#endif
-
-#include "epolltable-internal.h"
-
-#if defined(EVENT__HAVE_SYS_TIMERFD_H) && \
- defined(EVENT__HAVE_TIMERFD_CREATE) && \
- defined(HAVE_POSIX_MONOTONIC) && defined(TFD_NONBLOCK) && \
- defined(TFD_CLOEXEC)
-/* Note that we only use timerfd if TFD_NONBLOCK and TFD_CLOEXEC are available
- and working. This means that we can't support it on 2.6.25 (where timerfd
- was introduced) or 2.6.26, since 2.6.27 introduced those flags.
- */
-#define USING_TIMERFD
-#endif
-
+#include "time-internal.h"
+
+/* Since Linux 2.6.17, epoll is able to report about peer half-closed connection
+ using special EPOLLRDHUP flag on a read event.
+*/
+#if !defined(EPOLLRDHUP)
+#define EPOLLRDHUP 0
+#define EARLY_CLOSE_IF_HAVE_RDHUP 0
+#else
+#define EARLY_CLOSE_IF_HAVE_RDHUP EV_FEATURE_EARLY_CLOSE
+#endif
+
+#include "epolltable-internal.h"
+
+#if defined(EVENT__HAVE_SYS_TIMERFD_H) && \
+ defined(EVENT__HAVE_TIMERFD_CREATE) && \
+ defined(HAVE_POSIX_MONOTONIC) && defined(TFD_NONBLOCK) && \
+ defined(TFD_CLOEXEC)
+/* Note that we only use timerfd if TFD_NONBLOCK and TFD_CLOEXEC are available
+ and working. This means that we can't support it on 2.6.25 (where timerfd
+ was introduced) or 2.6.26, since 2.6.27 introduced those flags.
+ */
+#define USING_TIMERFD
+#endif
+
struct epollop {
struct epoll_event *events;
int nevents;
int epfd;
-#ifdef USING_TIMERFD
- int timerfd;
-#endif
+#ifdef USING_TIMERFD
+ int timerfd;
+#endif
};
static void *epoll_init(struct event_base *);
@@ -99,12 +99,12 @@ static void epoll_dealloc(struct event_base *);
static const struct eventop epollops_changelist = {
"epoll (with changelist)",
epoll_init,
- event_changelist_add_,
- event_changelist_del_,
+ event_changelist_add_,
+ event_changelist_del_,
epoll_dispatch,
epoll_dealloc,
1, /* need reinit */
- EV_FEATURE_ET|EV_FEATURE_O1| EARLY_CLOSE_IF_HAVE_RDHUP,
+ EV_FEATURE_ET|EV_FEATURE_O1| EARLY_CLOSE_IF_HAVE_RDHUP,
EVENT_CHANGELIST_FDINFO_SIZE
};
@@ -122,7 +122,7 @@ const struct eventop epollops = {
epoll_dispatch,
epoll_dealloc,
1, /* need reinit */
- EV_FEATURE_ET|EV_FEATURE_O1|EV_FEATURE_EARLY_CLOSE,
+ EV_FEATURE_ET|EV_FEATURE_O1|EV_FEATURE_EARLY_CLOSE,
0
};
@@ -140,22 +140,22 @@ const struct eventop epollops = {
static void *
epoll_init(struct event_base *base)
{
- int epfd = -1;
+ int epfd = -1;
struct epollop *epollop;
-#ifdef EVENT__HAVE_EPOLL_CREATE1
- /* First, try the shiny new epoll_create1 interface, if we have it. */
- epfd = epoll_create1(EPOLL_CLOEXEC);
-#endif
- if (epfd == -1) {
- /* Initialize the kernel queue using the old interface. (The
- size field is ignored since 2.6.8.) */
- if ((epfd = epoll_create(32000)) == -1) {
- if (errno != ENOSYS)
- event_warn("epoll_create");
- return (NULL);
- }
- evutil_make_socket_closeonexec(epfd);
+#ifdef EVENT__HAVE_EPOLL_CREATE1
+ /* First, try the shiny new epoll_create1 interface, if we have it. */
+ epfd = epoll_create1(EPOLL_CLOEXEC);
+#endif
+ if (epfd == -1) {
+ /* Initialize the kernel queue using the old interface. (The
+ size field is ignored since 2.6.8.) */
+ if ((epfd = epoll_create(32000)) == -1) {
+ if (errno != ENOSYS)
+ event_warn("epoll_create");
+ return (NULL);
+ }
+ evutil_make_socket_closeonexec(epfd);
}
if (!(epollop = mm_calloc(1, sizeof(struct epollop)))) {
@@ -176,49 +176,49 @@ epoll_init(struct event_base *base)
if ((base->flags & EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST) != 0 ||
((base->flags & EVENT_BASE_FLAG_IGNORE_ENV) == 0 &&
- evutil_getenv_("EVENT_EPOLL_USE_CHANGELIST") != NULL)) {
-
+ evutil_getenv_("EVENT_EPOLL_USE_CHANGELIST") != NULL)) {
+
base->evsel = &epollops_changelist;
- }
-
-#ifdef USING_TIMERFD
- /*
- The epoll interface ordinarily gives us one-millisecond precision,
- so on Linux it makes perfect sense to use the CLOCK_MONOTONIC_COARSE
- timer. But when the user has set the new PRECISE_TIMER flag for an
- event_base, we can try to use timerfd to give them finer granularity.
- */
- if ((base->flags & EVENT_BASE_FLAG_PRECISE_TIMER) &&
- base->monotonic_timer.monotonic_clock == CLOCK_MONOTONIC) {
- int fd;
- fd = epollop->timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK|TFD_CLOEXEC);
- if (epollop->timerfd >= 0) {
- struct epoll_event epev;
- memset(&epev, 0, sizeof(epev));
- epev.data.fd = epollop->timerfd;
- epev.events = EPOLLIN;
- if (epoll_ctl(epollop->epfd, EPOLL_CTL_ADD, fd, &epev) < 0) {
- event_warn("epoll_ctl(timerfd)");
- close(fd);
- epollop->timerfd = -1;
- }
- } else {
- if (errno != EINVAL && errno != ENOSYS) {
- /* These errors probably mean that we were
- * compiled with timerfd/TFD_* support, but
- * we're running on a kernel that lacks those.
- */
- event_warn("timerfd_create");
- }
- epollop->timerfd = -1;
- }
- } else {
- epollop->timerfd = -1;
- }
-#endif
-
- evsig_init_(base);
-
+ }
+
+#ifdef USING_TIMERFD
+ /*
+ The epoll interface ordinarily gives us one-millisecond precision,
+ so on Linux it makes perfect sense to use the CLOCK_MONOTONIC_COARSE
+ timer. But when the user has set the new PRECISE_TIMER flag for an
+ event_base, we can try to use timerfd to give them finer granularity.
+ */
+ if ((base->flags & EVENT_BASE_FLAG_PRECISE_TIMER) &&
+ base->monotonic_timer.monotonic_clock == CLOCK_MONOTONIC) {
+ int fd;
+ fd = epollop->timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK|TFD_CLOEXEC);
+ if (epollop->timerfd >= 0) {
+ struct epoll_event epev;
+ memset(&epev, 0, sizeof(epev));
+ epev.data.fd = epollop->timerfd;
+ epev.events = EPOLLIN;
+ if (epoll_ctl(epollop->epfd, EPOLL_CTL_ADD, fd, &epev) < 0) {
+ event_warn("epoll_ctl(timerfd)");
+ close(fd);
+ epollop->timerfd = -1;
+ }
+ } else {
+ if (errno != EINVAL && errno != ENOSYS) {
+ /* These errors probably mean that we were
+ * compiled with timerfd/TFD_* support, but
+ * we're running on a kernel that lacks those.
+ */
+ event_warn("timerfd_create");
+ }
+ epollop->timerfd = -1;
+ }
+ } else {
+ epollop->timerfd = -1;
+ }
+#endif
+
+ evsig_init_(base);
+
return (epollop);
}
@@ -246,23 +246,23 @@ epoll_op_to_string(int op)
"???";
}
-#define PRINT_CHANGES(op, events, ch, status) \
- "Epoll %s(%d) on fd %d " status ". " \
- "Old events were %d; " \
- "read change was %d (%s); " \
- "write change was %d (%s); " \
- "close change was %d (%s)", \
- epoll_op_to_string(op), \
- events, \
- ch->fd, \
- ch->old_events, \
- ch->read_change, \
- change_to_string(ch->read_change), \
- ch->write_change, \
- change_to_string(ch->write_change), \
- ch->close_change, \
- change_to_string(ch->close_change)
-
+#define PRINT_CHANGES(op, events, ch, status) \
+ "Epoll %s(%d) on fd %d " status ". " \
+ "Old events were %d; " \
+ "read change was %d (%s); " \
+ "write change was %d (%s); " \
+ "close change was %d (%s)", \
+ epoll_op_to_string(op), \
+ events, \
+ ch->fd, \
+ ch->old_events, \
+ ch->read_change, \
+ change_to_string(ch->read_change), \
+ ch->write_change, \
+ change_to_string(ch->write_change), \
+ ch->close_change, \
+ change_to_string(ch->close_change)
+
static int
epoll_apply_one_change(struct event_base *base,
struct epollop *epollop,
@@ -270,86 +270,86 @@ epoll_apply_one_change(struct event_base *base,
{
struct epoll_event epev;
int op, events = 0;
- int idx;
+ int idx;
- idx = EPOLL_OP_TABLE_INDEX(ch);
- op = epoll_op_table[idx].op;
- events = epoll_op_table[idx].events;
+ idx = EPOLL_OP_TABLE_INDEX(ch);
+ op = epoll_op_table[idx].op;
+ events = epoll_op_table[idx].events;
- if (!events) {
- EVUTIL_ASSERT(op == 0);
- return 0;
- }
+ if (!events) {
+ EVUTIL_ASSERT(op == 0);
+ return 0;
+ }
if ((ch->read_change|ch->write_change|ch->close_change) & EV_CHANGE_ET)
- events |= EPOLLET;
-
- memset(&epev, 0, sizeof(epev));
- epev.data.fd = ch->fd;
- epev.events = events;
- if (epoll_ctl(epollop->epfd, op, ch->fd, &epev) == 0) {
- event_debug((PRINT_CHANGES(op, epev.events, ch, "okay")));
- return 0;
- }
-
- switch (op) {
- case EPOLL_CTL_MOD:
- if (errno == ENOENT) {
- /* If a MOD operation fails with ENOENT, the
- * fd was probably closed and re-opened. We
- * should retry the operation as an ADD.
- */
- if (epoll_ctl(epollop->epfd, EPOLL_CTL_ADD, ch->fd, &epev) == -1) {
- event_warn("Epoll MOD(%d) on %d retried as ADD; that failed too",
- (int)epev.events, ch->fd);
- return -1;
- } else {
- event_debug(("Epoll MOD(%d) on %d retried as ADD; succeeded.",
- (int)epev.events,
- ch->fd));
- return 0;
+ events |= EPOLLET;
+
+ memset(&epev, 0, sizeof(epev));
+ epev.data.fd = ch->fd;
+ epev.events = events;
+ if (epoll_ctl(epollop->epfd, op, ch->fd, &epev) == 0) {
+ event_debug((PRINT_CHANGES(op, epev.events, ch, "okay")));
+ return 0;
+ }
+
+ switch (op) {
+ case EPOLL_CTL_MOD:
+ if (errno == ENOENT) {
+ /* If a MOD operation fails with ENOENT, the
+ * fd was probably closed and re-opened. We
+ * should retry the operation as an ADD.
+ */
+ if (epoll_ctl(epollop->epfd, EPOLL_CTL_ADD, ch->fd, &epev) == -1) {
+ event_warn("Epoll MOD(%d) on %d retried as ADD; that failed too",
+ (int)epev.events, ch->fd);
+ return -1;
+ } else {
+ event_debug(("Epoll MOD(%d) on %d retried as ADD; succeeded.",
+ (int)epev.events,
+ ch->fd));
+ return 0;
}
}
- break;
- case EPOLL_CTL_ADD:
- if (errno == EEXIST) {
- /* If an ADD operation fails with EEXIST,
- * either the operation was redundant (as with a
- * precautionary add), or we ran into a fun
- * kernel bug where using dup*() to duplicate the
- * same file into the same fd gives you the same epitem
- * rather than a fresh one. For the second case,
- * we must retry with MOD. */
- if (epoll_ctl(epollop->epfd, EPOLL_CTL_MOD, ch->fd, &epev) == -1) {
- event_warn("Epoll ADD(%d) on %d retried as MOD; that failed too",
- (int)epev.events, ch->fd);
- return -1;
- } else {
- event_debug(("Epoll ADD(%d) on %d retried as MOD; succeeded.",
+ break;
+ case EPOLL_CTL_ADD:
+ if (errno == EEXIST) {
+ /* If an ADD operation fails with EEXIST,
+ * either the operation was redundant (as with a
+ * precautionary add), or we ran into a fun
+ * kernel bug where using dup*() to duplicate the
+ * same file into the same fd gives you the same epitem
+ * rather than a fresh one. For the second case,
+ * we must retry with MOD. */
+ if (epoll_ctl(epollop->epfd, EPOLL_CTL_MOD, ch->fd, &epev) == -1) {
+ event_warn("Epoll ADD(%d) on %d retried as MOD; that failed too",
+ (int)epev.events, ch->fd);
+ return -1;
+ } else {
+ event_debug(("Epoll ADD(%d) on %d retried as MOD; succeeded.",
(int)epev.events,
- ch->fd));
- return 0;
+ ch->fd));
+ return 0;
}
- }
- break;
- case EPOLL_CTL_DEL:
- if (errno == ENOENT || errno == EBADF || errno == EPERM) {
- /* If a delete fails with one of these errors,
- * that's fine too: we closed the fd before we
- * got around to calling epoll_dispatch. */
- event_debug(("Epoll DEL(%d) on fd %d gave %s: DEL was unnecessary.",
+ }
+ break;
+ case EPOLL_CTL_DEL:
+ if (errno == ENOENT || errno == EBADF || errno == EPERM) {
+ /* If a delete fails with one of these errors,
+ * that's fine too: we closed the fd before we
+ * got around to calling epoll_dispatch. */
+ event_debug(("Epoll DEL(%d) on fd %d gave %s: DEL was unnecessary.",
(int)epev.events,
- ch->fd,
- strerror(errno)));
- return 0;
+ ch->fd,
+ strerror(errno)));
+ return 0;
}
- break;
- default:
- break;
+ break;
+ default:
+ break;
}
-
- event_warn(PRINT_CHANGES(op, epev.events, ch, "failed"));
- return -1;
+
+ event_warn(PRINT_CHANGES(op, epev.events, ch, "failed"));
+ return -1;
}
static int
@@ -378,16 +378,16 @@ epoll_nochangelist_add(struct event_base *base, evutil_socket_t fd,
struct event_change ch;
ch.fd = fd;
ch.old_events = old;
- ch.read_change = ch.write_change = ch.close_change = 0;
+ ch.read_change = ch.write_change = ch.close_change = 0;
if (events & EV_WRITE)
ch.write_change = EV_CHANGE_ADD |
(events & EV_ET);
if (events & EV_READ)
ch.read_change = EV_CHANGE_ADD |
(events & EV_ET);
- if (events & EV_CLOSED)
- ch.close_change = EV_CHANGE_ADD |
- (events & EV_ET);
+ if (events & EV_CLOSED)
+ ch.close_change = EV_CHANGE_ADD |
+ (events & EV_ET);
return epoll_apply_one_change(base, base->evbase, &ch);
}
@@ -399,16 +399,16 @@ epoll_nochangelist_del(struct event_base *base, evutil_socket_t fd,
struct event_change ch;
ch.fd = fd;
ch.old_events = old;
- ch.read_change = ch.write_change = ch.close_change = 0;
+ ch.read_change = ch.write_change = ch.close_change = 0;
if (events & EV_WRITE)
- ch.write_change = EV_CHANGE_DEL |
- (events & EV_ET);
+ ch.write_change = EV_CHANGE_DEL |
+ (events & EV_ET);
if (events & EV_READ)
- ch.read_change = EV_CHANGE_DEL |
- (events & EV_ET);
- if (events & EV_CLOSED)
- ch.close_change = EV_CHANGE_DEL |
- (events & EV_ET);
+ ch.read_change = EV_CHANGE_DEL |
+ (events & EV_ET);
+ if (events & EV_CLOSED)
+ ch.close_change = EV_CHANGE_DEL |
+ (events & EV_ET);
return epoll_apply_one_change(base, base->evbase, &ch);
}
@@ -421,35 +421,35 @@ epoll_dispatch(struct event_base *base, struct timeval *tv)
int i, res;
long timeout = -1;
-#ifdef USING_TIMERFD
- if (epollop->timerfd >= 0) {
- struct itimerspec is;
- is.it_interval.tv_sec = 0;
- is.it_interval.tv_nsec = 0;
- if (tv == NULL) {
- /* No timeout; disarm the timer. */
- is.it_value.tv_sec = 0;
- is.it_value.tv_nsec = 0;
- } else {
- if (tv->tv_sec == 0 && tv->tv_usec == 0) {
- /* we need to exit immediately; timerfd can't
- * do that. */
- timeout = 0;
- }
- is.it_value.tv_sec = tv->tv_sec;
- is.it_value.tv_nsec = tv->tv_usec * 1000;
- }
- /* TODO: we could avoid unnecessary syscalls here by only
- calling timerfd_settime when the top timeout changes, or
- when we're called with a different timeval.
- */
- if (timerfd_settime(epollop->timerfd, 0, &is, NULL) < 0) {
- event_warn("timerfd_settime");
- }
- } else
-#endif
+#ifdef USING_TIMERFD
+ if (epollop->timerfd >= 0) {
+ struct itimerspec is;
+ is.it_interval.tv_sec = 0;
+ is.it_interval.tv_nsec = 0;
+ if (tv == NULL) {
+ /* No timeout; disarm the timer. */
+ is.it_value.tv_sec = 0;
+ is.it_value.tv_nsec = 0;
+ } else {
+ if (tv->tv_sec == 0 && tv->tv_usec == 0) {
+ /* we need to exit immediately; timerfd can't
+ * do that. */
+ timeout = 0;
+ }
+ is.it_value.tv_sec = tv->tv_sec;
+ is.it_value.tv_nsec = tv->tv_usec * 1000;
+ }
+ /* TODO: we could avoid unnecessary syscalls here by only
+ calling timerfd_settime when the top timeout changes, or
+ when we're called with a different timeval.
+ */
+ if (timerfd_settime(epollop->timerfd, 0, &is, NULL) < 0) {
+ event_warn("timerfd_settime");
+ }
+ } else
+#endif
if (tv != NULL) {
- timeout = evutil_tv_to_msec_(tv);
+ timeout = evutil_tv_to_msec_(tv);
if (timeout < 0 || timeout > MAX_EPOLL_TIMEOUT_MSEC) {
/* Linux kernels can wait forever if the timeout is
* too big; see comment on MAX_EPOLL_TIMEOUT_MSEC. */
@@ -458,7 +458,7 @@ epoll_dispatch(struct event_base *base, struct timeval *tv)
}
epoll_apply_changes(base);
- event_changelist_remove_all_(&base->changelist, base);
+ event_changelist_remove_all_(&base->changelist, base);
EVBASE_RELEASE_LOCK(base, th_base_lock);
@@ -481,10 +481,10 @@ epoll_dispatch(struct event_base *base, struct timeval *tv)
for (i = 0; i < res; i++) {
int what = events[i].events;
short ev = 0;
-#ifdef USING_TIMERFD
- if (events[i].data.fd == epollop->timerfd)
- continue;
-#endif
+#ifdef USING_TIMERFD
+ if (events[i].data.fd == epollop->timerfd)
+ continue;
+#endif
if (what & EPOLLERR) {
ev = EV_READ | EV_WRITE;
@@ -495,14 +495,14 @@ epoll_dispatch(struct event_base *base, struct timeval *tv)
ev |= EV_READ;
if (what & EPOLLOUT)
ev |= EV_WRITE;
- if (what & EPOLLRDHUP)
- ev |= EV_CLOSED;
+ if (what & EPOLLRDHUP)
+ ev |= EV_CLOSED;
}
if (!ev)
continue;
- evmap_io_active_(base, events[i].data.fd, ev | EV_ET);
+ evmap_io_active_(base, events[i].data.fd, ev | EV_ET);
}
if (res == epollop->nevents && epollop->nevents < MAX_NEVENT) {
@@ -528,18 +528,18 @@ epoll_dealloc(struct event_base *base)
{
struct epollop *epollop = base->evbase;
- evsig_dealloc_(base);
+ evsig_dealloc_(base);
if (epollop->events)
mm_free(epollop->events);
if (epollop->epfd >= 0)
close(epollop->epfd);
-#ifdef USING_TIMERFD
- if (epollop->timerfd >= 0)
- close(epollop->timerfd);
-#endif
+#ifdef USING_TIMERFD
+ if (epollop->timerfd >= 0)
+ close(epollop->timerfd);
+#endif
memset(epollop, 0, sizeof(struct epollop));
mm_free(epollop);
}
-
-#endif /* EVENT__HAVE_EPOLL */
+
+#endif /* EVENT__HAVE_EPOLL */
diff --git a/contrib/libs/libevent/epoll_sub.c b/contrib/libs/libevent/epoll_sub.c
index 3f01f6a699..69ab8e126a 100644
--- a/contrib/libs/libevent/epoll_sub.c
+++ b/contrib/libs/libevent/epoll_sub.c
@@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "evconfig-private.h"
+#include "evconfig-private.h"
#include <stdint.h>
#include <sys/param.h>
diff --git a/contrib/libs/libevent/epolltable-internal.h b/contrib/libs/libevent/epolltable-internal.h
index 73c2e3647e..000f1e0703 100644
--- a/contrib/libs/libevent/epolltable-internal.h
+++ b/contrib/libs/libevent/epolltable-internal.h
@@ -1,1166 +1,1166 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EPOLLTABLE_INTERNAL_H_INCLUDED_
-#define EPOLLTABLE_INTERNAL_H_INCLUDED_
-
-/*
- Here are the values we're masking off to decide what operations to do.
- Note that since EV_READ|EV_WRITE.
-
- Note also that this table is a little sparse, since ADD+DEL is
- nonsensical ("xxx" in the list below.)
-
- Note also that we are shifting old_events by only 5 bits, since
- EV_READ is 2 and EV_WRITE is 4.
-
- The table was auto-generated with a python script, according to this
- pseudocode:[*0]
-
- If either the read or the write change is add+del:
- This is impossible; Set op==-1, events=0.
- Else, if either the read or the write change is add:
- Set events to 0.
- If the read change is add, or
- (the read change is not del, and ev_read is in old_events):
- Add EPOLLIN to events.
- If the write change is add, or
- (the write change is not del, and ev_write is in old_events):
- Add EPOLLOUT to events.
-
- If old_events is set:
- Set op to EPOLL_CTL_MOD [*1,*2]
- Else:
- Set op to EPOLL_CTL_ADD [*3]
-
- Else, if the read or the write change is del:
- Set op to EPOLL_CTL_DEL.
- If the read change is del:
- If the write change is del:
- Set events to EPOLLIN|EPOLLOUT
- Else if ev_write is in old_events:
- Set events to EPOLLOUT
- Set op to EPOLL_CTL_MOD
- Else
- Set events to EPOLLIN
- Else:
- {The write change is del.}
- If ev_read is in old_events:
- Set events to EPOLLIN
- Set op to EPOLL_CTL_MOD
- Else:
- Set the events to EPOLLOUT
-
- Else:
- There is no read or write change; set op to 0 and events to 0.
-
- The logic is a little tricky, since we had no events set on the fd before,
- we need to set op="ADD" and set events=the events we want to add. If we
- had any events set on the fd before, and we want any events to remain on
- the fd, we need to say op="MOD" and set events=the events we want to
- remain. But if we want to delete the last event, we say op="DEL" and
- set events=(any non-null pointer).
-
- [*0] Actually, the Python script has gotten a bit more complicated, to
- support EPOLLRDHUP.
-
- [*1] This MOD is only a guess. MOD might fail with ENOENT if the file was
- closed and a new file was opened with the same fd. If so, we'll retry
- with ADD.
-
- [*2] We can't replace this with a no-op even if old_events is the same as
- the new events: if the file was closed and reopened, we need to retry
- with an ADD. (We do a MOD in this case since "no change" is more
- common than "close and reopen", so we'll usually wind up doing 1
- syscalls instead of 2.)
-
- [*3] This ADD is only a guess. There is a fun Linux kernel issue where if
- you have two fds for the same file (via dup) and you ADD one to an
- epfd, then close it, then re-create it with the same fd (via dup2 or an
- unlucky dup), then try to ADD it again, you'll get an EEXIST, since the
- struct epitem is not actually removed from the struct eventpoll until
- the file itself is closed.
-
- EV_CHANGE_ADD==1
- EV_CHANGE_DEL==2
- EV_READ ==2
- EV_WRITE ==4
- EV_CLOSED ==0x80
-
- Bit 0: close change is add
- Bit 1: close change is del
- Bit 2: read change is add
- Bit 3: read change is del
- Bit 4: write change is add
- Bit 5: write change is del
- Bit 6: old events had EV_READ
- Bit 7: old events had EV_WRITE
- Bit 8: old events had EV_CLOSED
-*/
-
-#define EPOLL_OP_TABLE_INDEX(c) \
- ( (((c)->close_change&(EV_CHANGE_ADD|EV_CHANGE_DEL))) | \
- (((c)->read_change&(EV_CHANGE_ADD|EV_CHANGE_DEL)) << 2) | \
- (((c)->write_change&(EV_CHANGE_ADD|EV_CHANGE_DEL)) << 4) | \
- (((c)->old_events&(EV_READ|EV_WRITE)) << 5) | \
- (((c)->old_events&(EV_CLOSED)) << 1) \
- )
-
-#if EV_READ != 2 || EV_WRITE != 4 || EV_CLOSED != 0x80 || EV_CHANGE_ADD != 1 || EV_CHANGE_DEL != 2
-#error "Libevent's internals changed! Regenerate the op_table in epolltable-internal.h"
-#endif
-
-static const struct operation {
- int events;
- int op;
-} epoll_op_table[] = {
- /* old= 0, write: 0, read: 0, close: 0 */
- { 0, 0 },
- /* old= 0, write: 0, read: 0, close:add */
- { EPOLLRDHUP, EPOLL_CTL_ADD },
- /* old= 0, write: 0, read: 0, close:del */
- { EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= 0, write: 0, read: 0, close:xxx */
- { 0, 255 },
- /* old= 0, write: 0, read:add, close: 0 */
- { EPOLLIN, EPOLL_CTL_ADD },
- /* old= 0, write: 0, read:add, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_ADD },
- /* old= 0, write: 0, read:add, close:del */
- { EPOLLIN, EPOLL_CTL_ADD },
- /* old= 0, write: 0, read:add, close:xxx */
- { 0, 255 },
- /* old= 0, write: 0, read:del, close: 0 */
- { EPOLLIN, EPOLL_CTL_DEL },
- /* old= 0, write: 0, read:del, close:add */
- { EPOLLRDHUP, EPOLL_CTL_ADD },
- /* old= 0, write: 0, read:del, close:del */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= 0, write: 0, read:del, close:xxx */
- { 0, 255 },
- /* old= 0, write: 0, read:xxx, close: 0 */
- { 0, 255 },
- /* old= 0, write: 0, read:xxx, close:add */
- { 0, 255 },
- /* old= 0, write: 0, read:xxx, close:del */
- { 0, 255 },
- /* old= 0, write: 0, read:xxx, close:xxx */
- { 0, 255 },
- /* old= 0, write:add, read: 0, close: 0 */
- { EPOLLOUT, EPOLL_CTL_ADD },
- /* old= 0, write:add, read: 0, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_ADD },
- /* old= 0, write:add, read: 0, close:del */
- { EPOLLOUT, EPOLL_CTL_ADD },
- /* old= 0, write:add, read: 0, close:xxx */
- { 0, 255 },
- /* old= 0, write:add, read:add, close: 0 */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_ADD },
- /* old= 0, write:add, read:add, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_ADD },
- /* old= 0, write:add, read:add, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_ADD },
- /* old= 0, write:add, read:add, close:xxx */
- { 0, 255 },
- /* old= 0, write:add, read:del, close: 0 */
- { EPOLLOUT, EPOLL_CTL_ADD },
- /* old= 0, write:add, read:del, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_ADD },
- /* old= 0, write:add, read:del, close:del */
- { EPOLLOUT, EPOLL_CTL_ADD },
- /* old= 0, write:add, read:del, close:xxx */
- { 0, 255 },
- /* old= 0, write:add, read:xxx, close: 0 */
- { 0, 255 },
- /* old= 0, write:add, read:xxx, close:add */
- { 0, 255 },
- /* old= 0, write:add, read:xxx, close:del */
- { 0, 255 },
- /* old= 0, write:add, read:xxx, close:xxx */
- { 0, 255 },
- /* old= 0, write:del, read: 0, close: 0 */
- { EPOLLOUT, EPOLL_CTL_DEL },
- /* old= 0, write:del, read: 0, close:add */
- { EPOLLRDHUP, EPOLL_CTL_ADD },
- /* old= 0, write:del, read: 0, close:del */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= 0, write:del, read: 0, close:xxx */
- { 0, 255 },
- /* old= 0, write:del, read:add, close: 0 */
- { EPOLLIN, EPOLL_CTL_ADD },
- /* old= 0, write:del, read:add, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_ADD },
- /* old= 0, write:del, read:add, close:del */
- { EPOLLIN, EPOLL_CTL_ADD },
- /* old= 0, write:del, read:add, close:xxx */
- { 0, 255 },
- /* old= 0, write:del, read:del, close: 0 */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_DEL },
- /* old= 0, write:del, read:del, close:add */
- { EPOLLRDHUP, EPOLL_CTL_ADD },
- /* old= 0, write:del, read:del, close:del */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= 0, write:del, read:del, close:xxx */
- { 0, 255 },
- /* old= 0, write:del, read:xxx, close: 0 */
- { 0, 255 },
- /* old= 0, write:del, read:xxx, close:add */
- { 0, 255 },
- /* old= 0, write:del, read:xxx, close:del */
- { 0, 255 },
- /* old= 0, write:del, read:xxx, close:xxx */
- { 0, 255 },
- /* old= 0, write:xxx, read: 0, close: 0 */
- { 0, 255 },
- /* old= 0, write:xxx, read: 0, close:add */
- { 0, 255 },
- /* old= 0, write:xxx, read: 0, close:del */
- { 0, 255 },
- /* old= 0, write:xxx, read: 0, close:xxx */
- { 0, 255 },
- /* old= 0, write:xxx, read:add, close: 0 */
- { 0, 255 },
- /* old= 0, write:xxx, read:add, close:add */
- { 0, 255 },
- /* old= 0, write:xxx, read:add, close:del */
- { 0, 255 },
- /* old= 0, write:xxx, read:add, close:xxx */
- { 0, 255 },
- /* old= 0, write:xxx, read:del, close: 0 */
- { 0, 255 },
- /* old= 0, write:xxx, read:del, close:add */
- { 0, 255 },
- /* old= 0, write:xxx, read:del, close:del */
- { 0, 255 },
- /* old= 0, write:xxx, read:del, close:xxx */
- { 0, 255 },
- /* old= 0, write:xxx, read:xxx, close: 0 */
- { 0, 255 },
- /* old= 0, write:xxx, read:xxx, close:add */
- { 0, 255 },
- /* old= 0, write:xxx, read:xxx, close:del */
- { 0, 255 },
- /* old= 0, write:xxx, read:xxx, close:xxx */
- { 0, 255 },
- /* old= r, write: 0, read: 0, close: 0 */
- { 0, 0 },
- /* old= r, write: 0, read: 0, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= r, write: 0, read: 0, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= r, write: 0, read: 0, close:xxx */
- { 0, 255 },
- /* old= r, write: 0, read:add, close: 0 */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= r, write: 0, read:add, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= r, write: 0, read:add, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= r, write: 0, read:add, close:xxx */
- { 0, 255 },
- /* old= r, write: 0, read:del, close: 0 */
- { EPOLLIN, EPOLL_CTL_DEL },
- /* old= r, write: 0, read:del, close:add */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= r, write: 0, read:del, close:del */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= r, write: 0, read:del, close:xxx */
- { 0, 255 },
- /* old= r, write: 0, read:xxx, close: 0 */
- { 0, 255 },
- /* old= r, write: 0, read:xxx, close:add */
- { 0, 255 },
- /* old= r, write: 0, read:xxx, close:del */
- { 0, 255 },
- /* old= r, write: 0, read:xxx, close:xxx */
- { 0, 255 },
- /* old= r, write:add, read: 0, close: 0 */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= r, write:add, read: 0, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= r, write:add, read: 0, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= r, write:add, read: 0, close:xxx */
- { 0, 255 },
- /* old= r, write:add, read:add, close: 0 */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= r, write:add, read:add, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= r, write:add, read:add, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= r, write:add, read:add, close:xxx */
- { 0, 255 },
- /* old= r, write:add, read:del, close: 0 */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= r, write:add, read:del, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= r, write:add, read:del, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= r, write:add, read:del, close:xxx */
- { 0, 255 },
- /* old= r, write:add, read:xxx, close: 0 */
- { 0, 255 },
- /* old= r, write:add, read:xxx, close:add */
- { 0, 255 },
- /* old= r, write:add, read:xxx, close:del */
- { 0, 255 },
- /* old= r, write:add, read:xxx, close:xxx */
- { 0, 255 },
- /* old= r, write:del, read: 0, close: 0 */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= r, write:del, read: 0, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= r, write:del, read: 0, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= r, write:del, read: 0, close:xxx */
- { 0, 255 },
- /* old= r, write:del, read:add, close: 0 */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= r, write:del, read:add, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= r, write:del, read:add, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= r, write:del, read:add, close:xxx */
- { 0, 255 },
- /* old= r, write:del, read:del, close: 0 */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_DEL },
- /* old= r, write:del, read:del, close:add */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= r, write:del, read:del, close:del */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= r, write:del, read:del, close:xxx */
- { 0, 255 },
- /* old= r, write:del, read:xxx, close: 0 */
- { 0, 255 },
- /* old= r, write:del, read:xxx, close:add */
- { 0, 255 },
- /* old= r, write:del, read:xxx, close:del */
- { 0, 255 },
- /* old= r, write:del, read:xxx, close:xxx */
- { 0, 255 },
- /* old= r, write:xxx, read: 0, close: 0 */
- { 0, 255 },
- /* old= r, write:xxx, read: 0, close:add */
- { 0, 255 },
- /* old= r, write:xxx, read: 0, close:del */
- { 0, 255 },
- /* old= r, write:xxx, read: 0, close:xxx */
- { 0, 255 },
- /* old= r, write:xxx, read:add, close: 0 */
- { 0, 255 },
- /* old= r, write:xxx, read:add, close:add */
- { 0, 255 },
- /* old= r, write:xxx, read:add, close:del */
- { 0, 255 },
- /* old= r, write:xxx, read:add, close:xxx */
- { 0, 255 },
- /* old= r, write:xxx, read:del, close: 0 */
- { 0, 255 },
- /* old= r, write:xxx, read:del, close:add */
- { 0, 255 },
- /* old= r, write:xxx, read:del, close:del */
- { 0, 255 },
- /* old= r, write:xxx, read:del, close:xxx */
- { 0, 255 },
- /* old= r, write:xxx, read:xxx, close: 0 */
- { 0, 255 },
- /* old= r, write:xxx, read:xxx, close:add */
- { 0, 255 },
- /* old= r, write:xxx, read:xxx, close:del */
- { 0, 255 },
- /* old= r, write:xxx, read:xxx, close:xxx */
- { 0, 255 },
- /* old= w, write: 0, read: 0, close: 0 */
- { 0, 0 },
- /* old= w, write: 0, read: 0, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= w, write: 0, read: 0, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= w, write: 0, read: 0, close:xxx */
- { 0, 255 },
- /* old= w, write: 0, read:add, close: 0 */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= w, write: 0, read:add, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= w, write: 0, read:add, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= w, write: 0, read:add, close:xxx */
- { 0, 255 },
- /* old= w, write: 0, read:del, close: 0 */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= w, write: 0, read:del, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= w, write: 0, read:del, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= w, write: 0, read:del, close:xxx */
- { 0, 255 },
- /* old= w, write: 0, read:xxx, close: 0 */
- { 0, 255 },
- /* old= w, write: 0, read:xxx, close:add */
- { 0, 255 },
- /* old= w, write: 0, read:xxx, close:del */
- { 0, 255 },
- /* old= w, write: 0, read:xxx, close:xxx */
- { 0, 255 },
- /* old= w, write:add, read: 0, close: 0 */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= w, write:add, read: 0, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= w, write:add, read: 0, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= w, write:add, read: 0, close:xxx */
- { 0, 255 },
- /* old= w, write:add, read:add, close: 0 */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= w, write:add, read:add, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= w, write:add, read:add, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= w, write:add, read:add, close:xxx */
- { 0, 255 },
- /* old= w, write:add, read:del, close: 0 */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= w, write:add, read:del, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= w, write:add, read:del, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= w, write:add, read:del, close:xxx */
- { 0, 255 },
- /* old= w, write:add, read:xxx, close: 0 */
- { 0, 255 },
- /* old= w, write:add, read:xxx, close:add */
- { 0, 255 },
- /* old= w, write:add, read:xxx, close:del */
- { 0, 255 },
- /* old= w, write:add, read:xxx, close:xxx */
- { 0, 255 },
- /* old= w, write:del, read: 0, close: 0 */
- { EPOLLOUT, EPOLL_CTL_DEL },
- /* old= w, write:del, read: 0, close:add */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= w, write:del, read: 0, close:del */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= w, write:del, read: 0, close:xxx */
- { 0, 255 },
- /* old= w, write:del, read:add, close: 0 */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= w, write:del, read:add, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= w, write:del, read:add, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= w, write:del, read:add, close:xxx */
- { 0, 255 },
- /* old= w, write:del, read:del, close: 0 */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_DEL },
- /* old= w, write:del, read:del, close:add */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= w, write:del, read:del, close:del */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= w, write:del, read:del, close:xxx */
- { 0, 255 },
- /* old= w, write:del, read:xxx, close: 0 */
- { 0, 255 },
- /* old= w, write:del, read:xxx, close:add */
- { 0, 255 },
- /* old= w, write:del, read:xxx, close:del */
- { 0, 255 },
- /* old= w, write:del, read:xxx, close:xxx */
- { 0, 255 },
- /* old= w, write:xxx, read: 0, close: 0 */
- { 0, 255 },
- /* old= w, write:xxx, read: 0, close:add */
- { 0, 255 },
- /* old= w, write:xxx, read: 0, close:del */
- { 0, 255 },
- /* old= w, write:xxx, read: 0, close:xxx */
- { 0, 255 },
- /* old= w, write:xxx, read:add, close: 0 */
- { 0, 255 },
- /* old= w, write:xxx, read:add, close:add */
- { 0, 255 },
- /* old= w, write:xxx, read:add, close:del */
- { 0, 255 },
- /* old= w, write:xxx, read:add, close:xxx */
- { 0, 255 },
- /* old= w, write:xxx, read:del, close: 0 */
- { 0, 255 },
- /* old= w, write:xxx, read:del, close:add */
- { 0, 255 },
- /* old= w, write:xxx, read:del, close:del */
- { 0, 255 },
- /* old= w, write:xxx, read:del, close:xxx */
- { 0, 255 },
- /* old= w, write:xxx, read:xxx, close: 0 */
- { 0, 255 },
- /* old= w, write:xxx, read:xxx, close:add */
- { 0, 255 },
- /* old= w, write:xxx, read:xxx, close:del */
- { 0, 255 },
- /* old= w, write:xxx, read:xxx, close:xxx */
- { 0, 255 },
- /* old= rw, write: 0, read: 0, close: 0 */
- { 0, 0 },
- /* old= rw, write: 0, read: 0, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= rw, write: 0, read: 0, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= rw, write: 0, read: 0, close:xxx */
- { 0, 255 },
- /* old= rw, write: 0, read:add, close: 0 */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= rw, write: 0, read:add, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= rw, write: 0, read:add, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= rw, write: 0, read:add, close:xxx */
- { 0, 255 },
- /* old= rw, write: 0, read:del, close: 0 */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= rw, write: 0, read:del, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= rw, write: 0, read:del, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= rw, write: 0, read:del, close:xxx */
- { 0, 255 },
- /* old= rw, write: 0, read:xxx, close: 0 */
- { 0, 255 },
- /* old= rw, write: 0, read:xxx, close:add */
- { 0, 255 },
- /* old= rw, write: 0, read:xxx, close:del */
- { 0, 255 },
- /* old= rw, write: 0, read:xxx, close:xxx */
- { 0, 255 },
- /* old= rw, write:add, read: 0, close: 0 */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= rw, write:add, read: 0, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= rw, write:add, read: 0, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= rw, write:add, read: 0, close:xxx */
- { 0, 255 },
- /* old= rw, write:add, read:add, close: 0 */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= rw, write:add, read:add, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= rw, write:add, read:add, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= rw, write:add, read:add, close:xxx */
- { 0, 255 },
- /* old= rw, write:add, read:del, close: 0 */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= rw, write:add, read:del, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= rw, write:add, read:del, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= rw, write:add, read:del, close:xxx */
- { 0, 255 },
- /* old= rw, write:add, read:xxx, close: 0 */
- { 0, 255 },
- /* old= rw, write:add, read:xxx, close:add */
- { 0, 255 },
- /* old= rw, write:add, read:xxx, close:del */
- { 0, 255 },
- /* old= rw, write:add, read:xxx, close:xxx */
- { 0, 255 },
- /* old= rw, write:del, read: 0, close: 0 */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= rw, write:del, read: 0, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= rw, write:del, read: 0, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= rw, write:del, read: 0, close:xxx */
- { 0, 255 },
- /* old= rw, write:del, read:add, close: 0 */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= rw, write:del, read:add, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= rw, write:del, read:add, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= rw, write:del, read:add, close:xxx */
- { 0, 255 },
- /* old= rw, write:del, read:del, close: 0 */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_DEL },
- /* old= rw, write:del, read:del, close:add */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= rw, write:del, read:del, close:del */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= rw, write:del, read:del, close:xxx */
- { 0, 255 },
- /* old= rw, write:del, read:xxx, close: 0 */
- { 0, 255 },
- /* old= rw, write:del, read:xxx, close:add */
- { 0, 255 },
- /* old= rw, write:del, read:xxx, close:del */
- { 0, 255 },
- /* old= rw, write:del, read:xxx, close:xxx */
- { 0, 255 },
- /* old= rw, write:xxx, read: 0, close: 0 */
- { 0, 255 },
- /* old= rw, write:xxx, read: 0, close:add */
- { 0, 255 },
- /* old= rw, write:xxx, read: 0, close:del */
- { 0, 255 },
- /* old= rw, write:xxx, read: 0, close:xxx */
- { 0, 255 },
- /* old= rw, write:xxx, read:add, close: 0 */
- { 0, 255 },
- /* old= rw, write:xxx, read:add, close:add */
- { 0, 255 },
- /* old= rw, write:xxx, read:add, close:del */
- { 0, 255 },
- /* old= rw, write:xxx, read:add, close:xxx */
- { 0, 255 },
- /* old= rw, write:xxx, read:del, close: 0 */
- { 0, 255 },
- /* old= rw, write:xxx, read:del, close:add */
- { 0, 255 },
- /* old= rw, write:xxx, read:del, close:del */
- { 0, 255 },
- /* old= rw, write:xxx, read:del, close:xxx */
- { 0, 255 },
- /* old= rw, write:xxx, read:xxx, close: 0 */
- { 0, 255 },
- /* old= rw, write:xxx, read:xxx, close:add */
- { 0, 255 },
- /* old= rw, write:xxx, read:xxx, close:del */
- { 0, 255 },
- /* old= rw, write:xxx, read:xxx, close:xxx */
- { 0, 255 },
- /* old= c, write: 0, read: 0, close: 0 */
- { 0, 0 },
- /* old= c, write: 0, read: 0, close:add */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write: 0, read: 0, close:del */
- { EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= c, write: 0, read: 0, close:xxx */
- { 0, 255 },
- /* old= c, write: 0, read:add, close: 0 */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write: 0, read:add, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write: 0, read:add, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= c, write: 0, read:add, close:xxx */
- { 0, 255 },
- /* old= c, write: 0, read:del, close: 0 */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write: 0, read:del, close:add */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write: 0, read:del, close:del */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= c, write: 0, read:del, close:xxx */
- { 0, 255 },
- /* old= c, write: 0, read:xxx, close: 0 */
- { 0, 255 },
- /* old= c, write: 0, read:xxx, close:add */
- { 0, 255 },
- /* old= c, write: 0, read:xxx, close:del */
- { 0, 255 },
- /* old= c, write: 0, read:xxx, close:xxx */
- { 0, 255 },
- /* old= c, write:add, read: 0, close: 0 */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write:add, read: 0, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write:add, read: 0, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= c, write:add, read: 0, close:xxx */
- { 0, 255 },
- /* old= c, write:add, read:add, close: 0 */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write:add, read:add, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write:add, read:add, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= c, write:add, read:add, close:xxx */
- { 0, 255 },
- /* old= c, write:add, read:del, close: 0 */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write:add, read:del, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write:add, read:del, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= c, write:add, read:del, close:xxx */
- { 0, 255 },
- /* old= c, write:add, read:xxx, close: 0 */
- { 0, 255 },
- /* old= c, write:add, read:xxx, close:add */
- { 0, 255 },
- /* old= c, write:add, read:xxx, close:del */
- { 0, 255 },
- /* old= c, write:add, read:xxx, close:xxx */
- { 0, 255 },
- /* old= c, write:del, read: 0, close: 0 */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write:del, read: 0, close:add */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write:del, read: 0, close:del */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= c, write:del, read: 0, close:xxx */
- { 0, 255 },
- /* old= c, write:del, read:add, close: 0 */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write:del, read:add, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write:del, read:add, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= c, write:del, read:add, close:xxx */
- { 0, 255 },
- /* old= c, write:del, read:del, close: 0 */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write:del, read:del, close:add */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= c, write:del, read:del, close:del */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= c, write:del, read:del, close:xxx */
- { 0, 255 },
- /* old= c, write:del, read:xxx, close: 0 */
- { 0, 255 },
- /* old= c, write:del, read:xxx, close:add */
- { 0, 255 },
- /* old= c, write:del, read:xxx, close:del */
- { 0, 255 },
- /* old= c, write:del, read:xxx, close:xxx */
- { 0, 255 },
- /* old= c, write:xxx, read: 0, close: 0 */
- { 0, 255 },
- /* old= c, write:xxx, read: 0, close:add */
- { 0, 255 },
- /* old= c, write:xxx, read: 0, close:del */
- { 0, 255 },
- /* old= c, write:xxx, read: 0, close:xxx */
- { 0, 255 },
- /* old= c, write:xxx, read:add, close: 0 */
- { 0, 255 },
- /* old= c, write:xxx, read:add, close:add */
- { 0, 255 },
- /* old= c, write:xxx, read:add, close:del */
- { 0, 255 },
- /* old= c, write:xxx, read:add, close:xxx */
- { 0, 255 },
- /* old= c, write:xxx, read:del, close: 0 */
- { 0, 255 },
- /* old= c, write:xxx, read:del, close:add */
- { 0, 255 },
- /* old= c, write:xxx, read:del, close:del */
- { 0, 255 },
- /* old= c, write:xxx, read:del, close:xxx */
- { 0, 255 },
- /* old= c, write:xxx, read:xxx, close: 0 */
- { 0, 255 },
- /* old= c, write:xxx, read:xxx, close:add */
- { 0, 255 },
- /* old= c, write:xxx, read:xxx, close:del */
- { 0, 255 },
- /* old= c, write:xxx, read:xxx, close:xxx */
- { 0, 255 },
- /* old= cr, write: 0, read: 0, close: 0 */
- { 0, 0 },
- /* old= cr, write: 0, read: 0, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write: 0, read: 0, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= cr, write: 0, read: 0, close:xxx */
- { 0, 255 },
- /* old= cr, write: 0, read:add, close: 0 */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write: 0, read:add, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write: 0, read:add, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= cr, write: 0, read:add, close:xxx */
- { 0, 255 },
- /* old= cr, write: 0, read:del, close: 0 */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write: 0, read:del, close:add */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write: 0, read:del, close:del */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= cr, write: 0, read:del, close:xxx */
- { 0, 255 },
- /* old= cr, write: 0, read:xxx, close: 0 */
- { 0, 255 },
- /* old= cr, write: 0, read:xxx, close:add */
- { 0, 255 },
- /* old= cr, write: 0, read:xxx, close:del */
- { 0, 255 },
- /* old= cr, write: 0, read:xxx, close:xxx */
- { 0, 255 },
- /* old= cr, write:add, read: 0, close: 0 */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write:add, read: 0, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write:add, read: 0, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= cr, write:add, read: 0, close:xxx */
- { 0, 255 },
- /* old= cr, write:add, read:add, close: 0 */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write:add, read:add, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write:add, read:add, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= cr, write:add, read:add, close:xxx */
- { 0, 255 },
- /* old= cr, write:add, read:del, close: 0 */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write:add, read:del, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write:add, read:del, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= cr, write:add, read:del, close:xxx */
- { 0, 255 },
- /* old= cr, write:add, read:xxx, close: 0 */
- { 0, 255 },
- /* old= cr, write:add, read:xxx, close:add */
- { 0, 255 },
- /* old= cr, write:add, read:xxx, close:del */
- { 0, 255 },
- /* old= cr, write:add, read:xxx, close:xxx */
- { 0, 255 },
- /* old= cr, write:del, read: 0, close: 0 */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write:del, read: 0, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write:del, read: 0, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= cr, write:del, read: 0, close:xxx */
- { 0, 255 },
- /* old= cr, write:del, read:add, close: 0 */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write:del, read:add, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write:del, read:add, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= cr, write:del, read:add, close:xxx */
- { 0, 255 },
- /* old= cr, write:del, read:del, close: 0 */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write:del, read:del, close:add */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cr, write:del, read:del, close:del */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= cr, write:del, read:del, close:xxx */
- { 0, 255 },
- /* old= cr, write:del, read:xxx, close: 0 */
- { 0, 255 },
- /* old= cr, write:del, read:xxx, close:add */
- { 0, 255 },
- /* old= cr, write:del, read:xxx, close:del */
- { 0, 255 },
- /* old= cr, write:del, read:xxx, close:xxx */
- { 0, 255 },
- /* old= cr, write:xxx, read: 0, close: 0 */
- { 0, 255 },
- /* old= cr, write:xxx, read: 0, close:add */
- { 0, 255 },
- /* old= cr, write:xxx, read: 0, close:del */
- { 0, 255 },
- /* old= cr, write:xxx, read: 0, close:xxx */
- { 0, 255 },
- /* old= cr, write:xxx, read:add, close: 0 */
- { 0, 255 },
- /* old= cr, write:xxx, read:add, close:add */
- { 0, 255 },
- /* old= cr, write:xxx, read:add, close:del */
- { 0, 255 },
- /* old= cr, write:xxx, read:add, close:xxx */
- { 0, 255 },
- /* old= cr, write:xxx, read:del, close: 0 */
- { 0, 255 },
- /* old= cr, write:xxx, read:del, close:add */
- { 0, 255 },
- /* old= cr, write:xxx, read:del, close:del */
- { 0, 255 },
- /* old= cr, write:xxx, read:del, close:xxx */
- { 0, 255 },
- /* old= cr, write:xxx, read:xxx, close: 0 */
- { 0, 255 },
- /* old= cr, write:xxx, read:xxx, close:add */
- { 0, 255 },
- /* old= cr, write:xxx, read:xxx, close:del */
- { 0, 255 },
- /* old= cr, write:xxx, read:xxx, close:xxx */
- { 0, 255 },
- /* old= cw, write: 0, read: 0, close: 0 */
- { 0, 0 },
- /* old= cw, write: 0, read: 0, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write: 0, read: 0, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= cw, write: 0, read: 0, close:xxx */
- { 0, 255 },
- /* old= cw, write: 0, read:add, close: 0 */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write: 0, read:add, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write: 0, read:add, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= cw, write: 0, read:add, close:xxx */
- { 0, 255 },
- /* old= cw, write: 0, read:del, close: 0 */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write: 0, read:del, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write: 0, read:del, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= cw, write: 0, read:del, close:xxx */
- { 0, 255 },
- /* old= cw, write: 0, read:xxx, close: 0 */
- { 0, 255 },
- /* old= cw, write: 0, read:xxx, close:add */
- { 0, 255 },
- /* old= cw, write: 0, read:xxx, close:del */
- { 0, 255 },
- /* old= cw, write: 0, read:xxx, close:xxx */
- { 0, 255 },
- /* old= cw, write:add, read: 0, close: 0 */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write:add, read: 0, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write:add, read: 0, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= cw, write:add, read: 0, close:xxx */
- { 0, 255 },
- /* old= cw, write:add, read:add, close: 0 */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write:add, read:add, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write:add, read:add, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old= cw, write:add, read:add, close:xxx */
- { 0, 255 },
- /* old= cw, write:add, read:del, close: 0 */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write:add, read:del, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write:add, read:del, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old= cw, write:add, read:del, close:xxx */
- { 0, 255 },
- /* old= cw, write:add, read:xxx, close: 0 */
- { 0, 255 },
- /* old= cw, write:add, read:xxx, close:add */
- { 0, 255 },
- /* old= cw, write:add, read:xxx, close:del */
- { 0, 255 },
- /* old= cw, write:add, read:xxx, close:xxx */
- { 0, 255 },
- /* old= cw, write:del, read: 0, close: 0 */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write:del, read: 0, close:add */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write:del, read: 0, close:del */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= cw, write:del, read: 0, close:xxx */
- { 0, 255 },
- /* old= cw, write:del, read:add, close: 0 */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write:del, read:add, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write:del, read:add, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old= cw, write:del, read:add, close:xxx */
- { 0, 255 },
- /* old= cw, write:del, read:del, close: 0 */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write:del, read:del, close:add */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old= cw, write:del, read:del, close:del */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old= cw, write:del, read:del, close:xxx */
- { 0, 255 },
- /* old= cw, write:del, read:xxx, close: 0 */
- { 0, 255 },
- /* old= cw, write:del, read:xxx, close:add */
- { 0, 255 },
- /* old= cw, write:del, read:xxx, close:del */
- { 0, 255 },
- /* old= cw, write:del, read:xxx, close:xxx */
- { 0, 255 },
- /* old= cw, write:xxx, read: 0, close: 0 */
- { 0, 255 },
- /* old= cw, write:xxx, read: 0, close:add */
- { 0, 255 },
- /* old= cw, write:xxx, read: 0, close:del */
- { 0, 255 },
- /* old= cw, write:xxx, read: 0, close:xxx */
- { 0, 255 },
- /* old= cw, write:xxx, read:add, close: 0 */
- { 0, 255 },
- /* old= cw, write:xxx, read:add, close:add */
- { 0, 255 },
- /* old= cw, write:xxx, read:add, close:del */
- { 0, 255 },
- /* old= cw, write:xxx, read:add, close:xxx */
- { 0, 255 },
- /* old= cw, write:xxx, read:del, close: 0 */
- { 0, 255 },
- /* old= cw, write:xxx, read:del, close:add */
- { 0, 255 },
- /* old= cw, write:xxx, read:del, close:del */
- { 0, 255 },
- /* old= cw, write:xxx, read:del, close:xxx */
- { 0, 255 },
- /* old= cw, write:xxx, read:xxx, close: 0 */
- { 0, 255 },
- /* old= cw, write:xxx, read:xxx, close:add */
- { 0, 255 },
- /* old= cw, write:xxx, read:xxx, close:del */
- { 0, 255 },
- /* old= cw, write:xxx, read:xxx, close:xxx */
- { 0, 255 },
- /* old=crw, write: 0, read: 0, close: 0 */
- { 0, 0 },
- /* old=crw, write: 0, read: 0, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write: 0, read: 0, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old=crw, write: 0, read: 0, close:xxx */
- { 0, 255 },
- /* old=crw, write: 0, read:add, close: 0 */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write: 0, read:add, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write: 0, read:add, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old=crw, write: 0, read:add, close:xxx */
- { 0, 255 },
- /* old=crw, write: 0, read:del, close: 0 */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write: 0, read:del, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write: 0, read:del, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old=crw, write: 0, read:del, close:xxx */
- { 0, 255 },
- /* old=crw, write: 0, read:xxx, close: 0 */
- { 0, 255 },
- /* old=crw, write: 0, read:xxx, close:add */
- { 0, 255 },
- /* old=crw, write: 0, read:xxx, close:del */
- { 0, 255 },
- /* old=crw, write: 0, read:xxx, close:xxx */
- { 0, 255 },
- /* old=crw, write:add, read: 0, close: 0 */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write:add, read: 0, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write:add, read: 0, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old=crw, write:add, read: 0, close:xxx */
- { 0, 255 },
- /* old=crw, write:add, read:add, close: 0 */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write:add, read:add, close:add */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write:add, read:add, close:del */
- { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
- /* old=crw, write:add, read:add, close:xxx */
- { 0, 255 },
- /* old=crw, write:add, read:del, close: 0 */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write:add, read:del, close:add */
- { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write:add, read:del, close:del */
- { EPOLLOUT, EPOLL_CTL_MOD },
- /* old=crw, write:add, read:del, close:xxx */
- { 0, 255 },
- /* old=crw, write:add, read:xxx, close: 0 */
- { 0, 255 },
- /* old=crw, write:add, read:xxx, close:add */
- { 0, 255 },
- /* old=crw, write:add, read:xxx, close:del */
- { 0, 255 },
- /* old=crw, write:add, read:xxx, close:xxx */
- { 0, 255 },
- /* old=crw, write:del, read: 0, close: 0 */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write:del, read: 0, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write:del, read: 0, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old=crw, write:del, read: 0, close:xxx */
- { 0, 255 },
- /* old=crw, write:del, read:add, close: 0 */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write:del, read:add, close:add */
- { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write:del, read:add, close:del */
- { EPOLLIN, EPOLL_CTL_MOD },
- /* old=crw, write:del, read:add, close:xxx */
- { 0, 255 },
- /* old=crw, write:del, read:del, close: 0 */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write:del, read:del, close:add */
- { EPOLLRDHUP, EPOLL_CTL_MOD },
- /* old=crw, write:del, read:del, close:del */
- { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
- /* old=crw, write:del, read:del, close:xxx */
- { 0, 255 },
- /* old=crw, write:del, read:xxx, close: 0 */
- { 0, 255 },
- /* old=crw, write:del, read:xxx, close:add */
- { 0, 255 },
- /* old=crw, write:del, read:xxx, close:del */
- { 0, 255 },
- /* old=crw, write:del, read:xxx, close:xxx */
- { 0, 255 },
- /* old=crw, write:xxx, read: 0, close: 0 */
- { 0, 255 },
- /* old=crw, write:xxx, read: 0, close:add */
- { 0, 255 },
- /* old=crw, write:xxx, read: 0, close:del */
- { 0, 255 },
- /* old=crw, write:xxx, read: 0, close:xxx */
- { 0, 255 },
- /* old=crw, write:xxx, read:add, close: 0 */
- { 0, 255 },
- /* old=crw, write:xxx, read:add, close:add */
- { 0, 255 },
- /* old=crw, write:xxx, read:add, close:del */
- { 0, 255 },
- /* old=crw, write:xxx, read:add, close:xxx */
- { 0, 255 },
- /* old=crw, write:xxx, read:del, close: 0 */
- { 0, 255 },
- /* old=crw, write:xxx, read:del, close:add */
- { 0, 255 },
- /* old=crw, write:xxx, read:del, close:del */
- { 0, 255 },
- /* old=crw, write:xxx, read:del, close:xxx */
- { 0, 255 },
- /* old=crw, write:xxx, read:xxx, close: 0 */
- { 0, 255 },
- /* old=crw, write:xxx, read:xxx, close:add */
- { 0, 255 },
- /* old=crw, write:xxx, read:xxx, close:del */
- { 0, 255 },
- /* old=crw, write:xxx, read:xxx, close:xxx */
- { 0, 255 },
-};
-
-#endif
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef EPOLLTABLE_INTERNAL_H_INCLUDED_
+#define EPOLLTABLE_INTERNAL_H_INCLUDED_
+
+/*
+ Here are the values we're masking off to decide what operations to do.
+ Note that since EV_READ|EV_WRITE.
+
+ Note also that this table is a little sparse, since ADD+DEL is
+ nonsensical ("xxx" in the list below.)
+
+ Note also that we are shifting old_events by only 5 bits, since
+ EV_READ is 2 and EV_WRITE is 4.
+
+ The table was auto-generated with a python script, according to this
+ pseudocode:[*0]
+
+ If either the read or the write change is add+del:
+ This is impossible; Set op==-1, events=0.
+ Else, if either the read or the write change is add:
+ Set events to 0.
+ If the read change is add, or
+ (the read change is not del, and ev_read is in old_events):
+ Add EPOLLIN to events.
+ If the write change is add, or
+ (the write change is not del, and ev_write is in old_events):
+ Add EPOLLOUT to events.
+
+ If old_events is set:
+ Set op to EPOLL_CTL_MOD [*1,*2]
+ Else:
+ Set op to EPOLL_CTL_ADD [*3]
+
+ Else, if the read or the write change is del:
+ Set op to EPOLL_CTL_DEL.
+ If the read change is del:
+ If the write change is del:
+ Set events to EPOLLIN|EPOLLOUT
+ Else if ev_write is in old_events:
+ Set events to EPOLLOUT
+ Set op to EPOLL_CTL_MOD
+ Else
+ Set events to EPOLLIN
+ Else:
+ {The write change is del.}
+ If ev_read is in old_events:
+ Set events to EPOLLIN
+ Set op to EPOLL_CTL_MOD
+ Else:
+ Set the events to EPOLLOUT
+
+ Else:
+ There is no read or write change; set op to 0 and events to 0.
+
+ The logic is a little tricky, since we had no events set on the fd before,
+ we need to set op="ADD" and set events=the events we want to add. If we
+ had any events set on the fd before, and we want any events to remain on
+ the fd, we need to say op="MOD" and set events=the events we want to
+ remain. But if we want to delete the last event, we say op="DEL" and
+ set events=(any non-null pointer).
+
+ [*0] Actually, the Python script has gotten a bit more complicated, to
+ support EPOLLRDHUP.
+
+ [*1] This MOD is only a guess. MOD might fail with ENOENT if the file was
+ closed and a new file was opened with the same fd. If so, we'll retry
+ with ADD.
+
+ [*2] We can't replace this with a no-op even if old_events is the same as
+ the new events: if the file was closed and reopened, we need to retry
+ with an ADD. (We do a MOD in this case since "no change" is more
+ common than "close and reopen", so we'll usually wind up doing 1
+ syscalls instead of 2.)
+
+ [*3] This ADD is only a guess. There is a fun Linux kernel issue where if
+ you have two fds for the same file (via dup) and you ADD one to an
+ epfd, then close it, then re-create it with the same fd (via dup2 or an
+ unlucky dup), then try to ADD it again, you'll get an EEXIST, since the
+ struct epitem is not actually removed from the struct eventpoll until
+ the file itself is closed.
+
+ EV_CHANGE_ADD==1
+ EV_CHANGE_DEL==2
+ EV_READ ==2
+ EV_WRITE ==4
+ EV_CLOSED ==0x80
+
+ Bit 0: close change is add
+ Bit 1: close change is del
+ Bit 2: read change is add
+ Bit 3: read change is del
+ Bit 4: write change is add
+ Bit 5: write change is del
+ Bit 6: old events had EV_READ
+ Bit 7: old events had EV_WRITE
+ Bit 8: old events had EV_CLOSED
+*/
+
+#define EPOLL_OP_TABLE_INDEX(c) \
+ ( (((c)->close_change&(EV_CHANGE_ADD|EV_CHANGE_DEL))) | \
+ (((c)->read_change&(EV_CHANGE_ADD|EV_CHANGE_DEL)) << 2) | \
+ (((c)->write_change&(EV_CHANGE_ADD|EV_CHANGE_DEL)) << 4) | \
+ (((c)->old_events&(EV_READ|EV_WRITE)) << 5) | \
+ (((c)->old_events&(EV_CLOSED)) << 1) \
+ )
+
+#if EV_READ != 2 || EV_WRITE != 4 || EV_CLOSED != 0x80 || EV_CHANGE_ADD != 1 || EV_CHANGE_DEL != 2
+#error "Libevent's internals changed! Regenerate the op_table in epolltable-internal.h"
+#endif
+
+static const struct operation {
+ int events;
+ int op;
+} epoll_op_table[] = {
+ /* old= 0, write: 0, read: 0, close: 0 */
+ { 0, 0 },
+ /* old= 0, write: 0, read: 0, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_ADD },
+ /* old= 0, write: 0, read: 0, close:del */
+ { EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= 0, write: 0, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= 0, write: 0, read:add, close: 0 */
+ { EPOLLIN, EPOLL_CTL_ADD },
+ /* old= 0, write: 0, read:add, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_ADD },
+ /* old= 0, write: 0, read:add, close:del */
+ { EPOLLIN, EPOLL_CTL_ADD },
+ /* old= 0, write: 0, read:add, close:xxx */
+ { 0, 255 },
+ /* old= 0, write: 0, read:del, close: 0 */
+ { EPOLLIN, EPOLL_CTL_DEL },
+ /* old= 0, write: 0, read:del, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_ADD },
+ /* old= 0, write: 0, read:del, close:del */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= 0, write: 0, read:del, close:xxx */
+ { 0, 255 },
+ /* old= 0, write: 0, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= 0, write: 0, read:xxx, close:add */
+ { 0, 255 },
+ /* old= 0, write: 0, read:xxx, close:del */
+ { 0, 255 },
+ /* old= 0, write: 0, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= 0, write:add, read: 0, close: 0 */
+ { EPOLLOUT, EPOLL_CTL_ADD },
+ /* old= 0, write:add, read: 0, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_ADD },
+ /* old= 0, write:add, read: 0, close:del */
+ { EPOLLOUT, EPOLL_CTL_ADD },
+ /* old= 0, write:add, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= 0, write:add, read:add, close: 0 */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_ADD },
+ /* old= 0, write:add, read:add, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_ADD },
+ /* old= 0, write:add, read:add, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_ADD },
+ /* old= 0, write:add, read:add, close:xxx */
+ { 0, 255 },
+ /* old= 0, write:add, read:del, close: 0 */
+ { EPOLLOUT, EPOLL_CTL_ADD },
+ /* old= 0, write:add, read:del, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_ADD },
+ /* old= 0, write:add, read:del, close:del */
+ { EPOLLOUT, EPOLL_CTL_ADD },
+ /* old= 0, write:add, read:del, close:xxx */
+ { 0, 255 },
+ /* old= 0, write:add, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= 0, write:add, read:xxx, close:add */
+ { 0, 255 },
+ /* old= 0, write:add, read:xxx, close:del */
+ { 0, 255 },
+ /* old= 0, write:add, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= 0, write:del, read: 0, close: 0 */
+ { EPOLLOUT, EPOLL_CTL_DEL },
+ /* old= 0, write:del, read: 0, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_ADD },
+ /* old= 0, write:del, read: 0, close:del */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= 0, write:del, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= 0, write:del, read:add, close: 0 */
+ { EPOLLIN, EPOLL_CTL_ADD },
+ /* old= 0, write:del, read:add, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_ADD },
+ /* old= 0, write:del, read:add, close:del */
+ { EPOLLIN, EPOLL_CTL_ADD },
+ /* old= 0, write:del, read:add, close:xxx */
+ { 0, 255 },
+ /* old= 0, write:del, read:del, close: 0 */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_DEL },
+ /* old= 0, write:del, read:del, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_ADD },
+ /* old= 0, write:del, read:del, close:del */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= 0, write:del, read:del, close:xxx */
+ { 0, 255 },
+ /* old= 0, write:del, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= 0, write:del, read:xxx, close:add */
+ { 0, 255 },
+ /* old= 0, write:del, read:xxx, close:del */
+ { 0, 255 },
+ /* old= 0, write:del, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= 0, write:xxx, read: 0, close: 0 */
+ { 0, 255 },
+ /* old= 0, write:xxx, read: 0, close:add */
+ { 0, 255 },
+ /* old= 0, write:xxx, read: 0, close:del */
+ { 0, 255 },
+ /* old= 0, write:xxx, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= 0, write:xxx, read:add, close: 0 */
+ { 0, 255 },
+ /* old= 0, write:xxx, read:add, close:add */
+ { 0, 255 },
+ /* old= 0, write:xxx, read:add, close:del */
+ { 0, 255 },
+ /* old= 0, write:xxx, read:add, close:xxx */
+ { 0, 255 },
+ /* old= 0, write:xxx, read:del, close: 0 */
+ { 0, 255 },
+ /* old= 0, write:xxx, read:del, close:add */
+ { 0, 255 },
+ /* old= 0, write:xxx, read:del, close:del */
+ { 0, 255 },
+ /* old= 0, write:xxx, read:del, close:xxx */
+ { 0, 255 },
+ /* old= 0, write:xxx, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= 0, write:xxx, read:xxx, close:add */
+ { 0, 255 },
+ /* old= 0, write:xxx, read:xxx, close:del */
+ { 0, 255 },
+ /* old= 0, write:xxx, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= r, write: 0, read: 0, close: 0 */
+ { 0, 0 },
+ /* old= r, write: 0, read: 0, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= r, write: 0, read: 0, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= r, write: 0, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= r, write: 0, read:add, close: 0 */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= r, write: 0, read:add, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= r, write: 0, read:add, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= r, write: 0, read:add, close:xxx */
+ { 0, 255 },
+ /* old= r, write: 0, read:del, close: 0 */
+ { EPOLLIN, EPOLL_CTL_DEL },
+ /* old= r, write: 0, read:del, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= r, write: 0, read:del, close:del */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= r, write: 0, read:del, close:xxx */
+ { 0, 255 },
+ /* old= r, write: 0, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= r, write: 0, read:xxx, close:add */
+ { 0, 255 },
+ /* old= r, write: 0, read:xxx, close:del */
+ { 0, 255 },
+ /* old= r, write: 0, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= r, write:add, read: 0, close: 0 */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= r, write:add, read: 0, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= r, write:add, read: 0, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= r, write:add, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= r, write:add, read:add, close: 0 */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= r, write:add, read:add, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= r, write:add, read:add, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= r, write:add, read:add, close:xxx */
+ { 0, 255 },
+ /* old= r, write:add, read:del, close: 0 */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= r, write:add, read:del, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= r, write:add, read:del, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= r, write:add, read:del, close:xxx */
+ { 0, 255 },
+ /* old= r, write:add, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= r, write:add, read:xxx, close:add */
+ { 0, 255 },
+ /* old= r, write:add, read:xxx, close:del */
+ { 0, 255 },
+ /* old= r, write:add, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= r, write:del, read: 0, close: 0 */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= r, write:del, read: 0, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= r, write:del, read: 0, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= r, write:del, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= r, write:del, read:add, close: 0 */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= r, write:del, read:add, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= r, write:del, read:add, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= r, write:del, read:add, close:xxx */
+ { 0, 255 },
+ /* old= r, write:del, read:del, close: 0 */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_DEL },
+ /* old= r, write:del, read:del, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= r, write:del, read:del, close:del */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= r, write:del, read:del, close:xxx */
+ { 0, 255 },
+ /* old= r, write:del, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= r, write:del, read:xxx, close:add */
+ { 0, 255 },
+ /* old= r, write:del, read:xxx, close:del */
+ { 0, 255 },
+ /* old= r, write:del, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= r, write:xxx, read: 0, close: 0 */
+ { 0, 255 },
+ /* old= r, write:xxx, read: 0, close:add */
+ { 0, 255 },
+ /* old= r, write:xxx, read: 0, close:del */
+ { 0, 255 },
+ /* old= r, write:xxx, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= r, write:xxx, read:add, close: 0 */
+ { 0, 255 },
+ /* old= r, write:xxx, read:add, close:add */
+ { 0, 255 },
+ /* old= r, write:xxx, read:add, close:del */
+ { 0, 255 },
+ /* old= r, write:xxx, read:add, close:xxx */
+ { 0, 255 },
+ /* old= r, write:xxx, read:del, close: 0 */
+ { 0, 255 },
+ /* old= r, write:xxx, read:del, close:add */
+ { 0, 255 },
+ /* old= r, write:xxx, read:del, close:del */
+ { 0, 255 },
+ /* old= r, write:xxx, read:del, close:xxx */
+ { 0, 255 },
+ /* old= r, write:xxx, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= r, write:xxx, read:xxx, close:add */
+ { 0, 255 },
+ /* old= r, write:xxx, read:xxx, close:del */
+ { 0, 255 },
+ /* old= r, write:xxx, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= w, write: 0, read: 0, close: 0 */
+ { 0, 0 },
+ /* old= w, write: 0, read: 0, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= w, write: 0, read: 0, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= w, write: 0, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= w, write: 0, read:add, close: 0 */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= w, write: 0, read:add, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= w, write: 0, read:add, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= w, write: 0, read:add, close:xxx */
+ { 0, 255 },
+ /* old= w, write: 0, read:del, close: 0 */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= w, write: 0, read:del, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= w, write: 0, read:del, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= w, write: 0, read:del, close:xxx */
+ { 0, 255 },
+ /* old= w, write: 0, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= w, write: 0, read:xxx, close:add */
+ { 0, 255 },
+ /* old= w, write: 0, read:xxx, close:del */
+ { 0, 255 },
+ /* old= w, write: 0, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= w, write:add, read: 0, close: 0 */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= w, write:add, read: 0, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= w, write:add, read: 0, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= w, write:add, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= w, write:add, read:add, close: 0 */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= w, write:add, read:add, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= w, write:add, read:add, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= w, write:add, read:add, close:xxx */
+ { 0, 255 },
+ /* old= w, write:add, read:del, close: 0 */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= w, write:add, read:del, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= w, write:add, read:del, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= w, write:add, read:del, close:xxx */
+ { 0, 255 },
+ /* old= w, write:add, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= w, write:add, read:xxx, close:add */
+ { 0, 255 },
+ /* old= w, write:add, read:xxx, close:del */
+ { 0, 255 },
+ /* old= w, write:add, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= w, write:del, read: 0, close: 0 */
+ { EPOLLOUT, EPOLL_CTL_DEL },
+ /* old= w, write:del, read: 0, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= w, write:del, read: 0, close:del */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= w, write:del, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= w, write:del, read:add, close: 0 */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= w, write:del, read:add, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= w, write:del, read:add, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= w, write:del, read:add, close:xxx */
+ { 0, 255 },
+ /* old= w, write:del, read:del, close: 0 */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_DEL },
+ /* old= w, write:del, read:del, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= w, write:del, read:del, close:del */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= w, write:del, read:del, close:xxx */
+ { 0, 255 },
+ /* old= w, write:del, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= w, write:del, read:xxx, close:add */
+ { 0, 255 },
+ /* old= w, write:del, read:xxx, close:del */
+ { 0, 255 },
+ /* old= w, write:del, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= w, write:xxx, read: 0, close: 0 */
+ { 0, 255 },
+ /* old= w, write:xxx, read: 0, close:add */
+ { 0, 255 },
+ /* old= w, write:xxx, read: 0, close:del */
+ { 0, 255 },
+ /* old= w, write:xxx, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= w, write:xxx, read:add, close: 0 */
+ { 0, 255 },
+ /* old= w, write:xxx, read:add, close:add */
+ { 0, 255 },
+ /* old= w, write:xxx, read:add, close:del */
+ { 0, 255 },
+ /* old= w, write:xxx, read:add, close:xxx */
+ { 0, 255 },
+ /* old= w, write:xxx, read:del, close: 0 */
+ { 0, 255 },
+ /* old= w, write:xxx, read:del, close:add */
+ { 0, 255 },
+ /* old= w, write:xxx, read:del, close:del */
+ { 0, 255 },
+ /* old= w, write:xxx, read:del, close:xxx */
+ { 0, 255 },
+ /* old= w, write:xxx, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= w, write:xxx, read:xxx, close:add */
+ { 0, 255 },
+ /* old= w, write:xxx, read:xxx, close:del */
+ { 0, 255 },
+ /* old= w, write:xxx, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= rw, write: 0, read: 0, close: 0 */
+ { 0, 0 },
+ /* old= rw, write: 0, read: 0, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= rw, write: 0, read: 0, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= rw, write: 0, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= rw, write: 0, read:add, close: 0 */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= rw, write: 0, read:add, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= rw, write: 0, read:add, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= rw, write: 0, read:add, close:xxx */
+ { 0, 255 },
+ /* old= rw, write: 0, read:del, close: 0 */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= rw, write: 0, read:del, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= rw, write: 0, read:del, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= rw, write: 0, read:del, close:xxx */
+ { 0, 255 },
+ /* old= rw, write: 0, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= rw, write: 0, read:xxx, close:add */
+ { 0, 255 },
+ /* old= rw, write: 0, read:xxx, close:del */
+ { 0, 255 },
+ /* old= rw, write: 0, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= rw, write:add, read: 0, close: 0 */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= rw, write:add, read: 0, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= rw, write:add, read: 0, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= rw, write:add, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= rw, write:add, read:add, close: 0 */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= rw, write:add, read:add, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= rw, write:add, read:add, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= rw, write:add, read:add, close:xxx */
+ { 0, 255 },
+ /* old= rw, write:add, read:del, close: 0 */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= rw, write:add, read:del, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= rw, write:add, read:del, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= rw, write:add, read:del, close:xxx */
+ { 0, 255 },
+ /* old= rw, write:add, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= rw, write:add, read:xxx, close:add */
+ { 0, 255 },
+ /* old= rw, write:add, read:xxx, close:del */
+ { 0, 255 },
+ /* old= rw, write:add, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= rw, write:del, read: 0, close: 0 */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= rw, write:del, read: 0, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= rw, write:del, read: 0, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= rw, write:del, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= rw, write:del, read:add, close: 0 */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= rw, write:del, read:add, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= rw, write:del, read:add, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= rw, write:del, read:add, close:xxx */
+ { 0, 255 },
+ /* old= rw, write:del, read:del, close: 0 */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_DEL },
+ /* old= rw, write:del, read:del, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= rw, write:del, read:del, close:del */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= rw, write:del, read:del, close:xxx */
+ { 0, 255 },
+ /* old= rw, write:del, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= rw, write:del, read:xxx, close:add */
+ { 0, 255 },
+ /* old= rw, write:del, read:xxx, close:del */
+ { 0, 255 },
+ /* old= rw, write:del, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= rw, write:xxx, read: 0, close: 0 */
+ { 0, 255 },
+ /* old= rw, write:xxx, read: 0, close:add */
+ { 0, 255 },
+ /* old= rw, write:xxx, read: 0, close:del */
+ { 0, 255 },
+ /* old= rw, write:xxx, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= rw, write:xxx, read:add, close: 0 */
+ { 0, 255 },
+ /* old= rw, write:xxx, read:add, close:add */
+ { 0, 255 },
+ /* old= rw, write:xxx, read:add, close:del */
+ { 0, 255 },
+ /* old= rw, write:xxx, read:add, close:xxx */
+ { 0, 255 },
+ /* old= rw, write:xxx, read:del, close: 0 */
+ { 0, 255 },
+ /* old= rw, write:xxx, read:del, close:add */
+ { 0, 255 },
+ /* old= rw, write:xxx, read:del, close:del */
+ { 0, 255 },
+ /* old= rw, write:xxx, read:del, close:xxx */
+ { 0, 255 },
+ /* old= rw, write:xxx, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= rw, write:xxx, read:xxx, close:add */
+ { 0, 255 },
+ /* old= rw, write:xxx, read:xxx, close:del */
+ { 0, 255 },
+ /* old= rw, write:xxx, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= c, write: 0, read: 0, close: 0 */
+ { 0, 0 },
+ /* old= c, write: 0, read: 0, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write: 0, read: 0, close:del */
+ { EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= c, write: 0, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= c, write: 0, read:add, close: 0 */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write: 0, read:add, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write: 0, read:add, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= c, write: 0, read:add, close:xxx */
+ { 0, 255 },
+ /* old= c, write: 0, read:del, close: 0 */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write: 0, read:del, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write: 0, read:del, close:del */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= c, write: 0, read:del, close:xxx */
+ { 0, 255 },
+ /* old= c, write: 0, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= c, write: 0, read:xxx, close:add */
+ { 0, 255 },
+ /* old= c, write: 0, read:xxx, close:del */
+ { 0, 255 },
+ /* old= c, write: 0, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= c, write:add, read: 0, close: 0 */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write:add, read: 0, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write:add, read: 0, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= c, write:add, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= c, write:add, read:add, close: 0 */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write:add, read:add, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write:add, read:add, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= c, write:add, read:add, close:xxx */
+ { 0, 255 },
+ /* old= c, write:add, read:del, close: 0 */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write:add, read:del, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write:add, read:del, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= c, write:add, read:del, close:xxx */
+ { 0, 255 },
+ /* old= c, write:add, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= c, write:add, read:xxx, close:add */
+ { 0, 255 },
+ /* old= c, write:add, read:xxx, close:del */
+ { 0, 255 },
+ /* old= c, write:add, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= c, write:del, read: 0, close: 0 */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write:del, read: 0, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write:del, read: 0, close:del */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= c, write:del, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= c, write:del, read:add, close: 0 */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write:del, read:add, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write:del, read:add, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= c, write:del, read:add, close:xxx */
+ { 0, 255 },
+ /* old= c, write:del, read:del, close: 0 */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write:del, read:del, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= c, write:del, read:del, close:del */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= c, write:del, read:del, close:xxx */
+ { 0, 255 },
+ /* old= c, write:del, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= c, write:del, read:xxx, close:add */
+ { 0, 255 },
+ /* old= c, write:del, read:xxx, close:del */
+ { 0, 255 },
+ /* old= c, write:del, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= c, write:xxx, read: 0, close: 0 */
+ { 0, 255 },
+ /* old= c, write:xxx, read: 0, close:add */
+ { 0, 255 },
+ /* old= c, write:xxx, read: 0, close:del */
+ { 0, 255 },
+ /* old= c, write:xxx, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= c, write:xxx, read:add, close: 0 */
+ { 0, 255 },
+ /* old= c, write:xxx, read:add, close:add */
+ { 0, 255 },
+ /* old= c, write:xxx, read:add, close:del */
+ { 0, 255 },
+ /* old= c, write:xxx, read:add, close:xxx */
+ { 0, 255 },
+ /* old= c, write:xxx, read:del, close: 0 */
+ { 0, 255 },
+ /* old= c, write:xxx, read:del, close:add */
+ { 0, 255 },
+ /* old= c, write:xxx, read:del, close:del */
+ { 0, 255 },
+ /* old= c, write:xxx, read:del, close:xxx */
+ { 0, 255 },
+ /* old= c, write:xxx, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= c, write:xxx, read:xxx, close:add */
+ { 0, 255 },
+ /* old= c, write:xxx, read:xxx, close:del */
+ { 0, 255 },
+ /* old= c, write:xxx, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= cr, write: 0, read: 0, close: 0 */
+ { 0, 0 },
+ /* old= cr, write: 0, read: 0, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write: 0, read: 0, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= cr, write: 0, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= cr, write: 0, read:add, close: 0 */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write: 0, read:add, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write: 0, read:add, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= cr, write: 0, read:add, close:xxx */
+ { 0, 255 },
+ /* old= cr, write: 0, read:del, close: 0 */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write: 0, read:del, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write: 0, read:del, close:del */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= cr, write: 0, read:del, close:xxx */
+ { 0, 255 },
+ /* old= cr, write: 0, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= cr, write: 0, read:xxx, close:add */
+ { 0, 255 },
+ /* old= cr, write: 0, read:xxx, close:del */
+ { 0, 255 },
+ /* old= cr, write: 0, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= cr, write:add, read: 0, close: 0 */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write:add, read: 0, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write:add, read: 0, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= cr, write:add, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= cr, write:add, read:add, close: 0 */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write:add, read:add, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write:add, read:add, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= cr, write:add, read:add, close:xxx */
+ { 0, 255 },
+ /* old= cr, write:add, read:del, close: 0 */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write:add, read:del, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write:add, read:del, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= cr, write:add, read:del, close:xxx */
+ { 0, 255 },
+ /* old= cr, write:add, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= cr, write:add, read:xxx, close:add */
+ { 0, 255 },
+ /* old= cr, write:add, read:xxx, close:del */
+ { 0, 255 },
+ /* old= cr, write:add, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= cr, write:del, read: 0, close: 0 */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write:del, read: 0, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write:del, read: 0, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= cr, write:del, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= cr, write:del, read:add, close: 0 */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write:del, read:add, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write:del, read:add, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= cr, write:del, read:add, close:xxx */
+ { 0, 255 },
+ /* old= cr, write:del, read:del, close: 0 */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write:del, read:del, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cr, write:del, read:del, close:del */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= cr, write:del, read:del, close:xxx */
+ { 0, 255 },
+ /* old= cr, write:del, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= cr, write:del, read:xxx, close:add */
+ { 0, 255 },
+ /* old= cr, write:del, read:xxx, close:del */
+ { 0, 255 },
+ /* old= cr, write:del, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= cr, write:xxx, read: 0, close: 0 */
+ { 0, 255 },
+ /* old= cr, write:xxx, read: 0, close:add */
+ { 0, 255 },
+ /* old= cr, write:xxx, read: 0, close:del */
+ { 0, 255 },
+ /* old= cr, write:xxx, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= cr, write:xxx, read:add, close: 0 */
+ { 0, 255 },
+ /* old= cr, write:xxx, read:add, close:add */
+ { 0, 255 },
+ /* old= cr, write:xxx, read:add, close:del */
+ { 0, 255 },
+ /* old= cr, write:xxx, read:add, close:xxx */
+ { 0, 255 },
+ /* old= cr, write:xxx, read:del, close: 0 */
+ { 0, 255 },
+ /* old= cr, write:xxx, read:del, close:add */
+ { 0, 255 },
+ /* old= cr, write:xxx, read:del, close:del */
+ { 0, 255 },
+ /* old= cr, write:xxx, read:del, close:xxx */
+ { 0, 255 },
+ /* old= cr, write:xxx, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= cr, write:xxx, read:xxx, close:add */
+ { 0, 255 },
+ /* old= cr, write:xxx, read:xxx, close:del */
+ { 0, 255 },
+ /* old= cr, write:xxx, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= cw, write: 0, read: 0, close: 0 */
+ { 0, 0 },
+ /* old= cw, write: 0, read: 0, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write: 0, read: 0, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= cw, write: 0, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= cw, write: 0, read:add, close: 0 */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write: 0, read:add, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write: 0, read:add, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= cw, write: 0, read:add, close:xxx */
+ { 0, 255 },
+ /* old= cw, write: 0, read:del, close: 0 */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write: 0, read:del, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write: 0, read:del, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= cw, write: 0, read:del, close:xxx */
+ { 0, 255 },
+ /* old= cw, write: 0, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= cw, write: 0, read:xxx, close:add */
+ { 0, 255 },
+ /* old= cw, write: 0, read:xxx, close:del */
+ { 0, 255 },
+ /* old= cw, write: 0, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= cw, write:add, read: 0, close: 0 */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write:add, read: 0, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write:add, read: 0, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= cw, write:add, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= cw, write:add, read:add, close: 0 */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write:add, read:add, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write:add, read:add, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= cw, write:add, read:add, close:xxx */
+ { 0, 255 },
+ /* old= cw, write:add, read:del, close: 0 */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write:add, read:del, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write:add, read:del, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old= cw, write:add, read:del, close:xxx */
+ { 0, 255 },
+ /* old= cw, write:add, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= cw, write:add, read:xxx, close:add */
+ { 0, 255 },
+ /* old= cw, write:add, read:xxx, close:del */
+ { 0, 255 },
+ /* old= cw, write:add, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= cw, write:del, read: 0, close: 0 */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write:del, read: 0, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write:del, read: 0, close:del */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= cw, write:del, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= cw, write:del, read:add, close: 0 */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write:del, read:add, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write:del, read:add, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old= cw, write:del, read:add, close:xxx */
+ { 0, 255 },
+ /* old= cw, write:del, read:del, close: 0 */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write:del, read:del, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old= cw, write:del, read:del, close:del */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old= cw, write:del, read:del, close:xxx */
+ { 0, 255 },
+ /* old= cw, write:del, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= cw, write:del, read:xxx, close:add */
+ { 0, 255 },
+ /* old= cw, write:del, read:xxx, close:del */
+ { 0, 255 },
+ /* old= cw, write:del, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old= cw, write:xxx, read: 0, close: 0 */
+ { 0, 255 },
+ /* old= cw, write:xxx, read: 0, close:add */
+ { 0, 255 },
+ /* old= cw, write:xxx, read: 0, close:del */
+ { 0, 255 },
+ /* old= cw, write:xxx, read: 0, close:xxx */
+ { 0, 255 },
+ /* old= cw, write:xxx, read:add, close: 0 */
+ { 0, 255 },
+ /* old= cw, write:xxx, read:add, close:add */
+ { 0, 255 },
+ /* old= cw, write:xxx, read:add, close:del */
+ { 0, 255 },
+ /* old= cw, write:xxx, read:add, close:xxx */
+ { 0, 255 },
+ /* old= cw, write:xxx, read:del, close: 0 */
+ { 0, 255 },
+ /* old= cw, write:xxx, read:del, close:add */
+ { 0, 255 },
+ /* old= cw, write:xxx, read:del, close:del */
+ { 0, 255 },
+ /* old= cw, write:xxx, read:del, close:xxx */
+ { 0, 255 },
+ /* old= cw, write:xxx, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old= cw, write:xxx, read:xxx, close:add */
+ { 0, 255 },
+ /* old= cw, write:xxx, read:xxx, close:del */
+ { 0, 255 },
+ /* old= cw, write:xxx, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old=crw, write: 0, read: 0, close: 0 */
+ { 0, 0 },
+ /* old=crw, write: 0, read: 0, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write: 0, read: 0, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old=crw, write: 0, read: 0, close:xxx */
+ { 0, 255 },
+ /* old=crw, write: 0, read:add, close: 0 */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write: 0, read:add, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write: 0, read:add, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old=crw, write: 0, read:add, close:xxx */
+ { 0, 255 },
+ /* old=crw, write: 0, read:del, close: 0 */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write: 0, read:del, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write: 0, read:del, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old=crw, write: 0, read:del, close:xxx */
+ { 0, 255 },
+ /* old=crw, write: 0, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old=crw, write: 0, read:xxx, close:add */
+ { 0, 255 },
+ /* old=crw, write: 0, read:xxx, close:del */
+ { 0, 255 },
+ /* old=crw, write: 0, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old=crw, write:add, read: 0, close: 0 */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write:add, read: 0, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write:add, read: 0, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old=crw, write:add, read: 0, close:xxx */
+ { 0, 255 },
+ /* old=crw, write:add, read:add, close: 0 */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write:add, read:add, close:add */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write:add, read:add, close:del */
+ { EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
+ /* old=crw, write:add, read:add, close:xxx */
+ { 0, 255 },
+ /* old=crw, write:add, read:del, close: 0 */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write:add, read:del, close:add */
+ { EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write:add, read:del, close:del */
+ { EPOLLOUT, EPOLL_CTL_MOD },
+ /* old=crw, write:add, read:del, close:xxx */
+ { 0, 255 },
+ /* old=crw, write:add, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old=crw, write:add, read:xxx, close:add */
+ { 0, 255 },
+ /* old=crw, write:add, read:xxx, close:del */
+ { 0, 255 },
+ /* old=crw, write:add, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old=crw, write:del, read: 0, close: 0 */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write:del, read: 0, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write:del, read: 0, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old=crw, write:del, read: 0, close:xxx */
+ { 0, 255 },
+ /* old=crw, write:del, read:add, close: 0 */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write:del, read:add, close:add */
+ { EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write:del, read:add, close:del */
+ { EPOLLIN, EPOLL_CTL_MOD },
+ /* old=crw, write:del, read:add, close:xxx */
+ { 0, 255 },
+ /* old=crw, write:del, read:del, close: 0 */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write:del, read:del, close:add */
+ { EPOLLRDHUP, EPOLL_CTL_MOD },
+ /* old=crw, write:del, read:del, close:del */
+ { EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
+ /* old=crw, write:del, read:del, close:xxx */
+ { 0, 255 },
+ /* old=crw, write:del, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old=crw, write:del, read:xxx, close:add */
+ { 0, 255 },
+ /* old=crw, write:del, read:xxx, close:del */
+ { 0, 255 },
+ /* old=crw, write:del, read:xxx, close:xxx */
+ { 0, 255 },
+ /* old=crw, write:xxx, read: 0, close: 0 */
+ { 0, 255 },
+ /* old=crw, write:xxx, read: 0, close:add */
+ { 0, 255 },
+ /* old=crw, write:xxx, read: 0, close:del */
+ { 0, 255 },
+ /* old=crw, write:xxx, read: 0, close:xxx */
+ { 0, 255 },
+ /* old=crw, write:xxx, read:add, close: 0 */
+ { 0, 255 },
+ /* old=crw, write:xxx, read:add, close:add */
+ { 0, 255 },
+ /* old=crw, write:xxx, read:add, close:del */
+ { 0, 255 },
+ /* old=crw, write:xxx, read:add, close:xxx */
+ { 0, 255 },
+ /* old=crw, write:xxx, read:del, close: 0 */
+ { 0, 255 },
+ /* old=crw, write:xxx, read:del, close:add */
+ { 0, 255 },
+ /* old=crw, write:xxx, read:del, close:del */
+ { 0, 255 },
+ /* old=crw, write:xxx, read:del, close:xxx */
+ { 0, 255 },
+ /* old=crw, write:xxx, read:xxx, close: 0 */
+ { 0, 255 },
+ /* old=crw, write:xxx, read:xxx, close:add */
+ { 0, 255 },
+ /* old=crw, write:xxx, read:xxx, close:del */
+ { 0, 255 },
+ /* old=crw, write:xxx, read:xxx, close:xxx */
+ { 0, 255 },
+};
+
+#endif
diff --git a/contrib/libs/libevent/evbuffer-internal.h b/contrib/libs/libevent/evbuffer-internal.h
index d09b4f1ddd..815305c99c 100644
--- a/contrib/libs/libevent/evbuffer-internal.h
+++ b/contrib/libs/libevent/evbuffer-internal.h
@@ -24,17 +24,17 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVBUFFER_INTERNAL_H_INCLUDED_
-#define EVBUFFER_INTERNAL_H_INCLUDED_
+#ifndef EVBUFFER_INTERNAL_H_INCLUDED_
+#define EVBUFFER_INTERNAL_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
#endif
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
#include "event2/util.h"
-#include "event2/event_struct.h"
+#include "event2/event_struct.h"
#include "util-internal.h"
#include "defer-internal.h"
@@ -43,7 +43,7 @@ extern "C" {
* arguments. */
#define EVBUFFER_CB_NODEFER 2
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
#include <sys/queue.h>
@@ -51,7 +51,7 @@ extern "C" {
/* Minimum allocation for a chain. We define this so that we're burning no
* more than 5% of each allocation on overhead. It would be nice to lose even
* less space, though. */
-#if EVENT__SIZEOF_VOID_P < 8
+#if EVENT__SIZEOF_VOID_P < 8
#define MIN_BUFFER_SIZE 512
#else
#define MIN_BUFFER_SIZE 1024
@@ -61,7 +61,7 @@ extern "C" {
* when bytes are added to or removed from the evbuffer. */
struct evbuffer_cb_entry {
/** Structures to implement a doubly-linked queue of callbacks */
- LIST_ENTRY(evbuffer_cb_entry) next;
+ LIST_ENTRY(evbuffer_cb_entry) next;
/** The callback function to invoke when this callback is called.
If EVBUFFER_CB_OBSOLETE is set in flags, the cb_obsolete field is
valid; otherwise, cb_func is valid. */
@@ -92,7 +92,7 @@ struct evbuffer {
* If the buffer has no chains, it is NULL.
*
* The last_with_datap pointer points at _whatever 'next' pointer_
- * pointing at the last_with_data chain. If the last_with_data chain
+ * pointing at the last_with_data chain. If the last_with_data chain
* is the first chain, or it is NULL, then the last_with_datap pointer
* is &buf->first.
*/
@@ -108,7 +108,7 @@ struct evbuffer {
* tried to invoke callbacks. */
size_t n_del_for_cb;
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
/** A lock used to mediate access to this buffer. */
void *lock;
#endif
@@ -127,7 +127,7 @@ struct evbuffer {
* overflows when we have mutually recursive callbacks, and for
* serializing callbacks in a single thread. */
unsigned deferred_cbs : 1;
-#ifdef _WIN32
+#ifdef _WIN32
/** True iff this buffer is set up for overlapped IO. */
unsigned is_overlapped : 1;
#endif
@@ -135,7 +135,7 @@ struct evbuffer {
ev_uint32_t flags;
/** Used to implement deferred callbacks. */
- struct event_base *cb_queue;
+ struct event_base *cb_queue;
/** A reference count on this evbuffer. When the reference count
* reaches 0, the buffer is destroyed. Manipulated with
@@ -143,24 +143,24 @@ struct evbuffer {
* evbuffer_free. */
int refcnt;
- /** A struct event_callback handle to make all of this buffer's callbacks
+ /** A struct event_callback handle to make all of this buffer's callbacks
* invoked from the event loop. */
- struct event_callback deferred;
+ struct event_callback deferred;
/** A doubly-linked-list of callback functions */
- LIST_HEAD(evbuffer_cb_queue, evbuffer_cb_entry) callbacks;
+ LIST_HEAD(evbuffer_cb_queue, evbuffer_cb_entry) callbacks;
/** The parent bufferevent object this evbuffer belongs to.
* NULL if the evbuffer stands alone. */
struct bufferevent *parent;
};
-#if EVENT__SIZEOF_OFF_T < EVENT__SIZEOF_SIZE_T
+#if EVENT__SIZEOF_OFF_T < EVENT__SIZEOF_SIZE_T
typedef ev_ssize_t ev_misalign_t;
#define EVBUFFER_CHAIN_MAX ((size_t)EV_SSIZE_MAX)
#else
typedef ev_off_t ev_misalign_t;
-#if EVENT__SIZEOF_OFF_T > EVENT__SIZEOF_SIZE_T
+#if EVENT__SIZEOF_OFF_T > EVENT__SIZEOF_SIZE_T
#define EVBUFFER_CHAIN_MAX EV_SIZE_MAX
#else
#define EVBUFFER_CHAIN_MAX ((size_t)EV_SSIZE_MAX)
@@ -186,8 +186,8 @@ struct evbuffer_chain {
/** Set if special handling is required for this chain */
unsigned flags;
-#define EVBUFFER_FILESEGMENT 0x0001 /**< A chain used for a file segment */
-#define EVBUFFER_SENDFILE 0x0002 /**< a chain used with sendfile */
+#define EVBUFFER_FILESEGMENT 0x0001 /**< A chain used for a file segment */
+#define EVBUFFER_SENDFILE 0x0002 /**< a chain used with sendfile */
#define EVBUFFER_REFERENCE 0x0004 /**< a chain with a mem reference */
#define EVBUFFER_IMMUTABLE 0x0008 /**< read-only chain */
/** a chain that mustn't be reallocated or freed, or have its contents
@@ -198,12 +198,12 @@ struct evbuffer_chain {
/** a chain that should be freed, but can't be freed until it is
* un-pinned. */
#define EVBUFFER_DANGLING 0x0040
- /** a chain that is a referenced copy of another chain */
-#define EVBUFFER_MULTICAST 0x0080
-
- /** number of references to this chain */
- int refcnt;
+ /** a chain that is a referenced copy of another chain */
+#define EVBUFFER_MULTICAST 0x0080
+ /** number of references to this chain */
+ int refcnt;
+
/** Usually points to the read-write memory belonging to this
* buffer allocated as part of the evbuffer_chain allocation.
* For mmap, this can be a read-only buffer and
@@ -213,67 +213,67 @@ struct evbuffer_chain {
unsigned char *buffer;
};
-/** callback for a reference chain; lets us know what to do with it when
- * we're done with it. Lives at the end of an evbuffer_chain with the
- * EVBUFFER_REFERENCE flag set */
+/** callback for a reference chain; lets us know what to do with it when
+ * we're done with it. Lives at the end of an evbuffer_chain with the
+ * EVBUFFER_REFERENCE flag set */
struct evbuffer_chain_reference {
evbuffer_ref_cleanup_cb cleanupfn;
void *extra;
};
-/** File segment for a file-segment chain. Lives at the end of an
- * evbuffer_chain with the EVBUFFER_FILESEGMENT flag set. */
-struct evbuffer_chain_file_segment {
- struct evbuffer_file_segment *segment;
-#ifdef _WIN32
- /** If we're using CreateFileMapping, this is the handle to the view. */
- HANDLE view_handle;
-#endif
-};
-
-/* Declared in event2/buffer.h; defined here. */
-struct evbuffer_file_segment {
- void *lock; /**< lock prevent concurrent access to refcnt */
- int refcnt; /**< Reference count for this file segment */
- unsigned flags; /**< combination of EVBUF_FS_* flags */
-
- /** What kind of file segment is this? */
- unsigned can_sendfile : 1;
- unsigned is_mapping : 1;
-
- /** The fd that we read the data from. */
- int fd;
- /** If we're using mmap, this is the raw mapped memory. */
- void *mapping;
-#ifdef _WIN32
- /** If we're using CreateFileMapping, this is the mapping */
- HANDLE mapping_handle;
-#endif
- /** If we're using mmap or IO, this is the content of the file
- * segment. */
- char *contents;
- /** Position of this segment within the file. */
- ev_off_t file_offset;
- /** If we're using mmap, this is the offset within 'mapping' where
- * this data segment begins. */
- ev_off_t mmap_offset;
- /** The length of this segment. */
- ev_off_t length;
- /** Cleanup callback function */
- evbuffer_file_segment_cleanup_cb cleanup_cb;
- /** Argument to be pass to cleanup callback function */
- void *cleanup_cb_arg;
-};
-
-/** Information about the multicast parent of a chain. Lives at the
- * end of an evbuffer_chain with the EVBUFFER_MULTICAST flag set. */
-struct evbuffer_multicast_parent {
- /** source buffer the multicast parent belongs to */
- struct evbuffer *source;
- /** multicast parent for this chain */
- struct evbuffer_chain *parent;
-};
-
+/** File segment for a file-segment chain. Lives at the end of an
+ * evbuffer_chain with the EVBUFFER_FILESEGMENT flag set. */
+struct evbuffer_chain_file_segment {
+ struct evbuffer_file_segment *segment;
+#ifdef _WIN32
+ /** If we're using CreateFileMapping, this is the handle to the view. */
+ HANDLE view_handle;
+#endif
+};
+
+/* Declared in event2/buffer.h; defined here. */
+struct evbuffer_file_segment {
+ void *lock; /**< lock prevent concurrent access to refcnt */
+ int refcnt; /**< Reference count for this file segment */
+ unsigned flags; /**< combination of EVBUF_FS_* flags */
+
+ /** What kind of file segment is this? */
+ unsigned can_sendfile : 1;
+ unsigned is_mapping : 1;
+
+ /** The fd that we read the data from. */
+ int fd;
+ /** If we're using mmap, this is the raw mapped memory. */
+ void *mapping;
+#ifdef _WIN32
+ /** If we're using CreateFileMapping, this is the mapping */
+ HANDLE mapping_handle;
+#endif
+ /** If we're using mmap or IO, this is the content of the file
+ * segment. */
+ char *contents;
+ /** Position of this segment within the file. */
+ ev_off_t file_offset;
+ /** If we're using mmap, this is the offset within 'mapping' where
+ * this data segment begins. */
+ ev_off_t mmap_offset;
+ /** The length of this segment. */
+ ev_off_t length;
+ /** Cleanup callback function */
+ evbuffer_file_segment_cleanup_cb cleanup_cb;
+ /** Argument to be pass to cleanup callback function */
+ void *cleanup_cb_arg;
+};
+
+/** Information about the multicast parent of a chain. Lives at the
+ * end of an evbuffer_chain with the EVBUFFER_MULTICAST flag set. */
+struct evbuffer_multicast_parent {
+ /** source buffer the multicast parent belongs to */
+ struct evbuffer *source;
+ /** multicast parent for this chain */
+ struct evbuffer_chain *parent;
+};
+
#define EVBUFFER_CHAIN_SIZE sizeof(struct evbuffer_chain)
/** Return a pointer to extra data allocated along with an evbuffer. */
#define EVBUFFER_CHAIN_EXTRA(t, c) (t *)((struct evbuffer_chain *)(c) + 1)
@@ -300,21 +300,21 @@ struct evbuffer_multicast_parent {
} while (0)
/** Increase the reference count of buf by one. */
-void evbuffer_incref_(struct evbuffer *buf);
+void evbuffer_incref_(struct evbuffer *buf);
/** Increase the reference count of buf by one and acquire the lock. */
-void evbuffer_incref_and_lock_(struct evbuffer *buf);
+void evbuffer_incref_and_lock_(struct evbuffer *buf);
/** Pin a single buffer chain using a given flag. A pinned chunk may not be
* moved or freed until it is unpinned. */
-void evbuffer_chain_pin_(struct evbuffer_chain *chain, unsigned flag);
+void evbuffer_chain_pin_(struct evbuffer_chain *chain, unsigned flag);
/** Unpin a single buffer chain using a given flag. */
-void evbuffer_chain_unpin_(struct evbuffer_chain *chain, unsigned flag);
+void evbuffer_chain_unpin_(struct evbuffer_chain *chain, unsigned flag);
/** As evbuffer_free, but requires that we hold a lock on the buffer, and
* releases the lock before freeing it and the buffer. */
-void evbuffer_decref_and_unlock_(struct evbuffer *buffer);
+void evbuffer_decref_and_unlock_(struct evbuffer *buffer);
/** As evbuffer_expand, but does not guarantee that the newly allocated memory
* is contiguous. Instead, it may be split across two or more chunks. */
-int evbuffer_expand_fast_(struct evbuffer *, size_t, int);
+int evbuffer_expand_fast_(struct evbuffer *, size_t, int);
/** Helper: prepares for a readv/WSARecv call by expanding the buffer to
* hold enough memory to read 'howmuch' bytes in possibly noncontiguous memory.
@@ -322,7 +322,7 @@ int evbuffer_expand_fast_(struct evbuffer *, size_t, int);
* extent, and *chainp to point to the first chain that we'll try to read into.
* Returns the number of vecs used.
*/
-int evbuffer_read_setup_vecs_(struct evbuffer *buf, ev_ssize_t howmuch,
+int evbuffer_read_setup_vecs_(struct evbuffer *buf, ev_ssize_t howmuch,
struct evbuffer_iovec *vecs, int n_vecs, struct evbuffer_chain ***chainp,
int exact);
@@ -335,17 +335,17 @@ int evbuffer_read_setup_vecs_(struct evbuffer *buf, ev_ssize_t howmuch,
* See note in buffer_iocp's launch_write function */
/** Set the parent bufferevent object for buf to bev */
-void evbuffer_set_parent_(struct evbuffer *buf, struct bufferevent *bev);
-
-void evbuffer_invoke_callbacks_(struct evbuffer *buf);
-
+void evbuffer_set_parent_(struct evbuffer *buf, struct bufferevent *bev);
-int evbuffer_get_callbacks_(struct evbuffer *buffer,
- struct event_callback **cbs,
- int max_cbs);
+void evbuffer_invoke_callbacks_(struct evbuffer *buf);
+
+int evbuffer_get_callbacks_(struct evbuffer *buffer,
+ struct event_callback **cbs,
+ int max_cbs);
+
#ifdef __cplusplus
}
#endif
-#endif /* EVBUFFER_INTERNAL_H_INCLUDED_ */
+#endif /* EVBUFFER_INTERNAL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/evconfig-private.h b/contrib/libs/libevent/evconfig-private.h
index 31e610040e..7353beaad7 100644
--- a/contrib/libs/libevent/evconfig-private.h
+++ b/contrib/libs/libevent/evconfig-private.h
@@ -1,56 +1,56 @@
-/* evconfig-private.h. Generated from evconfig-private.h.in by configure. */
-/* evconfig-private.h template - see "Configuration Header Templates" */
-/* in AC manual. Kevin Bowling <kevin.bowling@kev009.com */
-#ifndef EVCONFIG_PRIVATE_H_INCLUDED_
-#define EVCONFIG_PRIVATE_H_INCLUDED_
-
-/* Enable extensions on AIX 3, Interix. */
-#ifndef _ALL_SOURCE
-# define _ALL_SOURCE 1
-#endif
-/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-#endif
-/* Enable threading extensions on Solaris. */
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# define _POSIX_PTHREAD_SEMANTICS 1
-#endif
-/* Enable extensions on HP NonStop. */
-#ifndef _TANDEM_SOURCE
-# define _TANDEM_SOURCE 1
-#endif
-/* Enable general extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# define __EXTENSIONS__ 1
-#endif
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-/* #undef _FILE_OFFSET_BITS */
-/* Define for large files, on AIX-style hosts. */
-/* #undef _LARGE_FILES */
-
-/* Define to 1 if on MINIX. */
-#ifndef _MINIX
-/* #undef _MINIX */
-#endif
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
- this defined. */
-#ifndef _POSIX_1_SOURCE
-/* #undef _POSIX_1_SOURCE */
-#endif
-
-/* Define to 1 if you need to in order for `stat' and other things to work. */
-#ifndef _POSIX_SOURCE
-/* #undef _POSIX_SOURCE */
-#endif
-
-/* Enable POSIX.2 extensions on QNX for getopt */
-#ifdef __QNX__
-# ifndef __EXT_POSIX2
-# define __EXT_POSIX2
-# endif
-#endif
-
-#endif
+/* evconfig-private.h. Generated from evconfig-private.h.in by configure. */
+/* evconfig-private.h template - see "Configuration Header Templates" */
+/* in AC manual. Kevin Bowling <kevin.bowling@kev009.com */
+#ifndef EVCONFIG_PRIVATE_H_INCLUDED_
+#define EVCONFIG_PRIVATE_H_INCLUDED_
+
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to 1 if on MINIX. */
+#ifndef _MINIX
+/* #undef _MINIX */
+#endif
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+#ifndef _POSIX_1_SOURCE
+/* #undef _POSIX_1_SOURCE */
+#endif
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#ifndef _POSIX_SOURCE
+/* #undef _POSIX_SOURCE */
+#endif
+
+/* Enable POSIX.2 extensions on QNX for getopt */
+#ifdef __QNX__
+# ifndef __EXT_POSIX2
+# define __EXT_POSIX2
+# endif
+#endif
+
+#endif
diff --git a/contrib/libs/libevent/evdns.c b/contrib/libs/libevent/evdns.c
index 3468721a6d..3db28df0e0 100644
--- a/contrib/libs/libevent/evdns.c
+++ b/contrib/libs/libevent/evdns.c
@@ -49,35 +49,35 @@
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
-
-#include <sys/types.h>
+#include "evconfig-private.h"
+#include <sys/types.h>
+
#ifndef _FORTIFY_SOURCE
#define _FORTIFY_SOURCE 3
#endif
#include <string.h>
#include <fcntl.h>
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#ifdef EVENT__HAVE_STDINT_H
+#ifdef EVENT__HAVE_STDINT_H
#include <stdint.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#ifdef EVENT__HAVE_UNISTD_H
+#ifdef EVENT__HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <limits.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdarg.h>
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
-#include <winerror.h>
+#include <winerror.h>
#include <ws2tcpip.h>
#ifndef _WIN32_IE
#define _WIN32_IE 0x400
@@ -100,7 +100,7 @@
#include "ipv6-internal.h"
#include "util-internal.h"
#include "evthread-internal.h"
-#ifdef _WIN32
+#ifdef _WIN32
#include <ctype.h>
#include <winsock2.h>
#include <windows.h>
@@ -112,13 +112,13 @@
#include <arpa/inet.h>
#endif
-#ifdef EVENT__HAVE_NETINET_IN6_H
-#error #include <netinet/in6.h>
-#endif
-
-#define EVDNS_LOG_DEBUG EVENT_LOG_DEBUG
-#define EVDNS_LOG_WARN EVENT_LOG_WARN
-#define EVDNS_LOG_MSG EVENT_LOG_MSG
+#ifdef EVENT__HAVE_NETINET_IN6_H
+#error #include <netinet/in6.h>
+#endif
+
+#define EVDNS_LOG_DEBUG EVENT_LOG_DEBUG
+#define EVDNS_LOG_WARN EVENT_LOG_WARN
+#define EVDNS_LOG_MSG EVENT_LOG_MSG
#ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 255
@@ -233,10 +233,10 @@ struct nameserver {
char choked; /* true if we have an EAGAIN from this server's socket */
char write_waiting; /* true if we are waiting for EV_WRITE events */
struct evdns_base *base;
-
- /* Number of currently inflight requests: used
- * to track when we should add/del the event. */
- int requests_inflight;
+
+ /* Number of currently inflight requests: used
+ * to track when we should add/del the event. */
+ int requests_inflight;
};
@@ -254,7 +254,7 @@ struct evdns_server_port {
struct server_request *pending_replies;
struct event_base *event_base;
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
void *lock;
#endif
};
@@ -347,9 +347,9 @@ struct evdns_base {
struct timeval global_getaddrinfo_allow_skew;
- int so_rcvbuf;
- int so_sndbuf;
-
+ int so_rcvbuf;
+ int so_sndbuf;
+
int getaddrinfo_ipv4_timeouts;
int getaddrinfo_ipv6_timeouts;
int getaddrinfo_ipv4_answered;
@@ -359,11 +359,11 @@ struct evdns_base {
TAILQ_HEAD(hosts_list, hosts_entry) hostsdb;
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
void *lock;
#endif
-
- int disable_when_inactive;
+
+ int disable_when_inactive;
};
struct hosts_entry {
@@ -416,14 +416,14 @@ static int evdns_base_resolv_conf_parse_impl(struct evdns_base *base, int flags,
static int evdns_base_set_option_impl(struct evdns_base *base,
const char *option, const char *val, int flags);
static void evdns_base_free_and_unlock(struct evdns_base *base, int fail_requests);
-static void evdns_request_timeout_callback(evutil_socket_t fd, short events, void *arg);
+static void evdns_request_timeout_callback(evutil_socket_t fd, short events, void *arg);
static int strtoint(const char *const str);
-#ifdef EVENT__DISABLE_THREAD_SUPPORT
-#define EVDNS_LOCK(base) EVUTIL_NIL_STMT_
-#define EVDNS_UNLOCK(base) EVUTIL_NIL_STMT_
-#define ASSERT_LOCKED(base) EVUTIL_NIL_STMT_
+#ifdef EVENT__DISABLE_THREAD_SUPPORT
+#define EVDNS_LOCK(base) EVUTIL_NIL_STMT_
+#define EVDNS_UNLOCK(base) EVUTIL_NIL_STMT_
+#define ASSERT_LOCKED(base) EVUTIL_NIL_STMT_
#else
#define EVDNS_LOCK(base) \
EVLOCK_LOCK((base)->lock, 0)
@@ -447,24 +447,24 @@ evdns_set_log_fn(evdns_debug_log_fn_type fn)
#define EVDNS_LOG_CHECK
#endif
-static void evdns_log_(int severity, const char *fmt, ...) EVDNS_LOG_CHECK;
+static void evdns_log_(int severity, const char *fmt, ...) EVDNS_LOG_CHECK;
static void
-evdns_log_(int severity, const char *fmt, ...)
+evdns_log_(int severity, const char *fmt, ...)
{
va_list args;
va_start(args,fmt);
if (evdns_log_fn) {
- char buf[512];
- int is_warn = (severity == EVDNS_LOG_WARN);
- evutil_vsnprintf(buf, sizeof(buf), fmt, args);
- evdns_log_fn(is_warn, buf);
+ char buf[512];
+ int is_warn = (severity == EVDNS_LOG_WARN);
+ evutil_vsnprintf(buf, sizeof(buf), fmt, args);
+ evdns_log_fn(is_warn, buf);
} else {
- event_logv_(severity, NULL, fmt, args);
+ event_logv_(severity, NULL, fmt, args);
}
- va_end(args);
+ va_end(args);
}
-#define log evdns_log_
+#define log evdns_log_
/* This walks the list of inflight requests to find the */
/* one with a matching transaction id. Returns NULL on */
@@ -539,23 +539,23 @@ nameserver_probe_failed(struct nameserver *const ns) {
char addrbuf[128];
log(EVDNS_LOG_WARN,
"Error from libevent when adding timer event for %s",
- evutil_format_sockaddr_port_(
+ evutil_format_sockaddr_port_(
(struct sockaddr *)&ns->address,
addrbuf, sizeof(addrbuf)));
}
}
-static void
-request_swap_ns(struct request *req, struct nameserver *ns) {
- if (ns && req->ns != ns) {
- EVUTIL_ASSERT(req->ns->requests_inflight > 0);
- req->ns->requests_inflight--;
- ns->requests_inflight++;
-
- req->ns = ns;
- }
-}
-
+static void
+request_swap_ns(struct request *req, struct nameserver *ns) {
+ if (ns && req->ns != ns) {
+ EVUTIL_ASSERT(req->ns->requests_inflight > 0);
+ req->ns->requests_inflight--;
+ ns->requests_inflight++;
+
+ req->ns = ns;
+ }
+}
+
/* called when a nameserver has been deemed to have failed. For example, too */
/* many packets have timed out etc */
static void
@@ -571,7 +571,7 @@ nameserver_failed(struct nameserver *const ns, const char *msg) {
if (!ns->state) return;
log(EVDNS_LOG_MSG, "Nameserver %s has failed: %s",
- evutil_format_sockaddr_port_(
+ evutil_format_sockaddr_port_(
(struct sockaddr *)&ns->address,
addrbuf, sizeof(addrbuf)),
msg);
@@ -589,7 +589,7 @@ nameserver_failed(struct nameserver *const ns, const char *msg) {
&base->global_nameserver_probe_initial_timeout) < 0) {
log(EVDNS_LOG_WARN,
"Error from libevent when adding timer event for %s",
- evutil_format_sockaddr_port_(
+ evutil_format_sockaddr_port_(
(struct sockaddr *)&ns->address,
addrbuf, sizeof(addrbuf)));
/* ???? Do more? */
@@ -610,7 +610,7 @@ nameserver_failed(struct nameserver *const ns, const char *msg) {
if (req->tx_count == 0 && req->ns == ns) {
/* still waiting to go out, can be moved */
/* to another server */
- request_swap_ns(req, nameserver_pick(base));
+ request_swap_ns(req, nameserver_pick(base));
}
req = req->next;
} while (req != started_at);
@@ -625,7 +625,7 @@ nameserver_up(struct nameserver *const ns)
ASSERT_LOCKED(ns->base);
if (ns->state) return;
log(EVDNS_LOG_MSG, "Nameserver %s is back up",
- evutil_format_sockaddr_port_(
+ evutil_format_sockaddr_port_(
(struct sockaddr *)&ns->address,
addrbuf, sizeof(addrbuf)));
evtimer_del(&ns->timeout_event);
@@ -663,20 +663,20 @@ request_finished(struct request *const req, struct request **head, int free_hand
if (was_inflight) {
evtimer_del(&req->timeout_event);
base->global_requests_inflight--;
- req->ns->requests_inflight--;
+ req->ns->requests_inflight--;
} else {
base->global_requests_waiting--;
}
/* it was initialized during request_new / evtimer_assign */
event_debug_unassign(&req->timeout_event);
- if (req->ns &&
- req->ns->requests_inflight == 0 &&
- req->base->disable_when_inactive) {
- event_del(&req->ns->event);
- evtimer_del(&req->ns->timeout_event);
- }
-
+ if (req->ns &&
+ req->ns->requests_inflight == 0 &&
+ req->base->disable_when_inactive) {
+ event_del(&req->ns->event);
+ evtimer_del(&req->ns->timeout_event);
+ }
+
if (!req->request_appended) {
/* need to free the request data on it's own */
mm_free(req->request);
@@ -723,7 +723,7 @@ request_reissue(struct request *req) {
/* the last nameserver should have been marked as failing */
/* by the caller of this function, therefore pick will try */
/* not to return it */
- request_swap_ns(req, nameserver_pick(req->base));
+ request_swap_ns(req, nameserver_pick(req->base));
if (req->ns == last_ns) {
/* ... but pick did return it */
/* not a lot of point in trying again with the */
@@ -758,8 +758,8 @@ evdns_requests_pump_waiting_queue(struct evdns_base *base) {
return;
/* move a request from the waiting queue to the inflight queue */
- req->ns->requests_inflight++;
-
+ req->ns->requests_inflight++;
+
evdns_request_remove(req, &base->req_waiting_head);
base->global_requests_waiting--;
@@ -775,7 +775,7 @@ evdns_requests_pump_waiting_queue(struct evdns_base *base) {
/* TODO(nickm) document */
struct deferred_reply_callback {
- struct event_callback deferred;
+ struct event_callback deferred;
struct evdns_request *handle;
u8 request_type;
u8 have_reply;
@@ -786,7 +786,7 @@ struct deferred_reply_callback {
};
static void
-reply_run_callback(struct event_callback *d, void *user_pointer)
+reply_run_callback(struct event_callback *d, void *user_pointer)
{
struct deferred_reply_callback *cb =
EVUTIL_UPCAST(d, struct deferred_reply_callback, deferred);
@@ -857,29 +857,29 @@ reply_schedule_callback(struct request *const req, u32 ttl, u32 err, struct repl
d->handle = req->handle;
}
- event_deferred_cb_init_(
- &d->deferred,
- event_get_priority(&req->timeout_event),
- reply_run_callback,
+ event_deferred_cb_init_(
+ &d->deferred,
+ event_get_priority(&req->timeout_event),
+ reply_run_callback,
req->user_pointer);
- event_deferred_cb_schedule_(
- req->base->event_base,
+ event_deferred_cb_schedule_(
+ req->base->event_base,
&d->deferred);
}
-
-#define _QR_MASK 0x8000U
-#define _OP_MASK 0x7800U
-#define _AA_MASK 0x0400U
-#define _TC_MASK 0x0200U
-#define _RD_MASK 0x0100U
-#define _RA_MASK 0x0080U
-#define _Z_MASK 0x0040U
-#define _AD_MASK 0x0020U
-#define _CD_MASK 0x0010U
-#define _RCODE_MASK 0x000fU
-#define _Z_MASK_DEPRECATED 0x0070U
-
+
+#define _QR_MASK 0x8000U
+#define _OP_MASK 0x7800U
+#define _AA_MASK 0x0400U
+#define _TC_MASK 0x0200U
+#define _RD_MASK 0x0100U
+#define _RA_MASK 0x0080U
+#define _Z_MASK 0x0040U
+#define _AD_MASK 0x0020U
+#define _CD_MASK 0x0010U
+#define _RCODE_MASK 0x000fU
+#define _Z_MASK_DEPRECATED 0x0070U
+
/* this processes a parsed reply packet */
static void
reply_handle(struct request *const req, u16 flags, u32 ttl, struct reply *reply) {
@@ -893,12 +893,12 @@ reply_handle(struct request *const req, u16 flags, u32 ttl, struct reply *reply)
ASSERT_LOCKED(req->base);
ASSERT_VALID_REQUEST(req);
- if (flags & (_RCODE_MASK | _TC_MASK) || !reply || !reply->have_answer) {
+ if (flags & (_RCODE_MASK | _TC_MASK) || !reply || !reply->have_answer) {
/* there was an error */
- if (flags & _TC_MASK) {
+ if (flags & _TC_MASK) {
error = DNS_ERR_TRUNCATED;
- } else if (flags & _RCODE_MASK) {
- u16 error_code = (flags & _RCODE_MASK) - 1;
+ } else if (flags & _RCODE_MASK) {
+ u16 error_code = (flags & _RCODE_MASK) - 1;
if (error_code > 4) {
error = DNS_ERR_UNKNOWN;
} else {
@@ -930,12 +930,12 @@ reply_handle(struct request *const req, u16 flags, u32 ttl, struct reply *reply)
*/
log(EVDNS_LOG_DEBUG, "Got a SERVERFAILED from nameserver"
"at %s; will allow the request to time out.",
- evutil_format_sockaddr_port_(
+ evutil_format_sockaddr_port_(
(struct sockaddr *)&req->ns->address,
addrbuf, sizeof(addrbuf)));
- /* Call the timeout function */
- evdns_request_timeout_callback(0, 0, req);
- return;
+ /* Call the timeout function */
+ evdns_request_timeout_callback(0, 0, req);
+ return;
default:
/* we got a good reply from the nameserver: it is up. */
if (req->handle == req->ns->probe_request) {
@@ -978,8 +978,8 @@ name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
int name_end = -1;
int j = *idx;
int ptr_count = 0;
-#define GET32(x) do { if (j + 4 > length) goto err; memcpy(&t32_, packet + j, 4); j += 4; x = ntohl(t32_); } while (0)
-#define GET16(x) do { if (j + 2 > length) goto err; memcpy(&t_, packet + j, 2); j += 2; x = ntohs(t_); } while (0)
+#define GET32(x) do { if (j + 4 > length) goto err; memcpy(&t32_, packet + j, 4); j += 4; x = ntohl(t32_); } while (0)
+#define GET16(x) do { if (j + 2 > length) goto err; memcpy(&t_, packet + j, 2); j += 2; x = ntohs(t_); } while (0)
#define GET8(x) do { if (j >= length) goto err; x = packet[j++]; } while (0)
char *cp = name_out;
@@ -1013,7 +1013,7 @@ name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
*cp++ = '.';
}
if (cp + label_len >= end) return -1;
- if (j + label_len > length) return -1;
+ if (j + label_len > length) return -1;
memcpy(cp, packet + j, label_len);
cp += label_len;
j += label_len;
@@ -1033,8 +1033,8 @@ name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
static int
reply_parse(struct evdns_base *base, u8 *packet, int length) {
int j = 0, k = 0; /* index into packet */
- u16 t_; /* used by the macros */
- u32 t32_; /* used by the macros */
+ u16 t_; /* used by the macros */
+ u32 t32_; /* used by the macros */
char tmp_name[256], cmp_name[256]; /* used by the macros */
int name_matches = 0;
@@ -1063,8 +1063,8 @@ reply_parse(struct evdns_base *base, u8 *packet, int length) {
memset(&reply, 0, sizeof(reply));
/* If it's not an answer, it doesn't correspond to any request. */
- if (!(flags & _QR_MASK)) return -1; /* must be an answer */
- if ((flags & (_RCODE_MASK|_TC_MASK)) && (flags & (_RCODE_MASK|_TC_MASK)) != DNS_ERR_NOTEXIST) {
+ if (!(flags & _QR_MASK)) return -1; /* must be an answer */
+ if ((flags & (_RCODE_MASK|_TC_MASK)) && (flags & (_RCODE_MASK|_TC_MASK)) != DNS_ERR_NOTEXIST) {
/* there was an error and it's not NXDOMAIN */
goto err;
}
@@ -1085,25 +1085,25 @@ reply_parse(struct evdns_base *base, u8 *packet, int length) {
/* the question looks like
* <label:name><u16:type><u16:class>
*/
- tmp_name[0] = '\0';
- cmp_name[0] = '\0';
- k = j;
- if (name_parse(packet, length, &j, tmp_name, sizeof(tmp_name)) < 0)
- goto err;
- if (name_parse(req->request, req->request_len, &k,
- cmp_name, sizeof(cmp_name))<0)
- goto err;
- if (!base->global_randomize_case) {
- if (strcmp(tmp_name, cmp_name) == 0)
- name_matches = 1;
- } else {
- if (evutil_ascii_strcasecmp(tmp_name, cmp_name) == 0)
- name_matches = 1;
- }
-
+ tmp_name[0] = '\0';
+ cmp_name[0] = '\0';
+ k = j;
+ if (name_parse(packet, length, &j, tmp_name, sizeof(tmp_name)) < 0)
+ goto err;
+ if (name_parse(req->request, req->request_len, &k,
+ cmp_name, sizeof(cmp_name))<0)
+ goto err;
+ if (!base->global_randomize_case) {
+ if (strcmp(tmp_name, cmp_name) == 0)
+ name_matches = 1;
+ } else {
+ if (evutil_ascii_strcasecmp(tmp_name, cmp_name) == 0)
+ name_matches = 1;
+ }
+
j += 4;
- if (j > length)
- goto err;
+ if (j > length)
+ goto err;
}
if (!name_matches)
@@ -1233,7 +1233,7 @@ static int
request_parse(u8 *packet, int length, struct evdns_server_port *port, struct sockaddr *addr, ev_socklen_t addrlen)
{
int j = 0; /* index into packet */
- u16 t_; /* used by the macros */
+ u16 t_; /* used by the macros */
char tmp_name[256]; /* used by the macros */
int i;
@@ -1253,8 +1253,8 @@ request_parse(u8 *packet, int length, struct evdns_server_port *port, struct soc
(void)additional;
(void)authority;
- if (flags & _QR_MASK) return -1; /* Must not be an answer. */
- flags &= (_RD_MASK|_CD_MASK); /* Only RD and CD get preserved. */
+ if (flags & _QR_MASK) return -1; /* Must not be an answer. */
+ flags &= (_RD_MASK|_CD_MASK); /* Only RD and CD get preserved. */
server_req = mm_malloc(sizeof(struct server_request));
if (server_req == NULL) return -1;
@@ -1294,7 +1294,7 @@ request_parse(u8 *packet, int length, struct evdns_server_port *port, struct soc
port->refcnt++;
/* Only standard queries are supported. */
- if (flags & _OP_MASK) {
+ if (flags & _OP_MASK) {
evdns_server_request_respond(&(server_req->base), DNS_ERR_NOTIMPL);
return -1;
}
@@ -1303,12 +1303,12 @@ request_parse(u8 *packet, int length, struct evdns_server_port *port, struct soc
return 0;
err:
- if (server_req->base.questions) {
- for (i = 0; i < server_req->base.nquestions; ++i)
- mm_free(server_req->base.questions[i]);
- mm_free(server_req->base.questions);
+ if (server_req->base.questions) {
+ for (i = 0; i < server_req->base.nquestions; ++i)
+ mm_free(server_req->base.questions[i]);
+ mm_free(server_req->base.questions);
}
- mm_free(server_req);
+ mm_free(server_req);
return -1;
#undef SKIP_NAME
@@ -1406,7 +1406,7 @@ nameserver_read(struct nameserver *ns) {
(struct sockaddr*)&ns->address, 0)) {
log(EVDNS_LOG_WARN, "Address mismatch on received "
"DNS packet. Apparent source was %s",
- evutil_format_sockaddr_port_(
+ evutil_format_sockaddr_port_(
(struct sockaddr *)&ss,
addrbuf, sizeof(addrbuf)));
return;
@@ -1496,7 +1496,7 @@ nameserver_write_waiting(struct nameserver *ns, char waiting) {
if (event_add(&ns->event, NULL) < 0) {
char addrbuf[128];
log(EVDNS_LOG_WARN, "Error from libevent when adding event for %s",
- evutil_format_sockaddr_port_(
+ evutil_format_sockaddr_port_(
(struct sockaddr *)&ns->address,
addrbuf, sizeof(addrbuf)));
/* ???? Do more? */
@@ -1617,20 +1617,20 @@ dnsname_to_labels(u8 *const buf, size_t buf_len, off_t j,
struct dnslabel_table *table) {
const char *end = name + name_len;
int ref = 0;
- u16 t_;
+ u16 t_;
#define APPEND16(x) do { \
if (j + 2 > (off_t)buf_len) \
goto overflow; \
- t_ = htons(x); \
- memcpy(buf + j, &t_, 2); \
+ t_ = htons(x); \
+ memcpy(buf + j, &t_, 2); \
j += 2; \
} while (0)
#define APPEND32(x) do { \
if (j + 4 > (off_t)buf_len) \
goto overflow; \
- t32_ = htonl(x); \
- memcpy(buf + j, &t32_, 4); \
+ t32_ = htonl(x); \
+ memcpy(buf + j, &t32_, 4); \
j += 4; \
} while (0)
@@ -1696,7 +1696,7 @@ evdns_request_data_build(const char *const name, const size_t name_len,
const u16 trans_id, const u16 type, const u16 class,
u8 *const buf, size_t buf_len) {
off_t j = 0; /* current offset into buf */
- u16 t_; /* used by the macros */
+ u16 t_; /* used by the macros */
APPEND16(trans_id);
APPEND16(0x0100); /* standard query, recusion needed */
@@ -1766,15 +1766,15 @@ evdns_close_server_port(struct evdns_server_port *port)
server_port_free(port);
} else {
port->closing = 1;
- EVDNS_UNLOCK(port);
+ EVDNS_UNLOCK(port);
}
}
/* exported function */
int
-evdns_server_request_add_reply(struct evdns_server_request *req_, int section, const char *name, int type, int class, int ttl, int datalen, int is_name, const char *data)
+evdns_server_request_add_reply(struct evdns_server_request *req_, int section, const char *name, int type, int class, int ttl, int datalen, int is_name, const char *data)
{
- struct server_request *req = TO_SERVER_REQUEST(req_);
+ struct server_request *req = TO_SERVER_REQUEST(req_);
struct server_reply_item **itemp, *item;
int *countp;
int result = -1;
@@ -1909,8 +1909,8 @@ evdns_server_request_format_response(struct server_request *req, int err)
unsigned char buf[1500];
size_t buf_len = sizeof(buf);
off_t j = 0, r;
- u16 t_;
- u32 t32_;
+ u16 t_;
+ u32 t32_;
int i;
u16 flags;
struct dnslabel_table table;
@@ -1920,7 +1920,7 @@ evdns_server_request_format_response(struct server_request *req, int err)
/* Set response bit and error code; copy OPCODE and RD fields from
* question; copy RA and AA if set by caller. */
flags = req->base.flags;
- flags |= (_QR_MASK | err);
+ flags |= (_QR_MASK | err);
dnslabel_table_init(&table);
APPEND16(req->trans_id);
@@ -1968,8 +1968,8 @@ evdns_server_request_format_response(struct server_request *req, int err)
if (r < 0)
goto overflow;
j = r;
- t_ = htons( (short) (j-name_start) );
- memcpy(buf+len_idx, &t_, 2);
+ t_ = htons( (short) (j-name_start) );
+ memcpy(buf+len_idx, &t_, 2);
} else {
APPEND16(item->datalen);
if (j+item->datalen > (off_t)buf_len)
@@ -2002,9 +2002,9 @@ overflow:
/* exported function */
int
-evdns_server_request_respond(struct evdns_server_request *req_, int err)
+evdns_server_request_respond(struct evdns_server_request *req_, int err)
{
- struct server_request *req = TO_SERVER_REQUEST(req_);
+ struct server_request *req = TO_SERVER_REQUEST(req_);
struct evdns_server_port *port = req->port;
int r = -1;
@@ -2150,18 +2150,18 @@ server_port_free(struct evdns_server_port *port)
/* exported function */
int
-evdns_server_request_drop(struct evdns_server_request *req_)
+evdns_server_request_drop(struct evdns_server_request *req_)
{
- struct server_request *req = TO_SERVER_REQUEST(req_);
+ struct server_request *req = TO_SERVER_REQUEST(req_);
server_request_free(req);
return 0;
}
/* exported function */
int
-evdns_server_request_get_requesting_addr(struct evdns_server_request *req_, struct sockaddr *sa, int addr_len)
+evdns_server_request_get_requesting_addr(struct evdns_server_request *req_, struct sockaddr *sa, int addr_len)
{
- struct server_request *req = TO_SERVER_REQUEST(req_);
+ struct server_request *req = TO_SERVER_REQUEST(req_);
if (addr_len < (int)req->addrlen)
return -1;
memcpy(sa, &(req->addr), req->addrlen);
@@ -2185,29 +2185,29 @@ evdns_request_timeout_callback(evutil_socket_t fd, short events, void *arg) {
EVDNS_LOCK(base);
if (req->tx_count >= req->base->global_max_retransmits) {
- struct nameserver *ns = req->ns;
+ struct nameserver *ns = req->ns;
/* this request has failed */
log(EVDNS_LOG_DEBUG, "Giving up on request %p; tx_count==%d",
arg, req->tx_count);
reply_schedule_callback(req, 0, DNS_ERR_TIMEOUT, NULL);
-
+
request_finished(req, &REQ_HEAD(req->base, req->trans_id), 1);
- nameserver_failed(ns, "request timed out.");
+ nameserver_failed(ns, "request timed out.");
} else {
/* retransmit it */
log(EVDNS_LOG_DEBUG, "Retransmitting request %p; tx_count==%d",
arg, req->tx_count);
(void) evtimer_del(&req->timeout_event);
- request_swap_ns(req, nameserver_pick(base));
+ request_swap_ns(req, nameserver_pick(base));
evdns_request_transmit(req);
-
- req->ns->timedout++;
- if (req->ns->timedout > req->base->global_max_nameserver_timeout) {
- req->ns->timedout = 0;
- nameserver_failed(req->ns, "request timed out.");
- }
- }
-
+
+ req->ns->timedout++;
+ if (req->ns->timedout > req->base->global_max_nameserver_timeout) {
+ req->ns->timedout = 0;
+ nameserver_failed(req->ns, "request timed out.");
+ }
+ }
+
EVDNS_UNLOCK(base);
}
@@ -2222,13 +2222,13 @@ evdns_request_transmit_to(struct request *req, struct nameserver *server) {
int r;
ASSERT_LOCKED(req->base);
ASSERT_VALID_REQUEST(req);
-
- if (server->requests_inflight == 1 &&
- req->base->disable_when_inactive &&
- event_add(&server->event, NULL) < 0) {
- return 1;
- }
-
+
+ if (server->requests_inflight == 1 &&
+ req->base->disable_when_inactive &&
+ event_add(&server->event, NULL) < 0) {
+ return 1;
+ }
+
r = sendto(server->socket, (void*)req->request, req->request_len, 0,
(struct sockaddr *)&server->address, server->addrlen);
if (r < 0) {
@@ -2281,11 +2281,11 @@ evdns_request_transmit(struct request *req) {
nameserver_write_waiting(req->ns, 1);
return 1;
case 2:
- /* failed to transmit the request entirely. we can fallthrough since
- * we'll set a timeout, which will time out, and make us retransmit the
- * request anyway. */
+ /* failed to transmit the request entirely. we can fallthrough since
+ * we'll set a timeout, which will time out, and make us retransmit the
+ * request anyway. */
retcode = 1;
- EVUTIL_FALLTHROUGH;
+ EVUTIL_FALLTHROUGH;
default:
/* all ok */
log(EVDNS_LOG_DEBUG,
@@ -2338,7 +2338,7 @@ nameserver_send_probe(struct nameserver *const ns) {
ASSERT_LOCKED(ns->base);
log(EVDNS_LOG_DEBUG, "Sending probe to %s",
- evutil_format_sockaddr_port_(
+ evutil_format_sockaddr_port_(
(struct sockaddr *)&ns->address,
addrbuf, sizeof(addrbuf)));
handle = mm_calloc(1, sizeof(*handle));
@@ -2499,7 +2499,7 @@ evdns_resume(void)
}
static int
-evdns_nameserver_add_impl_(struct evdns_base *base, const struct sockaddr *address, int addrlen) {
+evdns_nameserver_add_impl_(struct evdns_base *base, const struct sockaddr *address, int addrlen) {
/* first check to see if we already have this nameserver */
const struct nameserver *server = base->server_head, *const started_at = base->server_head;
@@ -2527,12 +2527,12 @@ evdns_nameserver_add_impl_(struct evdns_base *base, const struct sockaddr *addre
evtimer_assign(&ns->timeout_event, ns->base->event_base, nameserver_prod_callback, ns);
- ns->socket = evutil_socket_(address->sa_family,
- SOCK_DGRAM|EVUTIL_SOCK_NONBLOCK|EVUTIL_SOCK_CLOEXEC, 0);
+ ns->socket = evutil_socket_(address->sa_family,
+ SOCK_DGRAM|EVUTIL_SOCK_NONBLOCK|EVUTIL_SOCK_CLOEXEC, 0);
if (ns->socket < 0) { err = 1; goto out1; }
if (base->global_outgoing_addrlen &&
- !evutil_sockaddr_is_loopback_(address)) {
+ !evutil_sockaddr_is_loopback_(address)) {
if (bind(ns->socket,
(struct sockaddr*)&base->global_outgoing_address,
base->global_outgoing_addrlen) < 0) {
@@ -2542,35 +2542,35 @@ evdns_nameserver_add_impl_(struct evdns_base *base, const struct sockaddr *addre
}
}
- if (base->so_rcvbuf) {
- if (setsockopt(ns->socket, SOL_SOCKET, SO_RCVBUF,
- (void *)&base->so_rcvbuf, sizeof(base->so_rcvbuf))) {
- log(EVDNS_LOG_WARN, "Couldn't set SO_RCVBUF to %i", base->so_rcvbuf);
- err = -SO_RCVBUF;
- goto out2;
- }
- }
- if (base->so_sndbuf) {
- if (setsockopt(ns->socket, SOL_SOCKET, SO_SNDBUF,
- (void *)&base->so_sndbuf, sizeof(base->so_sndbuf))) {
- log(EVDNS_LOG_WARN, "Couldn't set SO_SNDBUF to %i", base->so_sndbuf);
- err = -SO_SNDBUF;
- goto out2;
- }
- }
-
+ if (base->so_rcvbuf) {
+ if (setsockopt(ns->socket, SOL_SOCKET, SO_RCVBUF,
+ (void *)&base->so_rcvbuf, sizeof(base->so_rcvbuf))) {
+ log(EVDNS_LOG_WARN, "Couldn't set SO_RCVBUF to %i", base->so_rcvbuf);
+ err = -SO_RCVBUF;
+ goto out2;
+ }
+ }
+ if (base->so_sndbuf) {
+ if (setsockopt(ns->socket, SOL_SOCKET, SO_SNDBUF,
+ (void *)&base->so_sndbuf, sizeof(base->so_sndbuf))) {
+ log(EVDNS_LOG_WARN, "Couldn't set SO_SNDBUF to %i", base->so_sndbuf);
+ err = -SO_SNDBUF;
+ goto out2;
+ }
+ }
+
memcpy(&ns->address, address, addrlen);
ns->addrlen = addrlen;
ns->state = 1;
- event_assign(&ns->event, ns->base->event_base, ns->socket,
- EV_READ | EV_PERSIST, nameserver_ready_callback, ns);
- if (!base->disable_when_inactive && event_add(&ns->event, NULL) < 0) {
+ event_assign(&ns->event, ns->base->event_base, ns->socket,
+ EV_READ | EV_PERSIST, nameserver_ready_callback, ns);
+ if (!base->disable_when_inactive && event_add(&ns->event, NULL) < 0) {
err = 2;
goto out2;
}
log(EVDNS_LOG_DEBUG, "Added nameserver %s as %p",
- evutil_format_sockaddr_port_(address, addrbuf, sizeof(addrbuf)), ns);
+ evutil_format_sockaddr_port_(address, addrbuf, sizeof(addrbuf)), ns);
/* insert this nameserver into the list of them */
if (!base->server_head) {
@@ -2593,7 +2593,7 @@ out1:
event_debug_unassign(&ns->event);
mm_free(ns);
log(EVDNS_LOG_WARN, "Unable to add nameserver %s: error %d",
- evutil_format_sockaddr_port_(address, addrbuf, sizeof(addrbuf)), err);
+ evutil_format_sockaddr_port_(address, addrbuf, sizeof(addrbuf)), err);
return err;
}
@@ -2608,7 +2608,7 @@ evdns_base_nameserver_add(struct evdns_base *base, unsigned long int address)
sin.sin_port = htons(53);
sin.sin_family = AF_INET;
EVDNS_LOCK(base);
- res = evdns_nameserver_add_impl_(base, (struct sockaddr*)&sin, sizeof(sin));
+ res = evdns_nameserver_add_impl_(base, (struct sockaddr*)&sin, sizeof(sin));
EVDNS_UNLOCK(base);
return res;
}
@@ -2660,7 +2660,7 @@ evdns_base_nameserver_ip_add(struct evdns_base *base, const char *ip_as_string)
sockaddr_setport(sa, 53);
EVDNS_LOCK(base);
- res = evdns_nameserver_add_impl_(base, sa, len);
+ res = evdns_nameserver_add_impl_(base, sa, len);
EVDNS_UNLOCK(base);
return res;
}
@@ -2679,39 +2679,39 @@ evdns_base_nameserver_sockaddr_add(struct evdns_base *base,
int res;
EVUTIL_ASSERT(base);
EVDNS_LOCK(base);
- res = evdns_nameserver_add_impl_(base, sa, len);
+ res = evdns_nameserver_add_impl_(base, sa, len);
EVDNS_UNLOCK(base);
return res;
}
-int
-evdns_base_get_nameserver_addr(struct evdns_base *base, int idx,
- struct sockaddr *sa, ev_socklen_t len)
-{
- int result = -1;
- int i;
- struct nameserver *server;
- EVDNS_LOCK(base);
- server = base->server_head;
- for (i = 0; i < idx && server; ++i, server = server->next) {
- if (server->next == base->server_head)
- goto done;
- }
- if (! server)
- goto done;
-
- if (server->addrlen > len) {
- result = (int) server->addrlen;
- goto done;
- }
-
- memcpy(sa, &server->address, server->addrlen);
- result = (int) server->addrlen;
-done:
- EVDNS_UNLOCK(base);
- return result;
-}
-
+int
+evdns_base_get_nameserver_addr(struct evdns_base *base, int idx,
+ struct sockaddr *sa, ev_socklen_t len)
+{
+ int result = -1;
+ int i;
+ struct nameserver *server;
+ EVDNS_LOCK(base);
+ server = base->server_head;
+ for (i = 0; i < idx && server; ++i, server = server->next) {
+ if (server->next == base->server_head)
+ goto done;
+ }
+ if (! server)
+ goto done;
+
+ if (server->addrlen > len) {
+ result = (int) server->addrlen;
+ goto done;
+ }
+
+ memcpy(sa, &server->address, server->addrlen);
+ result = (int) server->addrlen;
+done:
+ EVDNS_UNLOCK(base);
+ return result;
+}
+
/* remove from the queue */
static void
evdns_request_remove(struct request *req, struct request **head)
@@ -2815,7 +2815,7 @@ request_new(struct evdns_base *base, struct evdns_request *handle, int type,
strlcpy(namebuf, name, sizeof(namebuf));
evutil_secure_rng_get_bytes(randbits, (name_len+7)/8);
for (i = 0; i < name_len; ++i) {
- if (EVUTIL_ISALPHA_(namebuf[i])) {
+ if (EVUTIL_ISALPHA_(namebuf[i])) {
if ((randbits[i >> 3] & (1<<(i & 7))))
namebuf[i] |= 0x20;
else
@@ -2863,10 +2863,10 @@ request_submit(struct request *const req) {
/* if it has a nameserver assigned then this is going */
/* straight into the inflight queue */
evdns_request_insert(req, &REQ_HEAD(base, req->trans_id));
-
+
base->global_requests_inflight++;
- req->ns->requests_inflight++;
-
+ req->ns->requests_inflight++;
+
evdns_request_transmit(req);
} else {
evdns_request_insert(req, &base->req_waiting_head);
@@ -3209,12 +3209,12 @@ search_set_from_hostname(struct evdns_base *base) {
static char *
search_make_new(const struct search_state *const state, int n, const char *const base_name) {
const size_t base_len = strlen(base_name);
- char need_to_append_dot;
+ char need_to_append_dot;
struct search_domain *dom;
- if (!base_len) return NULL;
- need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
-
+ if (!base_len) return NULL;
+ need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
+
for (dom = state->head; dom; dom = dom->next) {
if (!n--) {
/* this is the postfix we want */
@@ -3347,19 +3347,19 @@ search_request_finished(struct evdns_request *const handle) {
static void
evdns_resolv_set_defaults(struct evdns_base *base, int flags) {
- int add_default = flags & DNS_OPTION_NAMESERVERS;
- if (flags & DNS_OPTION_NAMESERVERS_NO_DEFAULT)
- add_default = 0;
-
+ int add_default = flags & DNS_OPTION_NAMESERVERS;
+ if (flags & DNS_OPTION_NAMESERVERS_NO_DEFAULT)
+ add_default = 0;
+
/* if the file isn't found then we assume a local resolver */
ASSERT_LOCKED(base);
- if (flags & DNS_OPTION_SEARCH)
- search_set_from_hostname(base);
- if (add_default)
- evdns_base_nameserver_ip_add(base, "127.0.0.1");
+ if (flags & DNS_OPTION_SEARCH)
+ search_set_from_hostname(base);
+ if (add_default)
+ evdns_base_nameserver_ip_add(base, "127.0.0.1");
}
-#ifndef EVENT__HAVE_STRTOK_R
+#ifndef EVENT__HAVE_STRTOK_R
static char *
strtok_r(char *s, const char *delim, char **state) {
char *cp, *start;
@@ -3393,7 +3393,7 @@ strtoint(const char *const str)
/* Parse a number of seconds into a timeval; return -1 on error. */
static int
-evdns_strtotimeval(const char *const str, struct timeval *out)
+evdns_strtotimeval(const char *const str, struct timeval *out)
{
double d;
char *endptr;
@@ -3496,13 +3496,13 @@ evdns_base_set_option_impl(struct evdns_base *base,
base->global_search_state->ndots = ndots;
} else if (str_matches_option(option, "timeout:")) {
struct timeval tv;
- if (evdns_strtotimeval(val, &tv) == -1) return -1;
+ if (evdns_strtotimeval(val, &tv) == -1) return -1;
if (!(flags & DNS_OPTION_MISC)) return 0;
log(EVDNS_LOG_DEBUG, "Setting timeout to %s", val);
memcpy(&base->global_timeout, &tv, sizeof(struct timeval));
} else if (str_matches_option(option, "getaddrinfo-allow-skew:")) {
struct timeval tv;
- if (evdns_strtotimeval(val, &tv) == -1) return -1;
+ if (evdns_strtotimeval(val, &tv) == -1) return -1;
if (!(flags & DNS_OPTION_MISC)) return 0;
log(EVDNS_LOG_DEBUG, "Setting getaddrinfo-allow-skew to %s",
val);
@@ -3545,7 +3545,7 @@ evdns_base_set_option_impl(struct evdns_base *base,
base->global_outgoing_addrlen = len;
} else if (str_matches_option(option, "initial-probe-timeout:")) {
struct timeval tv;
- if (evdns_strtotimeval(val, &tv) == -1) return -1;
+ if (evdns_strtotimeval(val, &tv) == -1) return -1;
if (tv.tv_sec > 3600)
tv.tv_sec = 3600;
if (!(flags & DNS_OPTION_MISC)) return 0;
@@ -3553,18 +3553,18 @@ evdns_base_set_option_impl(struct evdns_base *base,
val);
memcpy(&base->global_nameserver_probe_initial_timeout, &tv,
sizeof(tv));
- } else if (str_matches_option(option, "so-rcvbuf:")) {
- int buf = strtoint(val);
+ } else if (str_matches_option(option, "so-rcvbuf:")) {
+ int buf = strtoint(val);
if (buf == -1) return -1;
- if (!(flags & DNS_OPTION_MISC)) return 0;
- log(EVDNS_LOG_DEBUG, "Setting SO_RCVBUF to %s", val);
- base->so_rcvbuf = buf;
- } else if (str_matches_option(option, "so-sndbuf:")) {
- int buf = strtoint(val);
+ if (!(flags & DNS_OPTION_MISC)) return 0;
+ log(EVDNS_LOG_DEBUG, "Setting SO_RCVBUF to %s", val);
+ base->so_rcvbuf = buf;
+ } else if (str_matches_option(option, "so-sndbuf:")) {
+ int buf = strtoint(val);
if (buf == -1) return -1;
- if (!(flags & DNS_OPTION_MISC)) return 0;
- log(EVDNS_LOG_DEBUG, "Setting SO_SNDBUF to %s", val);
- base->so_sndbuf = buf;
+ if (!(flags & DNS_OPTION_MISC)) return 0;
+ log(EVDNS_LOG_DEBUG, "Setting SO_SNDBUF to %s", val);
+ base->so_sndbuf = buf;
}
return 0;
}
@@ -3637,7 +3637,7 @@ evdns_base_resolv_conf_parse(struct evdns_base *base, int flags, const char *con
static char *
evdns_get_default_hosts_filename(void)
{
-#ifdef _WIN32
+#ifdef _WIN32
/* Windows is a little coy about where it puts its configuration
* files. Sure, they're _usually_ in C:\windows\system32, but
* there's no reason in principle they couldn't be in
@@ -3650,8 +3650,8 @@ evdns_get_default_hosts_filename(void)
if (! SHGetSpecialFolderPathA(NULL, path, CSIDL_SYSTEM, 0))
return NULL;
- len_out = strlen(path)+strlen(hostfile)+1;
- path_out = mm_malloc(len_out);
+ len_out = strlen(path)+strlen(hostfile)+1;
+ path_out = mm_malloc(len_out);
evutil_snprintf(path_out, len_out, "%s%s", path, hostfile);
return path_out;
#else
@@ -3665,14 +3665,14 @@ evdns_base_resolv_conf_parse_impl(struct evdns_base *base, int flags, const char
char *resolv;
char *start;
int err = 0;
- int add_default;
+ int add_default;
log(EVDNS_LOG_DEBUG, "Parsing resolv.conf file %s", filename);
- add_default = flags & DNS_OPTION_NAMESERVERS;
- if (flags & DNS_OPTION_NAMESERVERS_NO_DEFAULT)
- add_default = 0;
-
+ add_default = flags & DNS_OPTION_NAMESERVERS;
+ if (flags & DNS_OPTION_NAMESERVERS_NO_DEFAULT)
+ add_default = 0;
+
if (flags & DNS_OPTION_HOSTSFILE) {
char *fname = evdns_get_default_hosts_filename();
evdns_base_load_hosts(base, fname);
@@ -3680,12 +3680,12 @@ evdns_base_resolv_conf_parse_impl(struct evdns_base *base, int flags, const char
mm_free(fname);
}
- if (!filename) {
- evdns_resolv_set_defaults(base, flags);
- return 1;
- }
-
- if ((err = evutil_read_file_(filename, &resolv, &n, 0)) < 0) {
+ if (!filename) {
+ evdns_resolv_set_defaults(base, flags);
+ return 1;
+ }
+
+ if ((err = evutil_read_file_(filename, &resolv, &n, 0)) < 0) {
if (err == -1) {
/* No file. */
evdns_resolv_set_defaults(base, flags);
@@ -3708,7 +3708,7 @@ evdns_base_resolv_conf_parse_impl(struct evdns_base *base, int flags, const char
}
}
- if (!base->server_head && add_default) {
+ if (!base->server_head && add_default) {
/* no nameservers were configured. */
evdns_base_nameserver_ip_add(base, "127.0.0.1");
err = 6;
@@ -3729,7 +3729,7 @@ evdns_resolv_conf_parse(int flags, const char *const filename) {
}
-#ifdef _WIN32
+#ifdef _WIN32
/* Add multiple nameservers from a space-or-comma-separated list. */
static int
evdns_nameserver_ip_add_line(struct evdns_base *base, const char *ips) {
@@ -3772,7 +3772,7 @@ load_nameservers_with_getnetworkparams(struct evdns_base *base)
GetNetworkParams_fn_t fn;
ASSERT_LOCKED(base);
- if (!(handle = evutil_load_windows_system_library_(
+ if (!(handle = evutil_load_windows_system_library_(
TEXT("iphlpapi.dll")))) {
log(EVDNS_LOG_WARN, "Could not open iphlpapi.dll");
status = -1;
@@ -3931,12 +3931,12 @@ evdns_base_config_windows_nameservers(struct evdns_base *base)
if (base == NULL)
return -1;
EVDNS_LOCK(base);
- fname = evdns_get_default_hosts_filename();
- log(EVDNS_LOG_DEBUG, "Loading hosts entries from %s", fname);
- evdns_base_load_hosts(base, fname);
- if (fname)
- mm_free(fname);
-
+ fname = evdns_get_default_hosts_filename();
+ log(EVDNS_LOG_DEBUG, "Loading hosts entries from %s", fname);
+ evdns_base_load_hosts(base, fname);
+ if (fname)
+ mm_free(fname);
+
if (load_nameservers_with_getnetworkparams(base) == 0) {
EVDNS_UNLOCK(base);
return 0;
@@ -3960,7 +3960,7 @@ evdns_config_windows_nameservers(void)
#endif
struct evdns_base *
-evdns_base_new(struct event_base *event_base, int flags)
+evdns_base_new(struct event_base *event_base, int flags)
{
struct evdns_base *base;
@@ -3973,8 +3973,8 @@ evdns_base_new(struct event_base *event_base, int flags)
/* Give the evutil library a hook into its evdns-enabled
* functionality. We can't just call evdns_getaddrinfo directly or
* else libevent-core will depend on libevent-extras. */
- evutil_set_evdns_getaddrinfo_fn_(evdns_getaddrinfo);
- evutil_set_evdns_getaddrinfo_cancel_fn_(evdns_getaddrinfo_cancel);
+ evutil_set_evdns_getaddrinfo_fn_(evdns_getaddrinfo);
+ evutil_set_evdns_getaddrinfo_cancel_fn_(evdns_getaddrinfo_cancel);
base = mm_malloc(sizeof(struct evdns_base));
if (base == NULL)
@@ -4009,41 +4009,41 @@ evdns_base_new(struct event_base *event_base, int flags)
TAILQ_INIT(&base->hostsdb);
-#define EVDNS_BASE_ALL_FLAGS ( \
- EVDNS_BASE_INITIALIZE_NAMESERVERS | \
- EVDNS_BASE_DISABLE_WHEN_INACTIVE | \
- EVDNS_BASE_NAMESERVERS_NO_DEFAULT | \
- 0)
-
- if (flags & ~EVDNS_BASE_ALL_FLAGS) {
- flags = EVDNS_BASE_INITIALIZE_NAMESERVERS;
- log(EVDNS_LOG_WARN,
- "Unrecognized flag passed to evdns_base_new(). Assuming "
- "you meant EVDNS_BASE_INITIALIZE_NAMESERVERS.");
- }
-#undef EVDNS_BASE_ALL_FLAGS
-
- if (flags & EVDNS_BASE_INITIALIZE_NAMESERVERS) {
+#define EVDNS_BASE_ALL_FLAGS ( \
+ EVDNS_BASE_INITIALIZE_NAMESERVERS | \
+ EVDNS_BASE_DISABLE_WHEN_INACTIVE | \
+ EVDNS_BASE_NAMESERVERS_NO_DEFAULT | \
+ 0)
+
+ if (flags & ~EVDNS_BASE_ALL_FLAGS) {
+ flags = EVDNS_BASE_INITIALIZE_NAMESERVERS;
+ log(EVDNS_LOG_WARN,
+ "Unrecognized flag passed to evdns_base_new(). Assuming "
+ "you meant EVDNS_BASE_INITIALIZE_NAMESERVERS.");
+ }
+#undef EVDNS_BASE_ALL_FLAGS
+
+ if (flags & EVDNS_BASE_INITIALIZE_NAMESERVERS) {
int r;
- int opts = DNS_OPTIONS_ALL;
- if (flags & EVDNS_BASE_NAMESERVERS_NO_DEFAULT) {
- opts |= DNS_OPTION_NAMESERVERS_NO_DEFAULT;
- }
-
-#ifdef _WIN32
+ int opts = DNS_OPTIONS_ALL;
+ if (flags & EVDNS_BASE_NAMESERVERS_NO_DEFAULT) {
+ opts |= DNS_OPTION_NAMESERVERS_NO_DEFAULT;
+ }
+
+#ifdef _WIN32
r = evdns_base_config_windows_nameservers(base);
#else
- r = evdns_base_resolv_conf_parse(base, opts, "/etc/resolv.conf");
+ r = evdns_base_resolv_conf_parse(base, opts, "/etc/resolv.conf");
#endif
if (r) {
evdns_base_free_and_unlock(base, 0);
return NULL;
}
}
- if (flags & EVDNS_BASE_DISABLE_WHEN_INACTIVE) {
- base->disable_when_inactive = 1;
- }
-
+ if (flags & EVDNS_BASE_DISABLE_WHEN_INACTIVE) {
+ base->disable_when_inactive = 1;
+ }
+
EVDNS_UNLOCK(base);
return base;
}
@@ -4085,7 +4085,7 @@ static void
evdns_nameserver_free(struct nameserver *server)
{
if (server->socket >= 0)
- evutil_closesocket(server->socket);
+ evutil_closesocket(server->socket);
(void) event_del(&server->event);
event_debug_unassign(&server->event);
if (server->state == 0)
@@ -4123,16 +4123,16 @@ evdns_base_free_and_unlock(struct evdns_base *base, int fail_requests)
}
base->global_requests_inflight = base->global_requests_waiting = 0;
- for (server = base->server_head; server; server = server_next) {
- server_next = server->next;
- /** already done something before */
- server->probe_request = NULL;
- evdns_nameserver_free(server);
- if (server_next == base->server_head)
- break;
- }
- base->server_head = NULL;
- base->global_good_nameservers = 0;
+ for (server = base->server_head; server; server = server_next) {
+ server_next = server->next;
+ /** already done something before */
+ server->probe_request = NULL;
+ evdns_nameserver_free(server);
+ if (server_next == base->server_head)
+ break;
+ }
+ base->server_head = NULL;
+ base->global_good_nameservers = 0;
if (base->global_search_state) {
for (dom = base->global_search_state->head; dom; dom = dom_next) {
@@ -4167,18 +4167,18 @@ evdns_base_free(struct evdns_base *base, int fail_requests)
}
void
-evdns_base_clear_host_addresses(struct evdns_base *base)
-{
- struct hosts_entry *victim;
- EVDNS_LOCK(base);
- while ((victim = TAILQ_FIRST(&base->hostsdb))) {
- TAILQ_REMOVE(&base->hostsdb, victim, next);
- mm_free(victim);
- }
- EVDNS_UNLOCK(base);
-}
-
-void
+evdns_base_clear_host_addresses(struct evdns_base *base)
+{
+ struct hosts_entry *victim;
+ EVDNS_LOCK(base);
+ while ((victim = TAILQ_FIRST(&base->hostsdb))) {
+ TAILQ_REMOVE(&base->hostsdb, victim, next);
+ mm_free(victim);
+ }
+ EVDNS_UNLOCK(base);
+}
+
+void
evdns_shutdown(int fail_requests)
{
if (current_base) {
@@ -4253,7 +4253,7 @@ evdns_base_load_hosts_impl(struct evdns_base *base, const char *hosts_fname)
ASSERT_LOCKED(base);
if (hosts_fname == NULL ||
- (err = evutil_read_file_(hosts_fname, &str, &len, 0)) < 0) {
+ (err = evutil_read_file_(hosts_fname, &str, &len, 0)) < 0) {
char tmp[64];
strlcpy(tmp, "127.0.0.1 localhost", sizeof(tmp));
evdns_base_parse_hosts_line(base, tmp);
@@ -4482,22 +4482,22 @@ evdns_getaddrinfo_gotresolve(int result, char type, int count,
other_req = &data->ipv4_request;
}
- /** Called from evdns_base_free() with @fail_requests == 1 */
- if (result != DNS_ERR_SHUTDOWN) {
- EVDNS_LOCK(data->evdns_base);
- if (evdns_result_is_answer(result)) {
- if (req->type == DNS_IPv4_A)
- ++data->evdns_base->getaddrinfo_ipv4_answered;
- else
- ++data->evdns_base->getaddrinfo_ipv6_answered;
- }
- user_canceled = data->user_canceled;
- if (other_req->r == NULL)
- data->request_done = 1;
- EVDNS_UNLOCK(data->evdns_base);
- } else {
- data->evdns_base = NULL;
- user_canceled = data->user_canceled;
+ /** Called from evdns_base_free() with @fail_requests == 1 */
+ if (result != DNS_ERR_SHUTDOWN) {
+ EVDNS_LOCK(data->evdns_base);
+ if (evdns_result_is_answer(result)) {
+ if (req->type == DNS_IPv4_A)
+ ++data->evdns_base->getaddrinfo_ipv4_answered;
+ else
+ ++data->evdns_base->getaddrinfo_ipv6_answered;
+ }
+ user_canceled = data->user_canceled;
+ if (other_req->r == NULL)
+ data->request_done = 1;
+ EVDNS_UNLOCK(data->evdns_base);
+ } else {
+ data->evdns_base = NULL;
+ user_canceled = data->user_canceled;
}
req->r = NULL;
@@ -4532,9 +4532,9 @@ evdns_getaddrinfo_gotresolve(int result, char type, int count,
/* The other request is still working; maybe it will
* succeed. */
/* XXXX handle failure from set_timeout */
- if (result != DNS_ERR_SHUTDOWN) {
- evdns_getaddrinfo_set_timeout(data->evdns_base, data);
- }
+ if (result != DNS_ERR_SHUTDOWN) {
+ evdns_getaddrinfo_set_timeout(data->evdns_base, data);
+ }
data->pending_error = err;
return;
}
@@ -4595,7 +4595,7 @@ evdns_getaddrinfo_gotresolve(int result, char type, int count,
for (i=0; i < count; ++i) {
struct evutil_addrinfo *ai;
memcpy(addrp, ((char*)addresses)+i*addrlen, addrlen);
- ai = evutil_new_addrinfo_(sa, socklen, &data->hints);
+ ai = evutil_new_addrinfo_(sa, socklen, &data->hints);
if (!ai) {
if (other_req->r) {
evdns_cancel_request(NULL, other_req->r);
@@ -4608,7 +4608,7 @@ evdns_getaddrinfo_gotresolve(int result, char type, int count,
free_getaddrinfo_request(data);
return;
}
- res = evutil_addrinfo_append_(res, ai);
+ res = evutil_addrinfo_append_(res, ai);
}
if (other_req->r) {
@@ -4622,10 +4622,10 @@ evdns_getaddrinfo_gotresolve(int result, char type, int count,
* results (if any) and return them. */
if (data->pending_result) {
if (req->type == DNS_IPv4_A)
- res = evutil_addrinfo_append_(res,
+ res = evutil_addrinfo_append_(res,
data->pending_result);
else
- res = evutil_addrinfo_append_(
+ res = evutil_addrinfo_append_(
data->pending_result, res);
data->pending_result = NULL;
}
@@ -4675,13 +4675,13 @@ evdns_getaddrinfo_fromhosts(struct evdns_base *base,
if ((e->addr.sa.sa_family == AF_INET && f == PF_INET6) ||
(e->addr.sa.sa_family == AF_INET6 && f == PF_INET))
continue;
- ai_new = evutil_new_addrinfo_(&e->addr.sa, e->addrlen, hints);
+ ai_new = evutil_new_addrinfo_(&e->addr.sa, e->addrlen, hints);
if (!ai_new) {
n_found = 0;
goto out;
}
sockaddr_setport(ai_new->ai_addr, port);
- ai = evutil_addrinfo_append_(ai, ai_new);
+ ai = evutil_addrinfo_append_(ai, ai_new);
}
EVDNS_UNLOCK(base);
out:
@@ -4709,7 +4709,7 @@ evdns_getaddrinfo(struct evdns_base *dns_base,
int err;
int port = 0;
int want_cname = 0;
- int started = 0;
+ int started = 0;
if (!dns_base) {
dns_base = current_base;
@@ -4737,14 +4737,14 @@ evdns_getaddrinfo(struct evdns_base *dns_base,
hints.ai_family = PF_UNSPEC;
}
- evutil_adjust_hints_for_addrconfig_(&hints);
+ evutil_adjust_hints_for_addrconfig_(&hints);
/* Now try to see if we _can_ answer immediately. */
/* (It would be nice to do this by calling getaddrinfo directly, with
* AI_NUMERICHOST, on plaforms that have it, but we can't: there isn't
* a reliable way to distinguish the "that wasn't a numeric host!" case
* from any other EAI_NONAME cases.) */
- err = evutil_getaddrinfo_common_(nodename, servname, &hints, &res, &port);
+ err = evutil_getaddrinfo_common_(nodename, servname, &hints, &res, &port);
if (err != EVUTIL_EAI_NEED_RESOLVE) {
cb(err, res, arg);
return NULL;
@@ -4788,8 +4788,8 @@ evdns_getaddrinfo(struct evdns_base *dns_base,
* launching those requests. (XXX we don't do that yet.)
*/
- EVDNS_LOCK(dns_base);
-
+ EVDNS_LOCK(dns_base);
+
if (hints.ai_family != PF_INET6) {
log(EVDNS_LOG_DEBUG, "Sending request for %s on ipv4 as %p",
nodename, &data->ipv4_request);
@@ -4797,7 +4797,7 @@ evdns_getaddrinfo(struct evdns_base *dns_base,
data->ipv4_request.r = evdns_base_resolve_ipv4(dns_base,
nodename, 0, evdns_getaddrinfo_gotresolve,
&data->ipv4_request);
- if (want_cname && data->ipv4_request.r)
+ if (want_cname && data->ipv4_request.r)
data->ipv4_request.r->current_req->put_cname_in_ptr =
&data->cname_result;
}
@@ -4808,7 +4808,7 @@ evdns_getaddrinfo(struct evdns_base *dns_base,
data->ipv6_request.r = evdns_base_resolve_ipv6(dns_base,
nodename, 0, evdns_getaddrinfo_gotresolve,
&data->ipv6_request);
- if (want_cname && data->ipv6_request.r)
+ if (want_cname && data->ipv6_request.r)
data->ipv6_request.r->current_req->put_cname_in_ptr =
&data->cname_result;
}
@@ -4816,11 +4816,11 @@ evdns_getaddrinfo(struct evdns_base *dns_base,
evtimer_assign(&data->timeout, dns_base->event_base,
evdns_getaddrinfo_timeout_cb, data);
- started = (data->ipv4_request.r || data->ipv6_request.r);
-
- EVDNS_UNLOCK(dns_base);
-
- if (started) {
+ started = (data->ipv4_request.r || data->ipv6_request.r);
+
+ EVDNS_UNLOCK(dns_base);
+
+ if (started) {
return data;
} else {
mm_free(data);
diff --git a/contrib/libs/libevent/event-internal.h b/contrib/libs/libevent/event-internal.h
index 9e5ff42447..05a595febf 100644
--- a/contrib/libs/libevent/event-internal.h
+++ b/contrib/libs/libevent/event-internal.h
@@ -24,16 +24,16 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT_INTERNAL_H_INCLUDED_
-#define EVENT_INTERNAL_H_INCLUDED_
+#ifndef EVENT_INTERNAL_H_INCLUDED_
+#define EVENT_INTERNAL_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
#endif
#include "event2/event-config.h"
-#include "evconfig-private.h"
-
+#include "evconfig-private.h"
+
#include <time.h>
#include <sys/queue.h>
#include "event2/event_struct.h"
@@ -45,43 +45,43 @@ extern "C" {
/* map union members back */
/* mutually exclusive */
-#define ev_signal_next ev_.ev_signal.ev_signal_next
-#define ev_io_next ev_.ev_io.ev_io_next
-#define ev_io_timeout ev_.ev_io.ev_timeout
+#define ev_signal_next ev_.ev_signal.ev_signal_next
+#define ev_io_next ev_.ev_io.ev_io_next
+#define ev_io_timeout ev_.ev_io.ev_timeout
/* used only by signals */
-#define ev_ncalls ev_.ev_signal.ev_ncalls
-#define ev_pncalls ev_.ev_signal.ev_pncalls
-
-#define ev_pri ev_evcallback.evcb_pri
-#define ev_flags ev_evcallback.evcb_flags
-#define ev_closure ev_evcallback.evcb_closure
-#define ev_callback ev_evcallback.evcb_cb_union.evcb_callback
-#define ev_arg ev_evcallback.evcb_arg
-
-/** @name Event closure codes
-
- Possible values for evcb_closure in struct event_callback
-
- @{
- */
-/** A regular event. Uses the evcb_callback callback */
-#define EV_CLOSURE_EVENT 0
-/** A signal event. Uses the evcb_callback callback */
-#define EV_CLOSURE_EVENT_SIGNAL 1
-/** A persistent non-signal event. Uses the evcb_callback callback */
-#define EV_CLOSURE_EVENT_PERSIST 2
-/** A simple callback. Uses the evcb_selfcb callback. */
-#define EV_CLOSURE_CB_SELF 3
-/** A finalizing callback. Uses the evcb_cbfinalize callback. */
-#define EV_CLOSURE_CB_FINALIZE 4
-/** A finalizing event. Uses the evcb_evfinalize callback. */
-#define EV_CLOSURE_EVENT_FINALIZE 5
-/** A finalizing event that should get freed after. Uses the evcb_evfinalize
- * callback. */
-#define EV_CLOSURE_EVENT_FINALIZE_FREE 6
-/** @} */
-
+#define ev_ncalls ev_.ev_signal.ev_ncalls
+#define ev_pncalls ev_.ev_signal.ev_pncalls
+
+#define ev_pri ev_evcallback.evcb_pri
+#define ev_flags ev_evcallback.evcb_flags
+#define ev_closure ev_evcallback.evcb_closure
+#define ev_callback ev_evcallback.evcb_cb_union.evcb_callback
+#define ev_arg ev_evcallback.evcb_arg
+
+/** @name Event closure codes
+
+ Possible values for evcb_closure in struct event_callback
+
+ @{
+ */
+/** A regular event. Uses the evcb_callback callback */
+#define EV_CLOSURE_EVENT 0
+/** A signal event. Uses the evcb_callback callback */
+#define EV_CLOSURE_EVENT_SIGNAL 1
+/** A persistent non-signal event. Uses the evcb_callback callback */
+#define EV_CLOSURE_EVENT_PERSIST 2
+/** A simple callback. Uses the evcb_selfcb callback. */
+#define EV_CLOSURE_CB_SELF 3
+/** A finalizing callback. Uses the evcb_cbfinalize callback. */
+#define EV_CLOSURE_CB_FINALIZE 4
+/** A finalizing event. Uses the evcb_evfinalize callback. */
+#define EV_CLOSURE_EVENT_FINALIZE 5
+/** A finalizing event that should get freed after. Uses the evcb_evfinalize
+ * callback. */
+#define EV_CLOSURE_EVENT_FINALIZE_FREE 6
+/** @} */
+
/** Structure to define the backend of a given event_base. */
struct eventop {
/** The name of this backend. */
@@ -125,7 +125,7 @@ struct eventop {
size_t fdinfo_len;
};
-#ifdef _WIN32
+#ifdef _WIN32
/* If we're on win32, then file descriptors are not nice low densely packed
integers. Instead, they are pointer-like windows handles, and we want to
use a hashtable instead of an array to map fds to events.
@@ -136,7 +136,7 @@ struct eventop {
/* #define HT_CACHE_HASH_VALS */
#ifdef EVMAP_USE_HT
-#define HT_NO_CACHE_HASH_VALUES
+#define HT_NO_CACHE_HASH_VALUES
#include "ht-internal.h"
struct event_map_entry;
HT_HEAD(event_io_map, event_map_entry);
@@ -186,25 +186,25 @@ struct event_changelist {
int changes_size;
};
-#ifndef EVENT__DISABLE_DEBUG_MODE
+#ifndef EVENT__DISABLE_DEBUG_MODE
/* Global internal flag: set to one if debug mode is on. */
-extern int event_debug_mode_on_;
-#define EVENT_DEBUG_MODE_IS_ON() (event_debug_mode_on_)
+extern int event_debug_mode_on_;
+#define EVENT_DEBUG_MODE_IS_ON() (event_debug_mode_on_)
#else
#define EVENT_DEBUG_MODE_IS_ON() (0)
#endif
-TAILQ_HEAD(evcallback_list, event_callback);
-
-/* Sets up an event for processing once */
-struct event_once {
- LIST_ENTRY(event_once) next_once;
- struct event ev;
-
- void (*cb)(evutil_socket_t, short, void *);
- void *arg;
-};
-
+TAILQ_HEAD(evcallback_list, event_callback);
+
+/* Sets up an event for processing once */
+struct event_once {
+ LIST_ENTRY(event_once) next_once;
+ struct event ev;
+
+ void (*cb)(evutil_socket_t, short, void *);
+ void *arg;
+};
+
struct event_base {
/** Function pointers and other data to describe this event_base's
* backend. */
@@ -219,21 +219,21 @@ struct event_base {
/** Function pointers used to describe the backend that this event_base
* uses for signals */
const struct eventop *evsigsel;
- /** Data to implement the common signal handler code. */
+ /** Data to implement the common signal handler code. */
struct evsig_info sig;
/** Number of virtual events */
int virtual_event_count;
- /** Maximum number of virtual events active */
- int virtual_event_count_max;
+ /** Maximum number of virtual events active */
+ int virtual_event_count_max;
/** Number of total events added to this event_base */
int event_count;
- /** Maximum number of total events added to this event_base */
- int event_count_max;
+ /** Maximum number of total events added to this event_base */
+ int event_count_max;
/** Number of total events active in this event_base */
int event_count_active;
- /** Maximum number of total events active in this event_base */
- int event_count_active_max;
+ /** Maximum number of total events active in this event_base */
+ int event_count_active_max;
/** Set if we should terminate the loop once we're done processing
* events. */
@@ -250,23 +250,23 @@ struct event_base {
* reentrant invocation. */
int running_loop;
- /** Set to the number of deferred_cbs we've made 'active' in the
- * loop. This is a hack to prevent starvation; it would be smarter
- * to just use event_config_set_max_dispatch_interval's max_callbacks
- * feature */
- int n_deferreds_queued;
-
+ /** Set to the number of deferred_cbs we've made 'active' in the
+ * loop. This is a hack to prevent starvation; it would be smarter
+ * to just use event_config_set_max_dispatch_interval's max_callbacks
+ * feature */
+ int n_deferreds_queued;
+
/* Active event management. */
- /** An array of nactivequeues queues for active event_callbacks (ones
- * that have triggered, and whose callbacks need to be called). Low
+ /** An array of nactivequeues queues for active event_callbacks (ones
+ * that have triggered, and whose callbacks need to be called). Low
* priority numbers are more important, and stall higher ones.
*/
- struct evcallback_list *activequeues;
+ struct evcallback_list *activequeues;
/** The length of the activequeues array */
int nactivequeues;
- /** A list of event_callbacks that should become active the next time
- * we process events, but not this time. */
- struct evcallback_list active_later_queue;
+ /** A list of event_callbacks that should become active the next time
+ * we process events, but not this time. */
+ struct evcallback_list active_later_queue;
/* common timeout logic */
@@ -291,15 +291,15 @@ struct event_base {
* too often. */
struct timeval tv_cache;
- struct evutil_monotonic_timer monotonic_timer;
-
+ struct evutil_monotonic_timer monotonic_timer;
+
/** Difference between internal time (maybe from clock_gettime) and
* gettimeofday. */
struct timeval tv_clock_diff;
/** Second in which we last updated tv_clock_diff, in monotonic time. */
time_t last_updated_clock_diff;
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
/* threading support */
/** The thread currently running the event_loop for this base */
unsigned long th_owner_id;
@@ -311,10 +311,10 @@ struct event_base {
/** Number of threads blocking on current_event_cond. */
int current_event_waiters;
#endif
- /** The event whose callback is executing right now */
- struct event_callback *current_event;
+ /** The event whose callback is executing right now */
+ struct event_callback *current_event;
-#ifdef _WIN32
+#ifdef _WIN32
/** IOCP support structure, if IOCP is enabled. */
struct event_iocp_port *iocp;
#endif
@@ -322,10 +322,10 @@ struct event_base {
/** Flags that this base was configured with */
enum event_base_config_flag flags;
- struct timeval max_dispatch_time;
- int max_dispatch_callbacks;
- int limit_callbacks_after_prio;
-
+ struct timeval max_dispatch_time;
+ int max_dispatch_callbacks;
+ int limit_callbacks_after_prio;
+
/* Notify main thread to wake up break, etc. */
/** True if the base already has a pending notify, and we don't need
* to add any more. */
@@ -338,14 +338,14 @@ struct event_base {
struct event th_notify;
/** A function used to wake up the main thread from another thread. */
int (*th_notify_fn)(struct event_base *base);
-
- /** Saved seed for weak random number generator. Some backends use
- * this to produce fairness among sockets. Protected by th_base_lock. */
- struct evutil_weakrand_state weakrand_seed;
-
- /** List of event_onces that have not yet fired. */
- LIST_HEAD(once_event_list, event_once) once_events;
-
+
+ /** Saved seed for weak random number generator. Some backends use
+ * this to produce fairness among sockets. Protected by th_base_lock. */
+ struct evutil_weakrand_state weakrand_seed;
+
+ /** List of event_onces that have not yet fired. */
+ LIST_HEAD(once_event_list, event_once) once_events;
+
};
struct event_config_entry {
@@ -360,18 +360,18 @@ struct event_config {
TAILQ_HEAD(event_configq, event_config_entry) entries;
int n_cpus_hint;
- struct timeval max_dispatch_interval;
- int max_dispatch_callbacks;
- int limit_callbacks_after_prio;
+ struct timeval max_dispatch_interval;
+ int max_dispatch_callbacks;
+ int limit_callbacks_after_prio;
enum event_method_feature require_features;
enum event_base_config_flag flags;
};
/* Internal use only: Functions that might be missing from <sys/queue.h> */
-#ifndef LIST_END
-#define LIST_END(head) NULL
-#endif
-
+#ifndef LIST_END
+#define LIST_END(head) NULL
+#endif
+
#ifndef TAILQ_FIRST
#define TAILQ_FIRST(head) ((head)->tqh_first)
#endif
@@ -399,58 +399,58 @@ struct event_config {
#endif
#define N_ACTIVE_CALLBACKS(base) \
- ((base)->event_count_active)
+ ((base)->event_count_active)
-int evsig_set_handler_(struct event_base *base, int evsignal,
+int evsig_set_handler_(struct event_base *base, int evsignal,
void (*fn)(int));
-int evsig_restore_handler_(struct event_base *base, int evsignal);
-
-int event_add_nolock_(struct event *ev,
- const struct timeval *tv, int tv_is_absolute);
-/** Argument for event_del_nolock_. Tells event_del not to block on the event
- * if it's running in another thread. */
-#define EVENT_DEL_NOBLOCK 0
-/** Argument for event_del_nolock_. Tells event_del to block on the event
- * if it's running in another thread, regardless of its value for EV_FINALIZE
- */
-#define EVENT_DEL_BLOCK 1
-/** Argument for event_del_nolock_. Tells event_del to block on the event
- * if it is running in another thread and it doesn't have EV_FINALIZE set.
- */
-#define EVENT_DEL_AUTOBLOCK 2
+int evsig_restore_handler_(struct event_base *base, int evsignal);
+
+int event_add_nolock_(struct event *ev,
+ const struct timeval *tv, int tv_is_absolute);
+/** Argument for event_del_nolock_. Tells event_del not to block on the event
+ * if it's running in another thread. */
+#define EVENT_DEL_NOBLOCK 0
+/** Argument for event_del_nolock_. Tells event_del to block on the event
+ * if it's running in another thread, regardless of its value for EV_FINALIZE
+ */
+#define EVENT_DEL_BLOCK 1
+/** Argument for event_del_nolock_. Tells event_del to block on the event
+ * if it is running in another thread and it doesn't have EV_FINALIZE set.
+ */
+#define EVENT_DEL_AUTOBLOCK 2
/** Argument for event_del_nolock_. Tells event_del to proceed even if the
- * event is set up for finalization rather for regular use.*/
-#define EVENT_DEL_EVEN_IF_FINALIZING 3
-int event_del_nolock_(struct event *ev, int blocking);
-int event_remove_timer_nolock_(struct event *ev);
-
-void event_active_nolock_(struct event *ev, int res, short count);
-EVENT2_EXPORT_SYMBOL
-int event_callback_activate_(struct event_base *, struct event_callback *);
-int event_callback_activate_nolock_(struct event_base *, struct event_callback *);
-int event_callback_cancel_(struct event_base *base,
- struct event_callback *evcb);
-
-void event_callback_finalize_nolock_(struct event_base *base, unsigned flags, struct event_callback *evcb, void (*cb)(struct event_callback *, void *));
-EVENT2_EXPORT_SYMBOL
-void event_callback_finalize_(struct event_base *base, unsigned flags, struct event_callback *evcb, void (*cb)(struct event_callback *, void *));
-int event_callback_finalize_many_(struct event_base *base, int n_cbs, struct event_callback **evcb, void (*cb)(struct event_callback *, void *));
-
-
-EVENT2_EXPORT_SYMBOL
-void event_active_later_(struct event *ev, int res);
-void event_active_later_nolock_(struct event *ev, int res);
-int event_callback_activate_later_nolock_(struct event_base *base,
- struct event_callback *evcb);
-int event_callback_cancel_nolock_(struct event_base *base,
- struct event_callback *evcb, int even_if_finalizing);
-void event_callback_init_(struct event_base *base,
- struct event_callback *cb);
-
+ * event is set up for finalization rather for regular use.*/
+#define EVENT_DEL_EVEN_IF_FINALIZING 3
+int event_del_nolock_(struct event *ev, int blocking);
+int event_remove_timer_nolock_(struct event *ev);
+
+void event_active_nolock_(struct event *ev, int res, short count);
+EVENT2_EXPORT_SYMBOL
+int event_callback_activate_(struct event_base *, struct event_callback *);
+int event_callback_activate_nolock_(struct event_base *, struct event_callback *);
+int event_callback_cancel_(struct event_base *base,
+ struct event_callback *evcb);
+
+void event_callback_finalize_nolock_(struct event_base *base, unsigned flags, struct event_callback *evcb, void (*cb)(struct event_callback *, void *));
+EVENT2_EXPORT_SYMBOL
+void event_callback_finalize_(struct event_base *base, unsigned flags, struct event_callback *evcb, void (*cb)(struct event_callback *, void *));
+int event_callback_finalize_many_(struct event_base *base, int n_cbs, struct event_callback **evcb, void (*cb)(struct event_callback *, void *));
+
+
+EVENT2_EXPORT_SYMBOL
+void event_active_later_(struct event *ev, int res);
+void event_active_later_nolock_(struct event *ev, int res);
+int event_callback_activate_later_nolock_(struct event_base *base,
+ struct event_callback *evcb);
+int event_callback_cancel_nolock_(struct event_base *base,
+ struct event_callback *evcb, int even_if_finalizing);
+void event_callback_init_(struct event_base *base,
+ struct event_callback *cb);
+
/* FIXME document. */
-EVENT2_EXPORT_SYMBOL
-void event_base_add_virtual_(struct event_base *base);
-void event_base_del_virtual_(struct event_base *base);
+EVENT2_EXPORT_SYMBOL
+void event_base_add_virtual_(struct event_base *base);
+void event_base_del_virtual_(struct event_base *base);
/** For debugging: unless assertions are disabled, verify the referential
integrity of the internal data structures of 'base'. This operation can
@@ -458,31 +458,31 @@ void event_base_del_virtual_(struct event_base *base);
Returns on success; aborts on failure.
*/
-EVENT2_EXPORT_SYMBOL
-void event_base_assert_ok_(struct event_base *base);
-void event_base_assert_ok_nolock_(struct event_base *base);
-
-
-/* Helper function: Call 'fn' exactly once every inserted or active event in
- * the event_base 'base'.
- *
- * If fn returns 0, continue on to the next event. Otherwise, return the same
- * value that fn returned.
- *
- * Requires that 'base' be locked.
- */
-int event_base_foreach_event_nolock_(struct event_base *base,
- event_base_foreach_event_cb cb, void *arg);
-
-/* Cleanup function to reset debug mode during shutdown.
- *
- * Calling this function doesn't mean it'll be possible to re-enable
- * debug mode if any events were added.
- */
-void event_disable_debug_mode(void);
-
+EVENT2_EXPORT_SYMBOL
+void event_base_assert_ok_(struct event_base *base);
+void event_base_assert_ok_nolock_(struct event_base *base);
+
+
+/* Helper function: Call 'fn' exactly once every inserted or active event in
+ * the event_base 'base'.
+ *
+ * If fn returns 0, continue on to the next event. Otherwise, return the same
+ * value that fn returned.
+ *
+ * Requires that 'base' be locked.
+ */
+int event_base_foreach_event_nolock_(struct event_base *base,
+ event_base_foreach_event_cb cb, void *arg);
+
+/* Cleanup function to reset debug mode during shutdown.
+ *
+ * Calling this function doesn't mean it'll be possible to re-enable
+ * debug mode if any events were added.
+ */
+void event_disable_debug_mode(void);
+
#ifdef __cplusplus
}
#endif
-#endif /* EVENT_INTERNAL_H_INCLUDED_ */
+#endif /* EVENT_INTERNAL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/event.c b/contrib/libs/libevent/event.c
index 7a42b73191..fe147e54a2 100644
--- a/contrib/libs/libevent/event.c
+++ b/contrib/libs/libevent/event.c
@@ -25,25 +25,25 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
#include <sys/types.h>
-#if !defined(_WIN32) && defined(EVENT__HAVE_SYS_TIME_H)
+#if !defined(_WIN32) && defined(EVENT__HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifdef EVENT__HAVE_SYS_SOCKET_H
+#ifdef EVENT__HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <stdio.h>
#include <stdlib.h>
-#ifdef EVENT__HAVE_UNISTD_H
+#ifdef EVENT__HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
@@ -51,10 +51,10 @@
#include <signal.h>
#include <string.h>
#include <time.h>
-#include <limits.h>
-#ifdef EVENT__HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
+#include <limits.h>
+#ifdef EVENT__HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
#include "event2/event.h"
#include "event2/event_struct.h"
@@ -68,91 +68,91 @@
#include "evmap-internal.h"
#include "iocp-internal.h"
#include "changelist-internal.h"
-#define HT_NO_CACHE_HASH_VALUES
+#define HT_NO_CACHE_HASH_VALUES
#include "ht-internal.h"
#include "util-internal.h"
-
-#ifdef EVENT__HAVE_WORKING_KQUEUE
-#include "kqueue-internal.h"
-#endif
-
-#ifdef EVENT__HAVE_EVENT_PORTS
+
+#ifdef EVENT__HAVE_WORKING_KQUEUE
+#include "kqueue-internal.h"
+#endif
+
+#ifdef EVENT__HAVE_EVENT_PORTS
extern const struct eventop evportops;
#endif
-#ifdef EVENT__HAVE_SELECT
+#ifdef EVENT__HAVE_SELECT
extern const struct eventop selectops;
#endif
-#ifdef EVENT__HAVE_POLL
+#ifdef EVENT__HAVE_POLL
extern const struct eventop pollops;
#endif
-#ifdef EVENT__HAVE_EPOLL
+#ifdef EVENT__HAVE_EPOLL
extern const struct eventop epollops;
#endif
-#ifdef EVENT__HAVE_WORKING_KQUEUE
+#ifdef EVENT__HAVE_WORKING_KQUEUE
extern const struct eventop kqops;
#endif
-#ifdef EVENT__HAVE_DEVPOLL
+#ifdef EVENT__HAVE_DEVPOLL
extern const struct eventop devpollops;
#endif
-#ifdef _WIN32
+#ifdef _WIN32
extern const struct eventop win32ops;
#endif
/* Array of backends in order of preference. */
static const struct eventop *eventops[] = {
-#ifdef EVENT__HAVE_EVENT_PORTS
+#ifdef EVENT__HAVE_EVENT_PORTS
&evportops,
#endif
-#ifdef EVENT__HAVE_WORKING_KQUEUE
+#ifdef EVENT__HAVE_WORKING_KQUEUE
&kqops,
#endif
-#ifdef EVENT__HAVE_EPOLL
+#ifdef EVENT__HAVE_EPOLL
&epollops,
#endif
-#ifdef EVENT__HAVE_DEVPOLL
+#ifdef EVENT__HAVE_DEVPOLL
&devpollops,
#endif
-#ifdef EVENT__HAVE_POLL
+#ifdef EVENT__HAVE_POLL
&pollops,
#endif
-#ifdef EVENT__HAVE_SELECT
+#ifdef EVENT__HAVE_SELECT
&selectops,
#endif
-#ifdef _WIN32
+#ifdef _WIN32
&win32ops,
#endif
NULL
};
/* Global state; deprecated */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct event_base *event_global_current_base_ = NULL;
#define current_base event_global_current_base_
/* Global state */
-static void *event_self_cbarg_ptr_ = NULL;
+static void *event_self_cbarg_ptr_ = NULL;
/* Prototypes */
-static void event_queue_insert_active(struct event_base *, struct event_callback *);
-static void event_queue_insert_active_later(struct event_base *, struct event_callback *);
-static void event_queue_insert_timeout(struct event_base *, struct event *);
-static void event_queue_insert_inserted(struct event_base *, struct event *);
-static void event_queue_remove_active(struct event_base *, struct event_callback *);
-static void event_queue_remove_active_later(struct event_base *, struct event_callback *);
-static void event_queue_remove_timeout(struct event_base *, struct event *);
-static void event_queue_remove_inserted(struct event_base *, struct event *);
-static void event_queue_make_later_events_active(struct event_base *base);
-
-static int evthread_make_base_notifiable_nolock_(struct event_base *base);
-static int event_del_(struct event *ev, int blocking);
-
-#ifdef USE_REINSERT_TIMEOUT
-/* This code seems buggy; only turn it on if we find out what the trouble is. */
-static void event_queue_reinsert_timeout(struct event_base *,struct event *, int was_common, int is_common, int old_timeout_idx);
-#endif
-
+static void event_queue_insert_active(struct event_base *, struct event_callback *);
+static void event_queue_insert_active_later(struct event_base *, struct event_callback *);
+static void event_queue_insert_timeout(struct event_base *, struct event *);
+static void event_queue_insert_inserted(struct event_base *, struct event *);
+static void event_queue_remove_active(struct event_base *, struct event_callback *);
+static void event_queue_remove_active_later(struct event_base *, struct event_callback *);
+static void event_queue_remove_timeout(struct event_base *, struct event *);
+static void event_queue_remove_inserted(struct event_base *, struct event *);
+static void event_queue_make_later_events_active(struct event_base *base);
+
+static int evthread_make_base_notifiable_nolock_(struct event_base *base);
+static int event_del_(struct event *ev, int blocking);
+
+#ifdef USE_REINSERT_TIMEOUT
+/* This code seems buggy; only turn it on if we find out what the trouble is. */
+static void event_queue_reinsert_timeout(struct event_base *,struct event *, int was_common, int is_common, int old_timeout_idx);
+#endif
+
static int event_haveevents(struct event_base *);
static int event_process_active(struct event_base *);
@@ -165,10 +165,10 @@ static inline void event_persist_closure(struct event_base *, struct event *ev);
static int evthread_notify_base(struct event_base *base);
-static void insert_common_timeout_inorder(struct common_timeout_list *ctl,
- struct event *ev);
-
-#ifndef EVENT__DISABLE_DEBUG_MODE
+static void insert_common_timeout_inorder(struct common_timeout_list *ctl,
+ struct event *ev);
+
+#ifndef EVENT__DISABLE_DEBUG_MODE
/* These functions implement a hashtable of which 'struct event *' structures
* have been setup or added. We don't want to trust the content of the struct
* event itself, since we're trying to work through cases where an event gets
@@ -202,27 +202,27 @@ eq_debug_entry(const struct event_debug_entry *a,
return a->ptr == b->ptr;
}
-int event_debug_mode_on_ = 0;
-
-
-#if !defined(EVENT__DISABLE_THREAD_SUPPORT) && !defined(EVENT__DISABLE_DEBUG_MODE)
-/**
- * @brief debug mode variable which is set for any function/structure that needs
- * to be shared across threads (if thread support is enabled).
- *
- * When and if evthreads are initialized, this variable will be evaluated,
- * and if set to something other than zero, this means the evthread setup
- * functions were called out of order.
- *
- * See: "Locks and threading" in the documentation.
- */
-int event_debug_created_threadable_ctx_ = 0;
-#endif
-
+int event_debug_mode_on_ = 0;
+
+
+#if !defined(EVENT__DISABLE_THREAD_SUPPORT) && !defined(EVENT__DISABLE_DEBUG_MODE)
+/**
+ * @brief debug mode variable which is set for any function/structure that needs
+ * to be shared across threads (if thread support is enabled).
+ *
+ * When and if evthreads are initialized, this variable will be evaluated,
+ * and if set to something other than zero, this means the evthread setup
+ * functions were called out of order.
+ *
+ * See: "Locks and threading" in the documentation.
+ */
+int event_debug_created_threadable_ctx_ = 0;
+#endif
+
/* Set if it's too late to enable event_debug_mode. */
static int event_debug_mode_too_late = 0;
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
-static void *event_debug_map_lock_ = NULL;
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
+static void *event_debug_map_lock_ = NULL;
#endif
static HT_HEAD(event_debug_map, event_debug_entry) global_debug_map =
HT_INITIALIZER();
@@ -232,177 +232,177 @@ HT_PROTOTYPE(event_debug_map, event_debug_entry, node, hash_debug_entry,
HT_GENERATE(event_debug_map, event_debug_entry, node, hash_debug_entry,
eq_debug_entry, 0.5, mm_malloc, mm_realloc, mm_free)
-/* record that ev is now setup (that is, ready for an add) */
-static void event_debug_note_setup_(const struct event *ev)
-{
- struct event_debug_entry *dent, find;
-
- if (!event_debug_mode_on_)
- goto out;
-
- find.ptr = ev;
- EVLOCK_LOCK(event_debug_map_lock_, 0);
- dent = HT_FIND(event_debug_map, &global_debug_map, &find);
- if (dent) {
- dent->added = 0;
- } else {
- dent = mm_malloc(sizeof(*dent));
- if (!dent)
- event_err(1,
- "Out of memory in debugging code");
- dent->ptr = ev;
- dent->added = 0;
- HT_INSERT(event_debug_map, &global_debug_map, dent);
- }
- EVLOCK_UNLOCK(event_debug_map_lock_, 0);
-
-out:
- event_debug_mode_too_late = 1;
-}
-/* record that ev is no longer setup */
-static void event_debug_note_teardown_(const struct event *ev)
-{
- struct event_debug_entry *dent, find;
-
- if (!event_debug_mode_on_)
- goto out;
-
- find.ptr = ev;
- EVLOCK_LOCK(event_debug_map_lock_, 0);
- dent = HT_REMOVE(event_debug_map, &global_debug_map, &find);
- if (dent)
- mm_free(dent);
- EVLOCK_UNLOCK(event_debug_map_lock_, 0);
-
-out:
- event_debug_mode_too_late = 1;
-}
+/* record that ev is now setup (that is, ready for an add) */
+static void event_debug_note_setup_(const struct event *ev)
+{
+ struct event_debug_entry *dent, find;
+
+ if (!event_debug_mode_on_)
+ goto out;
+
+ find.ptr = ev;
+ EVLOCK_LOCK(event_debug_map_lock_, 0);
+ dent = HT_FIND(event_debug_map, &global_debug_map, &find);
+ if (dent) {
+ dent->added = 0;
+ } else {
+ dent = mm_malloc(sizeof(*dent));
+ if (!dent)
+ event_err(1,
+ "Out of memory in debugging code");
+ dent->ptr = ev;
+ dent->added = 0;
+ HT_INSERT(event_debug_map, &global_debug_map, dent);
+ }
+ EVLOCK_UNLOCK(event_debug_map_lock_, 0);
+
+out:
+ event_debug_mode_too_late = 1;
+}
+/* record that ev is no longer setup */
+static void event_debug_note_teardown_(const struct event *ev)
+{
+ struct event_debug_entry *dent, find;
+
+ if (!event_debug_mode_on_)
+ goto out;
+
+ find.ptr = ev;
+ EVLOCK_LOCK(event_debug_map_lock_, 0);
+ dent = HT_REMOVE(event_debug_map, &global_debug_map, &find);
+ if (dent)
+ mm_free(dent);
+ EVLOCK_UNLOCK(event_debug_map_lock_, 0);
+
+out:
+ event_debug_mode_too_late = 1;
+}
/* Macro: record that ev is now added */
-static void event_debug_note_add_(const struct event *ev)
-{
- struct event_debug_entry *dent,find;
-
- if (!event_debug_mode_on_)
- goto out;
-
- find.ptr = ev;
- EVLOCK_LOCK(event_debug_map_lock_, 0);
- dent = HT_FIND(event_debug_map, &global_debug_map, &find);
- if (dent) {
- dent->added = 1;
- } else {
- event_errx(EVENT_ERR_ABORT_,
- "%s: noting an add on a non-setup event %p"
- " (events: 0x%x, fd: "EV_SOCK_FMT
- ", flags: 0x%x)",
- __func__, ev, ev->ev_events,
- EV_SOCK_ARG(ev->ev_fd), ev->ev_flags);
- }
- EVLOCK_UNLOCK(event_debug_map_lock_, 0);
-
-out:
- event_debug_mode_too_late = 1;
-}
-/* record that ev is no longer added */
-static void event_debug_note_del_(const struct event *ev)
-{
- struct event_debug_entry *dent, find;
-
- if (!event_debug_mode_on_)
- goto out;
-
- find.ptr = ev;
- EVLOCK_LOCK(event_debug_map_lock_, 0);
- dent = HT_FIND(event_debug_map, &global_debug_map, &find);
- if (dent) {
- dent->added = 0;
- } else {
- event_errx(EVENT_ERR_ABORT_,
- "%s: noting a del on a non-setup event %p"
- " (events: 0x%x, fd: "EV_SOCK_FMT
- ", flags: 0x%x)",
- __func__, ev, ev->ev_events,
- EV_SOCK_ARG(ev->ev_fd), ev->ev_flags);
- }
- EVLOCK_UNLOCK(event_debug_map_lock_, 0);
-
-out:
- event_debug_mode_too_late = 1;
-}
-/* assert that ev is setup (i.e., okay to add or inspect) */
-static void event_debug_assert_is_setup_(const struct event *ev)
-{
- struct event_debug_entry *dent, find;
-
- if (!event_debug_mode_on_)
+static void event_debug_note_add_(const struct event *ev)
+{
+ struct event_debug_entry *dent,find;
+
+ if (!event_debug_mode_on_)
+ goto out;
+
+ find.ptr = ev;
+ EVLOCK_LOCK(event_debug_map_lock_, 0);
+ dent = HT_FIND(event_debug_map, &global_debug_map, &find);
+ if (dent) {
+ dent->added = 1;
+ } else {
+ event_errx(EVENT_ERR_ABORT_,
+ "%s: noting an add on a non-setup event %p"
+ " (events: 0x%x, fd: "EV_SOCK_FMT
+ ", flags: 0x%x)",
+ __func__, ev, ev->ev_events,
+ EV_SOCK_ARG(ev->ev_fd), ev->ev_flags);
+ }
+ EVLOCK_UNLOCK(event_debug_map_lock_, 0);
+
+out:
+ event_debug_mode_too_late = 1;
+}
+/* record that ev is no longer added */
+static void event_debug_note_del_(const struct event *ev)
+{
+ struct event_debug_entry *dent, find;
+
+ if (!event_debug_mode_on_)
+ goto out;
+
+ find.ptr = ev;
+ EVLOCK_LOCK(event_debug_map_lock_, 0);
+ dent = HT_FIND(event_debug_map, &global_debug_map, &find);
+ if (dent) {
+ dent->added = 0;
+ } else {
+ event_errx(EVENT_ERR_ABORT_,
+ "%s: noting a del on a non-setup event %p"
+ " (events: 0x%x, fd: "EV_SOCK_FMT
+ ", flags: 0x%x)",
+ __func__, ev, ev->ev_events,
+ EV_SOCK_ARG(ev->ev_fd), ev->ev_flags);
+ }
+ EVLOCK_UNLOCK(event_debug_map_lock_, 0);
+
+out:
+ event_debug_mode_too_late = 1;
+}
+/* assert that ev is setup (i.e., okay to add or inspect) */
+static void event_debug_assert_is_setup_(const struct event *ev)
+{
+ struct event_debug_entry *dent, find;
+
+ if (!event_debug_mode_on_)
return;
- find.ptr = ev;
- EVLOCK_LOCK(event_debug_map_lock_, 0);
- dent = HT_FIND(event_debug_map, &global_debug_map, &find);
- if (!dent) {
- event_errx(EVENT_ERR_ABORT_,
- "%s called on a non-initialized event %p"
- " (events: 0x%x, fd: "EV_SOCK_FMT
- ", flags: 0x%x)",
- __func__, ev, ev->ev_events,
- EV_SOCK_ARG(ev->ev_fd), ev->ev_flags);
- }
- EVLOCK_UNLOCK(event_debug_map_lock_, 0);
-}
-/* assert that ev is not added (i.e., okay to tear down or set up again) */
-static void event_debug_assert_not_added_(const struct event *ev)
-{
- struct event_debug_entry *dent, find;
-
- if (!event_debug_mode_on_)
- return;
-
- find.ptr = ev;
- EVLOCK_LOCK(event_debug_map_lock_, 0);
- dent = HT_FIND(event_debug_map, &global_debug_map, &find);
- if (dent && dent->added) {
- event_errx(EVENT_ERR_ABORT_,
- "%s called on an already added event %p"
- " (events: 0x%x, fd: "EV_SOCK_FMT", "
- "flags: 0x%x)",
- __func__, ev, ev->ev_events,
- EV_SOCK_ARG(ev->ev_fd), ev->ev_flags);
- }
- EVLOCK_UNLOCK(event_debug_map_lock_, 0);
-}
-static void event_debug_assert_socket_nonblocking_(evutil_socket_t fd)
-{
- if (!event_debug_mode_on_)
- return;
- if (fd < 0)
- return;
-
-#ifndef _WIN32
- {
- int flags;
- if ((flags = fcntl(fd, F_GETFL, NULL)) >= 0) {
- EVUTIL_ASSERT(flags & O_NONBLOCK);
- }
- }
+ find.ptr = ev;
+ EVLOCK_LOCK(event_debug_map_lock_, 0);
+ dent = HT_FIND(event_debug_map, &global_debug_map, &find);
+ if (!dent) {
+ event_errx(EVENT_ERR_ABORT_,
+ "%s called on a non-initialized event %p"
+ " (events: 0x%x, fd: "EV_SOCK_FMT
+ ", flags: 0x%x)",
+ __func__, ev, ev->ev_events,
+ EV_SOCK_ARG(ev->ev_fd), ev->ev_flags);
+ }
+ EVLOCK_UNLOCK(event_debug_map_lock_, 0);
+}
+/* assert that ev is not added (i.e., okay to tear down or set up again) */
+static void event_debug_assert_not_added_(const struct event *ev)
+{
+ struct event_debug_entry *dent, find;
+
+ if (!event_debug_mode_on_)
+ return;
+
+ find.ptr = ev;
+ EVLOCK_LOCK(event_debug_map_lock_, 0);
+ dent = HT_FIND(event_debug_map, &global_debug_map, &find);
+ if (dent && dent->added) {
+ event_errx(EVENT_ERR_ABORT_,
+ "%s called on an already added event %p"
+ " (events: 0x%x, fd: "EV_SOCK_FMT", "
+ "flags: 0x%x)",
+ __func__, ev, ev->ev_events,
+ EV_SOCK_ARG(ev->ev_fd), ev->ev_flags);
+ }
+ EVLOCK_UNLOCK(event_debug_map_lock_, 0);
+}
+static void event_debug_assert_socket_nonblocking_(evutil_socket_t fd)
+{
+ if (!event_debug_mode_on_)
+ return;
+ if (fd < 0)
+ return;
+
+#ifndef _WIN32
+ {
+ int flags;
+ if ((flags = fcntl(fd, F_GETFL, NULL)) >= 0) {
+ EVUTIL_ASSERT(flags & O_NONBLOCK);
+ }
+ }
#endif
}
-#else
-static void event_debug_note_setup_(const struct event *ev) { (void)ev; }
-static void event_debug_note_teardown_(const struct event *ev) { (void)ev; }
-static void event_debug_note_add_(const struct event *ev) { (void)ev; }
-static void event_debug_note_del_(const struct event *ev) { (void)ev; }
-static void event_debug_assert_is_setup_(const struct event *ev) { (void)ev; }
-static void event_debug_assert_not_added_(const struct event *ev) { (void)ev; }
-static void event_debug_assert_socket_nonblocking_(evutil_socket_t fd) { (void)fd; }
-#endif
-
-#define EVENT_BASE_ASSERT_LOCKED(base) \
- EVLOCK_ASSERT_LOCKED((base)->th_base_lock)
-
+#else
+static void event_debug_note_setup_(const struct event *ev) { (void)ev; }
+static void event_debug_note_teardown_(const struct event *ev) { (void)ev; }
+static void event_debug_note_add_(const struct event *ev) { (void)ev; }
+static void event_debug_note_del_(const struct event *ev) { (void)ev; }
+static void event_debug_assert_is_setup_(const struct event *ev) { (void)ev; }
+static void event_debug_assert_not_added_(const struct event *ev) { (void)ev; }
+static void event_debug_assert_socket_nonblocking_(evutil_socket_t fd) { (void)fd; }
+#endif
+
+#define EVENT_BASE_ASSERT_LOCKED(base) \
+ EVLOCK_ASSERT_LOCKED((base)->th_base_lock)
+
/* How often (in seconds) do we check for changes in wall clock time relative
* to monotonic time? Set this to -1 for 'never.' */
-#define CLOCK_SYNC_INTERVAL 5
+#define CLOCK_SYNC_INTERVAL 5
/** Set 'tp' to the current time according to 'base'. We must hold the lock
* on 'base'. If there is a cached time, return it. Otherwise, use
@@ -419,19 +419,19 @@ gettime(struct event_base *base, struct timeval *tp)
return (0);
}
- if (evutil_gettime_monotonic_(&base->monotonic_timer, tp) == -1) {
- return -1;
- }
+ if (evutil_gettime_monotonic_(&base->monotonic_timer, tp) == -1) {
+ return -1;
+ }
- if (base->last_updated_clock_diff + CLOCK_SYNC_INTERVAL
- < tp->tv_sec) {
- struct timeval tv;
- evutil_gettimeofday(&tv,NULL);
- evutil_timersub(&tv, tp, &base->tv_clock_diff);
- base->last_updated_clock_diff = tp->tv_sec;
+ if (base->last_updated_clock_diff + CLOCK_SYNC_INTERVAL
+ < tp->tv_sec) {
+ struct timeval tv;
+ evutil_gettimeofday(&tv,NULL);
+ evutil_timersub(&tv, tp, &base->tv_clock_diff);
+ base->last_updated_clock_diff = tp->tv_sec;
}
- return 0;
+ return 0;
}
int
@@ -471,36 +471,36 @@ update_time_cache(struct event_base *base)
gettime(base, &base->tv_cache);
}
-int
-event_base_update_cache_time(struct event_base *base)
-{
-
- if (!base) {
- base = current_base;
- if (!current_base)
- return -1;
- }
-
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- if (base->running_loop)
- update_time_cache(base);
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- return 0;
-}
-
-static inline struct event *
-event_callback_to_event(struct event_callback *evcb)
-{
- EVUTIL_ASSERT((evcb->evcb_flags & EVLIST_INIT));
- return EVUTIL_UPCAST(evcb, struct event, ev_evcallback);
-}
-
-static inline struct event_callback *
-event_to_event_callback(struct event *ev)
-{
- return &ev->ev_evcallback;
-}
-
+int
+event_base_update_cache_time(struct event_base *base)
+{
+
+ if (!base) {
+ base = current_base;
+ if (!current_base)
+ return -1;
+ }
+
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ if (base->running_loop)
+ update_time_cache(base);
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ return 0;
+}
+
+static inline struct event *
+event_callback_to_event(struct event_callback *evcb)
+{
+ EVUTIL_ASSERT((evcb->evcb_flags & EVLIST_INIT));
+ return EVUTIL_UPCAST(evcb, struct event, ev_evcallback);
+}
+
+static inline struct event_callback *
+event_to_event_callback(struct event *ev)
+{
+ return &ev->ev_evcallback;
+}
+
struct event_base *
event_init(void)
{
@@ -554,10 +554,10 @@ event_is_method_disabled(const char *name)
evutil_snprintf(environment, sizeof(environment), "EVENT_NO%s", name);
for (i = 8; environment[i] != '\0'; ++i)
- environment[i] = EVUTIL_TOUPPER_(environment[i]);
- /* Note that evutil_getenv_() ignores the environment entirely if
+ environment[i] = EVUTIL_TOUPPER_(environment[i]);
+ /* Note that evutil_getenv_() ignores the environment entirely if
* we're setuid */
- return (evutil_getenv_(environment) != NULL);
+ return (evutil_getenv_(environment) != NULL);
}
int
@@ -569,14 +569,14 @@ event_base_get_features(const struct event_base *base)
void
event_enable_debug_mode(void)
{
-#ifndef EVENT__DISABLE_DEBUG_MODE
- if (event_debug_mode_on_)
+#ifndef EVENT__DISABLE_DEBUG_MODE
+ if (event_debug_mode_on_)
event_errx(1, "%s was called twice!", __func__);
if (event_debug_mode_too_late)
event_errx(1, "%s must be called *before* creating any events "
"or event_bases",__func__);
- event_debug_mode_on_ = 1;
+ event_debug_mode_on_ = 1;
HT_INIT(event_debug_map, &global_debug_map);
#endif
@@ -585,20 +585,20 @@ event_enable_debug_mode(void)
void
event_disable_debug_mode(void)
{
-#ifndef EVENT__DISABLE_DEBUG_MODE
+#ifndef EVENT__DISABLE_DEBUG_MODE
struct event_debug_entry **ent, *victim;
- EVLOCK_LOCK(event_debug_map_lock_, 0);
+ EVLOCK_LOCK(event_debug_map_lock_, 0);
for (ent = HT_START(event_debug_map, &global_debug_map); ent; ) {
victim = *ent;
- ent = HT_NEXT_RMV(event_debug_map, &global_debug_map, ent);
+ ent = HT_NEXT_RMV(event_debug_map, &global_debug_map, ent);
mm_free(victim);
}
HT_CLEAR(event_debug_map, &global_debug_map);
- EVLOCK_UNLOCK(event_debug_map_lock_ , 0);
-
- event_debug_mode_on_ = 0;
-#endif
+ EVLOCK_UNLOCK(event_debug_map_lock_ , 0);
+
+ event_debug_mode_on_ = 0;
+#endif
}
struct event_base *
@@ -608,7 +608,7 @@ event_base_new_with_config(const struct event_config *cfg)
struct event_base *base;
int should_check_environment;
-#ifndef EVENT__DISABLE_DEBUG_MODE
+#ifndef EVENT__DISABLE_DEBUG_MODE
event_debug_mode_too_late = 1;
#endif
@@ -617,61 +617,61 @@ event_base_new_with_config(const struct event_config *cfg)
return NULL;
}
- if (cfg)
- base->flags = cfg->flags;
-
- should_check_environment =
- !(cfg && (cfg->flags & EVENT_BASE_FLAG_IGNORE_ENV));
-
- {
- struct timeval tmp;
- int precise_time =
- cfg && (cfg->flags & EVENT_BASE_FLAG_PRECISE_TIMER);
- int flags;
- if (should_check_environment && !precise_time) {
- precise_time = evutil_getenv_("EVENT_PRECISE_TIMER") != NULL;
- if (precise_time) {
- base->flags |= EVENT_BASE_FLAG_PRECISE_TIMER;
- }
- }
- flags = precise_time ? EV_MONOT_PRECISE : 0;
- evutil_configure_monotonic_time_(&base->monotonic_timer, flags);
-
- gettime(base, &tmp);
- }
-
- min_heap_ctor_(&base->timeheap);
-
+ if (cfg)
+ base->flags = cfg->flags;
+
+ should_check_environment =
+ !(cfg && (cfg->flags & EVENT_BASE_FLAG_IGNORE_ENV));
+
+ {
+ struct timeval tmp;
+ int precise_time =
+ cfg && (cfg->flags & EVENT_BASE_FLAG_PRECISE_TIMER);
+ int flags;
+ if (should_check_environment && !precise_time) {
+ precise_time = evutil_getenv_("EVENT_PRECISE_TIMER") != NULL;
+ if (precise_time) {
+ base->flags |= EVENT_BASE_FLAG_PRECISE_TIMER;
+ }
+ }
+ flags = precise_time ? EV_MONOT_PRECISE : 0;
+ evutil_configure_monotonic_time_(&base->monotonic_timer, flags);
+
+ gettime(base, &tmp);
+ }
+
+ min_heap_ctor_(&base->timeheap);
+
base->sig.ev_signal_pair[0] = -1;
base->sig.ev_signal_pair[1] = -1;
base->th_notify_fd[0] = -1;
base->th_notify_fd[1] = -1;
- TAILQ_INIT(&base->active_later_queue);
+ TAILQ_INIT(&base->active_later_queue);
- evmap_io_initmap_(&base->io);
- evmap_signal_initmap_(&base->sigmap);
- event_changelist_init_(&base->changelist);
+ evmap_io_initmap_(&base->io);
+ evmap_signal_initmap_(&base->sigmap);
+ event_changelist_init_(&base->changelist);
base->evbase = NULL;
- if (cfg) {
- memcpy(&base->max_dispatch_time,
- &cfg->max_dispatch_interval, sizeof(struct timeval));
- base->limit_callbacks_after_prio =
- cfg->limit_callbacks_after_prio;
- } else {
- base->max_dispatch_time.tv_sec = -1;
- base->limit_callbacks_after_prio = 1;
- }
- if (cfg && cfg->max_dispatch_callbacks >= 0) {
- base->max_dispatch_callbacks = cfg->max_dispatch_callbacks;
- } else {
- base->max_dispatch_callbacks = INT_MAX;
- }
- if (base->max_dispatch_callbacks == INT_MAX &&
- base->max_dispatch_time.tv_sec == -1)
- base->limit_callbacks_after_prio = INT_MAX;
+ if (cfg) {
+ memcpy(&base->max_dispatch_time,
+ &cfg->max_dispatch_interval, sizeof(struct timeval));
+ base->limit_callbacks_after_prio =
+ cfg->limit_callbacks_after_prio;
+ } else {
+ base->max_dispatch_time.tv_sec = -1;
+ base->limit_callbacks_after_prio = 1;
+ }
+ if (cfg && cfg->max_dispatch_callbacks >= 0) {
+ base->max_dispatch_callbacks = cfg->max_dispatch_callbacks;
+ } else {
+ base->max_dispatch_callbacks = INT_MAX;
+ }
+ if (base->max_dispatch_callbacks == INT_MAX &&
+ base->max_dispatch_time.tv_sec == -1)
+ base->limit_callbacks_after_prio = INT_MAX;
for (i = 0; eventops[i] && !base->evbase; i++) {
if (cfg != NULL) {
@@ -702,7 +702,7 @@ event_base_new_with_config(const struct event_config *cfg)
return NULL;
}
- if (evutil_getenv_("EVENT_SHOW_METHOD"))
+ if (evutil_getenv_("EVENT_SHOW_METHOD"))
event_msgx("libevent using: %s", base->evsel->name);
/* allocate a single active event queue */
@@ -713,15 +713,15 @@ event_base_new_with_config(const struct event_config *cfg)
/* prepare for threading */
-#if !defined(EVENT__DISABLE_THREAD_SUPPORT) && !defined(EVENT__DISABLE_DEBUG_MODE)
- event_debug_created_threadable_ctx_ = 1;
-#endif
-
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#if !defined(EVENT__DISABLE_THREAD_SUPPORT) && !defined(EVENT__DISABLE_DEBUG_MODE)
+ event_debug_created_threadable_ctx_ = 1;
+#endif
+
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
if (EVTHREAD_LOCKING_ENABLED() &&
(!cfg || !(cfg->flags & EVENT_BASE_FLAG_NOLOCK))) {
int r;
- EVTHREAD_ALLOC_LOCK(base->th_base_lock, 0);
+ EVTHREAD_ALLOC_LOCK(base->th_base_lock, 0);
EVTHREAD_ALLOC_COND(base->current_event_cond);
r = evthread_make_base_notifiable(base);
if (r<0) {
@@ -732,21 +732,21 @@ event_base_new_with_config(const struct event_config *cfg)
}
#endif
-#ifdef _WIN32
+#ifdef _WIN32
if (cfg && (cfg->flags & EVENT_BASE_FLAG_STARTUP_IOCP))
- event_base_start_iocp_(base, cfg->n_cpus_hint);
+ event_base_start_iocp_(base, cfg->n_cpus_hint);
#endif
return (base);
}
int
-event_base_start_iocp_(struct event_base *base, int n_cpus)
+event_base_start_iocp_(struct event_base *base, int n_cpus)
{
-#ifdef _WIN32
+#ifdef _WIN32
if (base->iocp)
return 0;
- base->iocp = event_iocp_port_launch_(n_cpus);
+ base->iocp = event_iocp_port_launch_(n_cpus);
if (!base->iocp) {
event_warnx("%s: Couldn't launch IOCP", __func__);
return -1;
@@ -758,85 +758,85 @@ event_base_start_iocp_(struct event_base *base, int n_cpus)
}
void
-event_base_stop_iocp_(struct event_base *base)
+event_base_stop_iocp_(struct event_base *base)
{
-#ifdef _WIN32
+#ifdef _WIN32
int rv;
if (!base->iocp)
return;
- rv = event_iocp_shutdown_(base->iocp, -1);
+ rv = event_iocp_shutdown_(base->iocp, -1);
EVUTIL_ASSERT(rv >= 0);
base->iocp = NULL;
#endif
}
-static int
-event_base_cancel_single_callback_(struct event_base *base,
- struct event_callback *evcb,
- int run_finalizers)
-{
- int result = 0;
-
- if (evcb->evcb_flags & EVLIST_INIT) {
- struct event *ev = event_callback_to_event(evcb);
- if (!(ev->ev_flags & EVLIST_INTERNAL)) {
- event_del_(ev, EVENT_DEL_EVEN_IF_FINALIZING);
- result = 1;
- }
- } else {
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- event_callback_cancel_nolock_(base, evcb, 1);
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- result = 1;
- }
-
- if (run_finalizers && (evcb->evcb_flags & EVLIST_FINALIZING)) {
- switch (evcb->evcb_closure) {
- case EV_CLOSURE_EVENT_FINALIZE:
- case EV_CLOSURE_EVENT_FINALIZE_FREE: {
- struct event *ev = event_callback_to_event(evcb);
- ev->ev_evcallback.evcb_cb_union.evcb_evfinalize(ev, ev->ev_arg);
- if (evcb->evcb_closure == EV_CLOSURE_EVENT_FINALIZE_FREE)
- mm_free(ev);
- break;
- }
- case EV_CLOSURE_CB_FINALIZE:
- evcb->evcb_cb_union.evcb_cbfinalize(evcb, evcb->evcb_arg);
- break;
- default:
- break;
- }
- }
- return result;
-}
-
-static int event_base_free_queues_(struct event_base *base, int run_finalizers)
-{
- int deleted = 0, i;
-
- for (i = 0; i < base->nactivequeues; ++i) {
- struct event_callback *evcb, *next;
- for (evcb = TAILQ_FIRST(&base->activequeues[i]); evcb; ) {
- next = TAILQ_NEXT(evcb, evcb_active_next);
- deleted += event_base_cancel_single_callback_(base, evcb, run_finalizers);
- evcb = next;
- }
- }
-
- {
- struct event_callback *evcb;
- while ((evcb = TAILQ_FIRST(&base->active_later_queue))) {
- deleted += event_base_cancel_single_callback_(base, evcb, run_finalizers);
- }
- }
-
- return deleted;
-}
-
-static void
-event_base_free_(struct event_base *base, int run_finalizers)
-{
+static int
+event_base_cancel_single_callback_(struct event_base *base,
+ struct event_callback *evcb,
+ int run_finalizers)
+{
+ int result = 0;
+
+ if (evcb->evcb_flags & EVLIST_INIT) {
+ struct event *ev = event_callback_to_event(evcb);
+ if (!(ev->ev_flags & EVLIST_INTERNAL)) {
+ event_del_(ev, EVENT_DEL_EVEN_IF_FINALIZING);
+ result = 1;
+ }
+ } else {
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ event_callback_cancel_nolock_(base, evcb, 1);
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ result = 1;
+ }
+
+ if (run_finalizers && (evcb->evcb_flags & EVLIST_FINALIZING)) {
+ switch (evcb->evcb_closure) {
+ case EV_CLOSURE_EVENT_FINALIZE:
+ case EV_CLOSURE_EVENT_FINALIZE_FREE: {
+ struct event *ev = event_callback_to_event(evcb);
+ ev->ev_evcallback.evcb_cb_union.evcb_evfinalize(ev, ev->ev_arg);
+ if (evcb->evcb_closure == EV_CLOSURE_EVENT_FINALIZE_FREE)
+ mm_free(ev);
+ break;
+ }
+ case EV_CLOSURE_CB_FINALIZE:
+ evcb->evcb_cb_union.evcb_cbfinalize(evcb, evcb->evcb_arg);
+ break;
+ default:
+ break;
+ }
+ }
+ return result;
+}
+
+static int event_base_free_queues_(struct event_base *base, int run_finalizers)
+{
+ int deleted = 0, i;
+
+ for (i = 0; i < base->nactivequeues; ++i) {
+ struct event_callback *evcb, *next;
+ for (evcb = TAILQ_FIRST(&base->activequeues[i]); evcb; ) {
+ next = TAILQ_NEXT(evcb, evcb_active_next);
+ deleted += event_base_cancel_single_callback_(base, evcb, run_finalizers);
+ evcb = next;
+ }
+ }
+
+ {
+ struct event_callback *evcb;
+ while ((evcb = TAILQ_FIRST(&base->active_later_queue))) {
+ deleted += event_base_cancel_single_callback_(base, evcb, run_finalizers);
+ }
+ }
+
+ return deleted;
+}
+
+static void
+event_base_free_(struct event_base *base, int run_finalizers)
+{
int i, n_deleted=0;
struct event *ev;
/* XXXX grab the lock? If there is contention when one thread frees
@@ -853,8 +853,8 @@ event_base_free_(struct event_base *base, int run_finalizers)
}
/* XXX(niels) - check for internal events first */
-#ifdef _WIN32
- event_base_stop_iocp_(base);
+#ifdef _WIN32
+ event_base_stop_iocp_(base);
#endif
/* threading fds if we have them */
@@ -869,9 +869,9 @@ event_base_free_(struct event_base *base, int run_finalizers)
}
/* Delete all non-internal events. */
- evmap_delete_all_(base);
-
- while ((ev = min_heap_top_(&base->timeheap)) != NULL) {
+ evmap_delete_all_(base);
+
+ while ((ev = min_heap_top_(&base->timeheap)) != NULL) {
event_del(ev);
++n_deleted;
}
@@ -894,88 +894,88 @@ event_base_free_(struct event_base *base, int run_finalizers)
if (base->common_timeout_queues)
mm_free(base->common_timeout_queues);
- for (;;) {
- /* For finalizers we can register yet another finalizer out from
- * finalizer, and iff finalizer will be in active_later_queue we can
- * add finalizer to activequeues, and we will have events in
- * activequeues after this function returns, which is not what we want
- * (we even have an assertion for this).
- *
- * A simple case is bufferevent with underlying (i.e. filters).
- */
- int i = event_base_free_queues_(base, run_finalizers);
- event_debug(("%s: %d events freed", __func__, i));
- if (!i) {
- break;
+ for (;;) {
+ /* For finalizers we can register yet another finalizer out from
+ * finalizer, and iff finalizer will be in active_later_queue we can
+ * add finalizer to activequeues, and we will have events in
+ * activequeues after this function returns, which is not what we want
+ * (we even have an assertion for this).
+ *
+ * A simple case is bufferevent with underlying (i.e. filters).
+ */
+ int i = event_base_free_queues_(base, run_finalizers);
+ event_debug(("%s: %d events freed", __func__, i));
+ if (!i) {
+ break;
}
- n_deleted += i;
+ n_deleted += i;
}
if (n_deleted)
event_debug(("%s: %d events were still set in base",
__func__, n_deleted));
- while (LIST_FIRST(&base->once_events)) {
- struct event_once *eonce = LIST_FIRST(&base->once_events);
- LIST_REMOVE(eonce, next_once);
- mm_free(eonce);
- }
-
+ while (LIST_FIRST(&base->once_events)) {
+ struct event_once *eonce = LIST_FIRST(&base->once_events);
+ LIST_REMOVE(eonce, next_once);
+ mm_free(eonce);
+ }
+
if (base->evsel != NULL && base->evsel->dealloc != NULL)
base->evsel->dealloc(base);
for (i = 0; i < base->nactivequeues; ++i)
EVUTIL_ASSERT(TAILQ_EMPTY(&base->activequeues[i]));
- EVUTIL_ASSERT(min_heap_empty_(&base->timeheap));
- min_heap_dtor_(&base->timeheap);
+ EVUTIL_ASSERT(min_heap_empty_(&base->timeheap));
+ min_heap_dtor_(&base->timeheap);
mm_free(base->activequeues);
- evmap_io_clear_(&base->io);
- evmap_signal_clear_(&base->sigmap);
- event_changelist_freemem_(&base->changelist);
+ evmap_io_clear_(&base->io);
+ evmap_signal_clear_(&base->sigmap);
+ event_changelist_freemem_(&base->changelist);
- EVTHREAD_FREE_LOCK(base->th_base_lock, 0);
+ EVTHREAD_FREE_LOCK(base->th_base_lock, 0);
EVTHREAD_FREE_COND(base->current_event_cond);
- /* If we're freeing current_base, there won't be a current_base. */
- if (base == current_base)
- current_base = NULL;
+ /* If we're freeing current_base, there won't be a current_base. */
+ if (base == current_base)
+ current_base = NULL;
mm_free(base);
}
-void
-event_base_free_nofinalize(struct event_base *base)
-{
- event_base_free_(base, 0);
-}
-
-void
-event_base_free(struct event_base *base)
-{
- event_base_free_(base, 1);
-}
-
-/* Fake eventop; used to disable the backend temporarily inside event_reinit
- * so that we can call event_del() on an event without telling the backend.
- */
-static int
-nil_backend_del(struct event_base *b, evutil_socket_t fd, short old,
- short events, void *fdinfo)
-{
- return 0;
-}
-const struct eventop nil_eventop = {
- "nil",
- NULL, /* init: unused. */
- NULL, /* add: unused. */
- nil_backend_del, /* del: used, so needs to be killed. */
- NULL, /* dispatch: unused. */
- NULL, /* dealloc: unused. */
- 0, 0, 0
-};
-
+void
+event_base_free_nofinalize(struct event_base *base)
+{
+ event_base_free_(base, 0);
+}
+
+void
+event_base_free(struct event_base *base)
+{
+ event_base_free_(base, 1);
+}
+
+/* Fake eventop; used to disable the backend temporarily inside event_reinit
+ * so that we can call event_del() on an event without telling the backend.
+ */
+static int
+nil_backend_del(struct event_base *b, evutil_socket_t fd, short old,
+ short events, void *fdinfo)
+{
+ return 0;
+}
+const struct eventop nil_eventop = {
+ "nil",
+ NULL, /* init: unused. */
+ NULL, /* add: unused. */
+ nil_backend_del, /* del: used, so needs to be killed. */
+ NULL, /* dispatch: unused. */
+ NULL, /* dealloc: unused. */
+ 0, 0, 0
+};
+
/* reinitialize the event base after a fork */
int
event_reinit(struct event_base *base)
@@ -983,48 +983,48 @@ event_reinit(struct event_base *base)
const struct eventop *evsel;
int res = 0;
int was_notifiable = 0;
- int had_signal_added = 0;
+ int had_signal_added = 0;
EVBASE_ACQUIRE_LOCK(base, th_base_lock);
evsel = base->evsel;
- /* check if this event mechanism requires reinit on the backend */
- if (evsel->need_reinit) {
- /* We're going to call event_del() on our notify events (the
- * ones that tell about signals and wakeup events). But we
- * don't actually want to tell the backend to change its
- * state, since it might still share some resource (a kqueue,
- * an epoll fd) with the parent process, and we don't want to
- * delete the fds from _that_ backend, we temporarily stub out
- * the evsel with a replacement.
- */
- base->evsel = &nil_eventop;
- }
-
- /* We need to re-create a new signal-notification fd and a new
- * thread-notification fd. Otherwise, we'll still share those with
- * the parent process, which would make any notification sent to them
- * get received by one or both of the event loops, more or less at
- * random.
+ /* check if this event mechanism requires reinit on the backend */
+ if (evsel->need_reinit) {
+ /* We're going to call event_del() on our notify events (the
+ * ones that tell about signals and wakeup events). But we
+ * don't actually want to tell the backend to change its
+ * state, since it might still share some resource (a kqueue,
+ * an epoll fd) with the parent process, and we don't want to
+ * delete the fds from _that_ backend, we temporarily stub out
+ * the evsel with a replacement.
+ */
+ base->evsel = &nil_eventop;
+ }
+
+ /* We need to re-create a new signal-notification fd and a new
+ * thread-notification fd. Otherwise, we'll still share those with
+ * the parent process, which would make any notification sent to them
+ * get received by one or both of the event loops, more or less at
+ * random.
*/
if (base->sig.ev_signal_added) {
- event_del_nolock_(&base->sig.ev_signal, EVENT_DEL_AUTOBLOCK);
- event_debug_unassign(&base->sig.ev_signal);
- memset(&base->sig.ev_signal, 0, sizeof(base->sig.ev_signal));
- had_signal_added = 1;
+ event_del_nolock_(&base->sig.ev_signal, EVENT_DEL_AUTOBLOCK);
+ event_debug_unassign(&base->sig.ev_signal);
+ memset(&base->sig.ev_signal, 0, sizeof(base->sig.ev_signal));
+ had_signal_added = 1;
base->sig.ev_signal_added = 0;
}
- if (base->sig.ev_signal_pair[0] != -1)
- EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[0]);
- if (base->sig.ev_signal_pair[1] != -1)
- EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[1]);
- if (base->th_notify_fn != NULL) {
- was_notifiable = 1;
- base->th_notify_fn = NULL;
- }
+ if (base->sig.ev_signal_pair[0] != -1)
+ EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[0]);
+ if (base->sig.ev_signal_pair[1] != -1)
+ EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[1]);
+ if (base->th_notify_fn != NULL) {
+ was_notifiable = 1;
+ base->th_notify_fn = NULL;
+ }
if (base->th_notify_fd[0] != -1) {
- event_del_nolock_(&base->th_notify, EVENT_DEL_AUTOBLOCK);
+ event_del_nolock_(&base->th_notify, EVENT_DEL_AUTOBLOCK);
EVUTIL_CLOSESOCKET(base->th_notify_fd[0]);
if (base->th_notify_fd[1] != -1)
EVUTIL_CLOSESOCKET(base->th_notify_fd[1]);
@@ -1033,73 +1033,73 @@ event_reinit(struct event_base *base)
event_debug_unassign(&base->th_notify);
}
- /* Replace the original evsel. */
- base->evsel = evsel;
-
- if (evsel->need_reinit) {
- /* Reconstruct the backend through brute-force, so that we do
- * not share any structures with the parent process. For some
- * backends, this is necessary: epoll and kqueue, for
- * instance, have events associated with a kernel
- * structure. If didn't reinitialize, we'd share that
- * structure with the parent process, and any changes made by
- * the parent would affect our backend's behavior (and vice
- * versa).
- */
- if (base->evsel->dealloc != NULL)
- base->evsel->dealloc(base);
- base->evbase = evsel->init(base);
- if (base->evbase == NULL) {
- event_errx(1,
- "%s: could not reinitialize event mechanism",
- __func__);
- res = -1;
- goto done;
- }
-
- /* Empty out the changelist (if any): we are starting from a
- * blank slate. */
- event_changelist_freemem_(&base->changelist);
-
- /* Tell the event maps to re-inform the backend about all
- * pending events. This will make the signal notification
- * event get re-created if necessary. */
- if (evmap_reinit_(base) < 0)
- res = -1;
- } else {
- res = evsig_init_(base);
- if (res == 0 && had_signal_added) {
- res = event_add_nolock_(&base->sig.ev_signal, NULL, 0);
- if (res == 0)
- base->sig.ev_signal_added = 1;
+ /* Replace the original evsel. */
+ base->evsel = evsel;
+
+ if (evsel->need_reinit) {
+ /* Reconstruct the backend through brute-force, so that we do
+ * not share any structures with the parent process. For some
+ * backends, this is necessary: epoll and kqueue, for
+ * instance, have events associated with a kernel
+ * structure. If didn't reinitialize, we'd share that
+ * structure with the parent process, and any changes made by
+ * the parent would affect our backend's behavior (and vice
+ * versa).
+ */
+ if (base->evsel->dealloc != NULL)
+ base->evsel->dealloc(base);
+ base->evbase = evsel->init(base);
+ if (base->evbase == NULL) {
+ event_errx(1,
+ "%s: could not reinitialize event mechanism",
+ __func__);
+ res = -1;
+ goto done;
+ }
+
+ /* Empty out the changelist (if any): we are starting from a
+ * blank slate. */
+ event_changelist_freemem_(&base->changelist);
+
+ /* Tell the event maps to re-inform the backend about all
+ * pending events. This will make the signal notification
+ * event get re-created if necessary. */
+ if (evmap_reinit_(base) < 0)
+ res = -1;
+ } else {
+ res = evsig_init_(base);
+ if (res == 0 && had_signal_added) {
+ res = event_add_nolock_(&base->sig.ev_signal, NULL, 0);
+ if (res == 0)
+ base->sig.ev_signal_added = 1;
}
}
- /* If we were notifiable before, and nothing just exploded, become
- * notifiable again. */
+ /* If we were notifiable before, and nothing just exploded, become
+ * notifiable again. */
if (was_notifiable && res == 0)
- res = evthread_make_base_notifiable_nolock_(base);
+ res = evthread_make_base_notifiable_nolock_(base);
done:
EVBASE_RELEASE_LOCK(base, th_base_lock);
return (res);
}
-/* Get the monotonic time for this event_base' timer */
-int
-event_gettime_monotonic(struct event_base *base, struct timeval *tv)
-{
- int rv = -1;
-
- if (base && tv) {
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- rv = evutil_gettime_monotonic_(&(base->monotonic_timer), tv);
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- }
-
- return rv;
-}
-
+/* Get the monotonic time for this event_base' timer */
+int
+event_gettime_monotonic(struct event_base *base, struct timeval *tv)
+{
+ int rv = -1;
+
+ if (base && tv) {
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ rv = evutil_gettime_monotonic_(&(base->monotonic_timer), tv);
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ }
+
+ return rv;
+}
+
const char **
event_get_supported_methods(void)
{
@@ -1141,9 +1141,9 @@ event_config_new(void)
return (NULL);
TAILQ_INIT(&cfg->entries);
- cfg->max_dispatch_interval.tv_sec = -1;
- cfg->max_dispatch_callbacks = INT_MAX;
- cfg->limit_callbacks_after_prio = 1;
+ cfg->max_dispatch_interval.tv_sec = -1;
+ cfg->max_dispatch_callbacks = INT_MAX;
+ cfg->limit_callbacks_after_prio = 1;
return (cfg);
}
@@ -1214,23 +1214,23 @@ event_config_set_num_cpus_hint(struct event_config *cfg, int cpus)
}
int
-event_config_set_max_dispatch_interval(struct event_config *cfg,
- const struct timeval *max_interval, int max_callbacks, int min_priority)
-{
- if (max_interval)
- memcpy(&cfg->max_dispatch_interval, max_interval,
- sizeof(struct timeval));
- else
- cfg->max_dispatch_interval.tv_sec = -1;
- cfg->max_dispatch_callbacks =
- max_callbacks >= 0 ? max_callbacks : INT_MAX;
- if (min_priority < 0)
- min_priority = 0;
- cfg->limit_callbacks_after_prio = min_priority;
- return (0);
-}
-
-int
+event_config_set_max_dispatch_interval(struct event_config *cfg,
+ const struct timeval *max_interval, int max_callbacks, int min_priority)
+{
+ if (max_interval)
+ memcpy(&cfg->max_dispatch_interval, max_interval,
+ sizeof(struct timeval));
+ else
+ cfg->max_dispatch_interval.tv_sec = -1;
+ cfg->max_dispatch_callbacks =
+ max_callbacks >= 0 ? max_callbacks : INT_MAX;
+ if (min_priority < 0)
+ min_priority = 0;
+ cfg->limit_callbacks_after_prio = min_priority;
+ return (0);
+}
+
+int
event_priority_init(int npriorities)
{
return event_base_priority_init(current_base, npriorities);
@@ -1239,17 +1239,17 @@ event_priority_init(int npriorities)
int
event_base_priority_init(struct event_base *base, int npriorities)
{
- int i, r;
- r = -1;
-
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ int i, r;
+ r = -1;
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+
if (N_ACTIVE_CALLBACKS(base) || npriorities < 1
|| npriorities >= EVENT_MAX_PRIORITIES)
- goto err;
+ goto err;
if (npriorities == base->nactivequeues)
- goto ok;
+ goto ok;
if (base->nactivequeues) {
mm_free(base->activequeues);
@@ -1257,11 +1257,11 @@ event_base_priority_init(struct event_base *base, int npriorities)
}
/* Allocate our priority queues */
- base->activequeues = (struct evcallback_list *)
- mm_calloc(npriorities, sizeof(struct evcallback_list));
+ base->activequeues = (struct evcallback_list *)
+ mm_calloc(npriorities, sizeof(struct evcallback_list));
if (base->activequeues == NULL) {
event_warn("%s: calloc", __func__);
- goto err;
+ goto err;
}
base->nactivequeues = npriorities;
@@ -1269,78 +1269,78 @@ event_base_priority_init(struct event_base *base, int npriorities)
TAILQ_INIT(&base->activequeues[i]);
}
-ok:
- r = 0;
-err:
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- return (r);
-}
-
-int
-event_base_get_npriorities(struct event_base *base)
-{
-
- int n;
- if (base == NULL)
- base = current_base;
-
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- n = base->nactivequeues;
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- return (n);
-}
-
-int
-event_base_get_num_events(struct event_base *base, unsigned int type)
-{
- int r = 0;
-
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
-
- if (type & EVENT_BASE_COUNT_ACTIVE)
- r += base->event_count_active;
-
- if (type & EVENT_BASE_COUNT_VIRTUAL)
- r += base->virtual_event_count;
-
- if (type & EVENT_BASE_COUNT_ADDED)
- r += base->event_count;
-
- EVBASE_RELEASE_LOCK(base, th_base_lock);
-
- return r;
-}
-
-int
-event_base_get_max_events(struct event_base *base, unsigned int type, int clear)
-{
- int r = 0;
-
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
-
- if (type & EVENT_BASE_COUNT_ACTIVE) {
- r += base->event_count_active_max;
- if (clear)
- base->event_count_active_max = 0;
- }
-
- if (type & EVENT_BASE_COUNT_VIRTUAL) {
- r += base->virtual_event_count_max;
- if (clear)
- base->virtual_event_count_max = 0;
- }
-
- if (type & EVENT_BASE_COUNT_ADDED) {
- r += base->event_count_max;
- if (clear)
- base->event_count_max = 0;
- }
-
- EVBASE_RELEASE_LOCK(base, th_base_lock);
-
- return r;
-}
-
+ok:
+ r = 0;
+err:
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ return (r);
+}
+
+int
+event_base_get_npriorities(struct event_base *base)
+{
+
+ int n;
+ if (base == NULL)
+ base = current_base;
+
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ n = base->nactivequeues;
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ return (n);
+}
+
+int
+event_base_get_num_events(struct event_base *base, unsigned int type)
+{
+ int r = 0;
+
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+
+ if (type & EVENT_BASE_COUNT_ACTIVE)
+ r += base->event_count_active;
+
+ if (type & EVENT_BASE_COUNT_VIRTUAL)
+ r += base->virtual_event_count;
+
+ if (type & EVENT_BASE_COUNT_ADDED)
+ r += base->event_count;
+
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+
+ return r;
+}
+
+int
+event_base_get_max_events(struct event_base *base, unsigned int type, int clear)
+{
+ int r = 0;
+
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+
+ if (type & EVENT_BASE_COUNT_ACTIVE) {
+ r += base->event_count_active_max;
+ if (clear)
+ base->event_count_active_max = 0;
+ }
+
+ if (type & EVENT_BASE_COUNT_VIRTUAL) {
+ r += base->virtual_event_count_max;
+ if (clear)
+ base->virtual_event_count_max = 0;
+ }
+
+ if (type & EVENT_BASE_COUNT_ADDED) {
+ r += base->event_count_max;
+ if (clear)
+ base->event_count_max = 0;
+ }
+
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+
+ return r;
+}
+
/* Returns true iff we're currently watching any events. */
static int
event_haveevents(struct event_base *base)
@@ -1452,7 +1452,7 @@ common_timeout_schedule(struct common_timeout_list *ctl,
{
struct timeval timeout = head->ev_timeout;
timeout.tv_usec &= MICROSECONDS_MASK;
- event_add_nolock_(&ctl->timeout_event, &timeout, 1);
+ event_add_nolock_(&ctl->timeout_event, &timeout, 1);
}
/* Callback: invoked when the timeout for a common timeout queue triggers.
@@ -1473,8 +1473,8 @@ common_timeout_callback(evutil_socket_t fd, short what, void *arg)
(ev->ev_timeout.tv_sec == now.tv_sec &&
(ev->ev_timeout.tv_usec&MICROSECONDS_MASK) > now.tv_usec))
break;
- event_del_nolock_(ev, EVENT_DEL_NOBLOCK);
- event_active_nolock_(ev, EV_TIMEOUT, 1);
+ event_del_nolock_(ev, EVENT_DEL_NOBLOCK);
+ event_active_nolock_(ev, EV_TIMEOUT, 1);
}
if (ev)
common_timeout_schedule(ctl, &now, ev);
@@ -1607,7 +1607,7 @@ event_persist_closure(struct event_base *base, struct event *ev)
evutil_timeradd(&now, &delay, &run_at);
}
run_at.tv_usec |= usec_mask;
- event_add_nolock_(ev, &run_at, 1);
+ event_add_nolock_(ev, &run_at, 1);
}
// Save our callback before we release the lock
@@ -1628,105 +1628,105 @@ event_persist_closure(struct event_base *base, struct event *ev)
releasing the lock as we go. This function requires that the lock be held
when it's invoked. Returns -1 if we get a signal or an event_break that
means we should stop processing any active events now. Otherwise returns
- the number of non-internal event_callbacks that we processed.
+ the number of non-internal event_callbacks that we processed.
*/
static int
event_process_active_single_queue(struct event_base *base,
- struct evcallback_list *activeq,
- int max_to_process, const struct timeval *endtime)
+ struct evcallback_list *activeq,
+ int max_to_process, const struct timeval *endtime)
{
- struct event_callback *evcb;
+ struct event_callback *evcb;
int count = 0;
EVUTIL_ASSERT(activeq != NULL);
- for (evcb = TAILQ_FIRST(activeq); evcb; evcb = TAILQ_FIRST(activeq)) {
- struct event *ev=NULL;
- if (evcb->evcb_flags & EVLIST_INIT) {
- ev = event_callback_to_event(evcb);
-
- if (ev->ev_events & EV_PERSIST || ev->ev_flags & EVLIST_FINALIZING)
- event_queue_remove_active(base, evcb);
- else
- event_del_nolock_(ev, EVENT_DEL_NOBLOCK);
- event_debug((
- "event_process_active: event: %p, %s%s%scall %p",
- ev,
- ev->ev_res & EV_READ ? "EV_READ " : " ",
- ev->ev_res & EV_WRITE ? "EV_WRITE " : " ",
- ev->ev_res & EV_CLOSED ? "EV_CLOSED " : " ",
- ev->ev_callback));
- } else {
- event_queue_remove_active(base, evcb);
- event_debug(("event_process_active: event_callback %p, "
- "closure %d, call %p",
- evcb, evcb->evcb_closure, evcb->evcb_cb_union.evcb_callback));
- }
-
- if (!(evcb->evcb_flags & EVLIST_INTERNAL))
+ for (evcb = TAILQ_FIRST(activeq); evcb; evcb = TAILQ_FIRST(activeq)) {
+ struct event *ev=NULL;
+ if (evcb->evcb_flags & EVLIST_INIT) {
+ ev = event_callback_to_event(evcb);
+
+ if (ev->ev_events & EV_PERSIST || ev->ev_flags & EVLIST_FINALIZING)
+ event_queue_remove_active(base, evcb);
+ else
+ event_del_nolock_(ev, EVENT_DEL_NOBLOCK);
+ event_debug((
+ "event_process_active: event: %p, %s%s%scall %p",
+ ev,
+ ev->ev_res & EV_READ ? "EV_READ " : " ",
+ ev->ev_res & EV_WRITE ? "EV_WRITE " : " ",
+ ev->ev_res & EV_CLOSED ? "EV_CLOSED " : " ",
+ ev->ev_callback));
+ } else {
+ event_queue_remove_active(base, evcb);
+ event_debug(("event_process_active: event_callback %p, "
+ "closure %d, call %p",
+ evcb, evcb->evcb_closure, evcb->evcb_cb_union.evcb_callback));
+ }
+
+ if (!(evcb->evcb_flags & EVLIST_INTERNAL))
++count;
- base->current_event = evcb;
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+ base->current_event = evcb;
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
base->current_event_waiters = 0;
#endif
- switch (evcb->evcb_closure) {
- case EV_CLOSURE_EVENT_SIGNAL:
- EVUTIL_ASSERT(ev != NULL);
+ switch (evcb->evcb_closure) {
+ case EV_CLOSURE_EVENT_SIGNAL:
+ EVUTIL_ASSERT(ev != NULL);
event_signal_closure(base, ev);
break;
- case EV_CLOSURE_EVENT_PERSIST:
- EVUTIL_ASSERT(ev != NULL);
+ case EV_CLOSURE_EVENT_PERSIST:
+ EVUTIL_ASSERT(ev != NULL);
event_persist_closure(base, ev);
break;
- case EV_CLOSURE_EVENT: {
- void (*evcb_callback)(evutil_socket_t, short, void *);
- short res;
- EVUTIL_ASSERT(ev != NULL);
- evcb_callback = *ev->ev_callback;
- res = ev->ev_res;
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- evcb_callback(ev->ev_fd, res, ev->ev_arg);
- }
- break;
- case EV_CLOSURE_CB_SELF: {
- void (*evcb_selfcb)(struct event_callback *, void *) = evcb->evcb_cb_union.evcb_selfcb;
+ case EV_CLOSURE_EVENT: {
+ void (*evcb_callback)(evutil_socket_t, short, void *);
+ short res;
+ EVUTIL_ASSERT(ev != NULL);
+ evcb_callback = *ev->ev_callback;
+ res = ev->ev_res;
EVBASE_RELEASE_LOCK(base, th_base_lock);
- evcb_selfcb(evcb, evcb->evcb_arg);
+ evcb_callback(ev->ev_fd, res, ev->ev_arg);
}
- break;
- case EV_CLOSURE_EVENT_FINALIZE:
- case EV_CLOSURE_EVENT_FINALIZE_FREE: {
- void (*evcb_evfinalize)(struct event *, void *);
- int evcb_closure = evcb->evcb_closure;
- EVUTIL_ASSERT(ev != NULL);
- base->current_event = NULL;
- evcb_evfinalize = ev->ev_evcallback.evcb_cb_union.evcb_evfinalize;
- EVUTIL_ASSERT((evcb->evcb_flags & EVLIST_FINALIZING));
- EVBASE_RELEASE_LOCK(base, th_base_lock);
+ break;
+ case EV_CLOSURE_CB_SELF: {
+ void (*evcb_selfcb)(struct event_callback *, void *) = evcb->evcb_cb_union.evcb_selfcb;
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ evcb_selfcb(evcb, evcb->evcb_arg);
+ }
+ break;
+ case EV_CLOSURE_EVENT_FINALIZE:
+ case EV_CLOSURE_EVENT_FINALIZE_FREE: {
+ void (*evcb_evfinalize)(struct event *, void *);
+ int evcb_closure = evcb->evcb_closure;
+ EVUTIL_ASSERT(ev != NULL);
+ base->current_event = NULL;
+ evcb_evfinalize = ev->ev_evcallback.evcb_cb_union.evcb_evfinalize;
+ EVUTIL_ASSERT((evcb->evcb_flags & EVLIST_FINALIZING));
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
event_debug_note_teardown_(ev);
- evcb_evfinalize(ev, ev->ev_arg);
- if (evcb_closure == EV_CLOSURE_EVENT_FINALIZE_FREE)
- mm_free(ev);
- }
- break;
- case EV_CLOSURE_CB_FINALIZE: {
- void (*evcb_cbfinalize)(struct event_callback *, void *) = evcb->evcb_cb_union.evcb_cbfinalize;
- base->current_event = NULL;
- EVUTIL_ASSERT((evcb->evcb_flags & EVLIST_FINALIZING));
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- evcb_cbfinalize(evcb, evcb->evcb_arg);
- }
- break;
- default:
- EVUTIL_ASSERT(0);
- }
+ evcb_evfinalize(ev, ev->ev_arg);
+ if (evcb_closure == EV_CLOSURE_EVENT_FINALIZE_FREE)
+ mm_free(ev);
+ }
+ break;
+ case EV_CLOSURE_CB_FINALIZE: {
+ void (*evcb_cbfinalize)(struct event_callback *, void *) = evcb->evcb_cb_union.evcb_cbfinalize;
+ base->current_event = NULL;
+ EVUTIL_ASSERT((evcb->evcb_flags & EVLIST_FINALIZING));
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ evcb_cbfinalize(evcb, evcb->evcb_arg);
+ }
+ break;
+ default:
+ EVUTIL_ASSERT(0);
+ }
EVBASE_ACQUIRE_LOCK(base, th_base_lock);
base->current_event = NULL;
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
if (base->current_event_waiters) {
base->current_event_waiters = 0;
EVTHREAD_COND_BROADCAST(base->current_event_cond);
@@ -1735,15 +1735,15 @@ event_process_active_single_queue(struct event_base *base,
if (base->event_break)
return -1;
- if (count >= max_to_process)
- return count;
- if (count && endtime) {
- struct timeval now;
- update_time_cache(base);
- gettime(base, &now);
- if (evutil_timercmp(&now, endtime, >=))
- return count;
- }
+ if (count >= max_to_process)
+ return count;
+ if (count && endtime) {
+ struct timeval now;
+ update_time_cache(base);
+ gettime(base, &now);
+ if (evutil_timercmp(&now, endtime, >=))
+ return count;
+ }
if (base->event_continue)
break;
}
@@ -1760,33 +1760,33 @@ static int
event_process_active(struct event_base *base)
{
/* Caller must hold th_base_lock */
- struct evcallback_list *activeq = NULL;
+ struct evcallback_list *activeq = NULL;
int i, c = 0;
- const struct timeval *endtime;
- struct timeval tv;
- const int maxcb = base->max_dispatch_callbacks;
- const int limit_after_prio = base->limit_callbacks_after_prio;
- if (base->max_dispatch_time.tv_sec >= 0) {
- update_time_cache(base);
- gettime(base, &tv);
- evutil_timeradd(&base->max_dispatch_time, &tv, &tv);
- endtime = &tv;
- } else {
- endtime = NULL;
- }
+ const struct timeval *endtime;
+ struct timeval tv;
+ const int maxcb = base->max_dispatch_callbacks;
+ const int limit_after_prio = base->limit_callbacks_after_prio;
+ if (base->max_dispatch_time.tv_sec >= 0) {
+ update_time_cache(base);
+ gettime(base, &tv);
+ evutil_timeradd(&base->max_dispatch_time, &tv, &tv);
+ endtime = &tv;
+ } else {
+ endtime = NULL;
+ }
for (i = 0; i < base->nactivequeues; ++i) {
if (TAILQ_FIRST(&base->activequeues[i]) != NULL) {
base->event_running_priority = i;
activeq = &base->activequeues[i];
- if (i < limit_after_prio)
- c = event_process_active_single_queue(base, activeq,
- INT_MAX, NULL);
- else
- c = event_process_active_single_queue(base, activeq,
- maxcb, endtime);
+ if (i < limit_after_prio)
+ c = event_process_active_single_queue(base, activeq,
+ INT_MAX, NULL);
+ else
+ c = event_process_active_single_queue(base, activeq,
+ maxcb, endtime);
if (c < 0) {
- goto done;
+ goto done;
} else if (c > 0)
break; /* Processed a real event; do not
* consider lower-priority events */
@@ -1795,9 +1795,9 @@ event_process_active(struct event_base *base)
}
}
-done:
+done:
base->event_running_priority = -1;
-
+
return c;
}
@@ -1873,25 +1873,25 @@ event_base_loopbreak(struct event_base *event_base)
}
int
-event_base_loopcontinue(struct event_base *event_base)
-{
- int r = 0;
- if (event_base == NULL)
- return (-1);
-
- EVBASE_ACQUIRE_LOCK(event_base, th_base_lock);
- event_base->event_continue = 1;
-
- if (EVBASE_NEED_NOTIFY(event_base)) {
- r = evthread_notify_base(event_base);
- } else {
- r = (0);
- }
- EVBASE_RELEASE_LOCK(event_base, th_base_lock);
- return r;
-}
-
-int
+event_base_loopcontinue(struct event_base *event_base)
+{
+ int r = 0;
+ if (event_base == NULL)
+ return (-1);
+
+ EVBASE_ACQUIRE_LOCK(event_base, th_base_lock);
+ event_base->event_continue = 1;
+
+ if (EVBASE_NEED_NOTIFY(event_base)) {
+ r = evthread_notify_base(event_base);
+ } else {
+ r = (0);
+ }
+ EVBASE_RELEASE_LOCK(event_base, th_base_lock);
+ return r;
+}
+
+int
event_base_got_break(struct event_base *event_base)
{
int res;
@@ -1943,11 +1943,11 @@ event_base_loop(struct event_base *base, int flags)
clear_time_cache(base);
if (base->sig.ev_signal_added && base->sig.ev_n_signals_added)
- evsig_set_base_(base);
+ evsig_set_base_(base);
done = 0;
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
base->th_owner_id = EVTHREAD_GET_ID();
#endif
@@ -1955,7 +1955,7 @@ event_base_loop(struct event_base *base, int flags)
while (!done) {
base->event_continue = 0;
- base->n_deferreds_queued = 0;
+ base->n_deferreds_queued = 0;
/* Terminate the loop if we have been asked to */
if (base->event_gotterm) {
@@ -1978,14 +1978,14 @@ event_base_loop(struct event_base *base, int flags)
}
/* If we have no events, we just exit */
- if (0==(flags&EVLOOP_NO_EXIT_ON_EMPTY) &&
- !event_haveevents(base) && !N_ACTIVE_CALLBACKS(base)) {
+ if (0==(flags&EVLOOP_NO_EXIT_ON_EMPTY) &&
+ !event_haveevents(base) && !N_ACTIVE_CALLBACKS(base)) {
event_debug(("%s: no events registered.", __func__));
retval = 1;
goto done;
}
- event_queue_make_later_events_active(base);
+ event_queue_make_later_events_active(base);
clear_time_cache(base);
@@ -2030,9 +2030,9 @@ event_once_cb(evutil_socket_t fd, short events, void *arg)
struct event_once *eonce = arg;
(*eonce->cb)(fd, events, eonce->arg);
- EVBASE_ACQUIRE_LOCK(eonce->ev.ev_base, th_base_lock);
- LIST_REMOVE(eonce, next_once);
- EVBASE_RELEASE_LOCK(eonce->ev.ev_base, th_base_lock);
+ EVBASE_ACQUIRE_LOCK(eonce->ev.ev_base, th_base_lock);
+ LIST_REMOVE(eonce, next_once);
+ EVBASE_RELEASE_LOCK(eonce->ev.ev_base, th_base_lock);
event_debug_unassign(&eonce->ev);
mm_free(eonce);
}
@@ -2054,7 +2054,7 @@ event_base_once(struct event_base *base, evutil_socket_t fd, short events,
{
struct event_once *eonce;
int res = 0;
- int activate = 0;
+ int activate = 0;
if (!base)
return (-1);
@@ -2070,18 +2070,18 @@ event_base_once(struct event_base *base, evutil_socket_t fd, short events,
eonce->cb = callback;
eonce->arg = arg;
- if ((events & (EV_TIMEOUT|EV_SIGNAL|EV_READ|EV_WRITE|EV_CLOSED)) == EV_TIMEOUT) {
- evtimer_assign(&eonce->ev, base, event_once_cb, eonce);
-
- if (tv == NULL || ! evutil_timerisset(tv)) {
- /* If the event is going to become active immediately,
- * don't put it on the timeout queue. This is one
- * idiom for scheduling a callback, so let's make
- * it fast (and order-preserving). */
- activate = 1;
+ if ((events & (EV_TIMEOUT|EV_SIGNAL|EV_READ|EV_WRITE|EV_CLOSED)) == EV_TIMEOUT) {
+ evtimer_assign(&eonce->ev, base, event_once_cb, eonce);
+
+ if (tv == NULL || ! evutil_timerisset(tv)) {
+ /* If the event is going to become active immediately,
+ * don't put it on the timeout queue. This is one
+ * idiom for scheduling a callback, so let's make
+ * it fast (and order-preserving). */
+ activate = 1;
}
- } else if (events & (EV_READ|EV_WRITE|EV_CLOSED)) {
- events &= EV_READ|EV_WRITE|EV_CLOSED;
+ } else if (events & (EV_READ|EV_WRITE|EV_CLOSED)) {
+ events &= EV_READ|EV_WRITE|EV_CLOSED;
event_assign(&eonce->ev, base, fd, events, event_once_cb, eonce);
} else {
@@ -2090,20 +2090,20 @@ event_base_once(struct event_base *base, evutil_socket_t fd, short events,
return (-1);
}
- if (res == 0) {
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- if (activate)
- event_active_nolock_(&eonce->ev, EV_TIMEOUT, 1);
- else
- res = event_add_nolock_(&eonce->ev, tv, 0);
-
- if (res != 0) {
- mm_free(eonce);
- return (res);
- } else {
- LIST_INSERT_HEAD(&base->once_events, eonce, next_once);
- }
- EVBASE_RELEASE_LOCK(base, th_base_lock);
+ if (res == 0) {
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ if (activate)
+ event_active_nolock_(&eonce->ev, EV_TIMEOUT, 1);
+ else
+ res = event_add_nolock_(&eonce->ev, tv, 0);
+
+ if (res != 0) {
+ mm_free(eonce);
+ return (res);
+ } else {
+ LIST_INSERT_HEAD(&base->once_events, eonce, next_once);
+ }
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
}
return (0);
@@ -2114,12 +2114,12 @@ event_assign(struct event *ev, struct event_base *base, evutil_socket_t fd, shor
{
if (!base)
base = current_base;
- if (arg == &event_self_cbarg_ptr_)
- arg = ev;
+ if (arg == &event_self_cbarg_ptr_)
+ arg = ev;
- if (!(events & EV_SIGNAL))
- event_debug_assert_socket_nonblocking_(fd);
- event_debug_assert_not_added_(ev);
+ if (!(events & EV_SIGNAL))
+ event_debug_assert_socket_nonblocking_(fd);
+ event_debug_assert_not_added_(ev);
ev->ev_base = base;
@@ -2133,29 +2133,29 @@ event_assign(struct event *ev, struct event_base *base, evutil_socket_t fd, shor
ev->ev_pncalls = NULL;
if (events & EV_SIGNAL) {
- if ((events & (EV_READ|EV_WRITE|EV_CLOSED)) != 0) {
+ if ((events & (EV_READ|EV_WRITE|EV_CLOSED)) != 0) {
event_warnx("%s: EV_SIGNAL is not compatible with "
- "EV_READ, EV_WRITE or EV_CLOSED", __func__);
+ "EV_READ, EV_WRITE or EV_CLOSED", __func__);
return -1;
}
- ev->ev_closure = EV_CLOSURE_EVENT_SIGNAL;
+ ev->ev_closure = EV_CLOSURE_EVENT_SIGNAL;
} else {
if (events & EV_PERSIST) {
evutil_timerclear(&ev->ev_io_timeout);
- ev->ev_closure = EV_CLOSURE_EVENT_PERSIST;
+ ev->ev_closure = EV_CLOSURE_EVENT_PERSIST;
} else {
- ev->ev_closure = EV_CLOSURE_EVENT;
+ ev->ev_closure = EV_CLOSURE_EVENT;
}
}
- min_heap_elem_init_(ev);
+ min_heap_elem_init_(ev);
if (base != NULL) {
/* by default, we put new events into the middle priority */
ev->ev_pri = base->nactivequeues / 2;
}
- event_debug_note_setup_(ev);
+ event_debug_note_setup_(ev);
return 0;
}
@@ -2167,7 +2167,7 @@ event_base_set(struct event_base *base, struct event *ev)
if (ev->ev_flags != EVLIST_INIT)
return (-1);
- event_debug_assert_is_setup_(ev);
+ event_debug_assert_is_setup_(ev);
ev->ev_base = base;
ev->ev_pri = base->nactivequeues/2;
@@ -2184,27 +2184,27 @@ event_set(struct event *ev, evutil_socket_t fd, short events,
EVUTIL_ASSERT(r == 0);
}
-void *
-event_self_cbarg(void)
-{
- return &event_self_cbarg_ptr_;
-}
-
-struct event *
-event_base_get_running_event(struct event_base *base)
-{
- struct event *ev = NULL;
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- if (EVBASE_IN_THREAD(base)) {
- struct event_callback *evcb = base->current_event;
- if (evcb->evcb_flags & EVLIST_INIT)
- ev = event_callback_to_event(evcb);
- }
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- return ev;
-}
-
+void *
+event_self_cbarg(void)
+{
+ return &event_self_cbarg_ptr_;
+}
+
struct event *
+event_base_get_running_event(struct event_base *base)
+{
+ struct event *ev = NULL;
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ if (EVBASE_IN_THREAD(base)) {
+ struct event_callback *evcb = base->current_event;
+ if (evcb->evcb_flags & EVLIST_INIT)
+ ev = event_callback_to_event(evcb);
+ }
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ return ev;
+}
+
+struct event *
event_new(struct event_base *base, evutil_socket_t fd, short events, void (*cb)(evutil_socket_t, short, void *), void *arg)
{
struct event *ev;
@@ -2222,13 +2222,13 @@ event_new(struct event_base *base, evutil_socket_t fd, short events, void (*cb)(
void
event_free(struct event *ev)
{
- /* This is disabled, so that events which have been finalized be a
- * valid target for event_free(). That's */
- // event_debug_assert_is_setup_(ev);
+ /* This is disabled, so that events which have been finalized be a
+ * valid target for event_free(). That's */
+ // event_debug_assert_is_setup_(ev);
/* make sure that this event won't be coming back to haunt us. */
event_del(ev);
- event_debug_note_teardown_(ev);
+ event_debug_note_teardown_(ev);
mm_free(ev);
}
@@ -2236,117 +2236,117 @@ event_free(struct event *ev)
void
event_debug_unassign(struct event *ev)
{
- event_debug_assert_not_added_(ev);
- event_debug_note_teardown_(ev);
+ event_debug_assert_not_added_(ev);
+ event_debug_note_teardown_(ev);
ev->ev_flags &= ~EVLIST_INIT;
}
-#define EVENT_FINALIZE_FREE_ 0x10000
-static int
-event_finalize_nolock_(struct event_base *base, unsigned flags, struct event *ev, event_finalize_callback_fn cb)
-{
- ev_uint8_t closure = (flags & EVENT_FINALIZE_FREE_) ?
- EV_CLOSURE_EVENT_FINALIZE_FREE : EV_CLOSURE_EVENT_FINALIZE;
-
- event_del_nolock_(ev, EVENT_DEL_NOBLOCK);
- ev->ev_closure = closure;
- ev->ev_evcallback.evcb_cb_union.evcb_evfinalize = cb;
- event_active_nolock_(ev, EV_FINALIZE, 1);
- ev->ev_flags |= EVLIST_FINALIZING;
- return 0;
-}
-
-static int
-event_finalize_impl_(unsigned flags, struct event *ev, event_finalize_callback_fn cb)
-{
- int r;
- struct event_base *base = ev->ev_base;
- if (EVUTIL_FAILURE_CHECK(!base)) {
- event_warnx("%s: event has no event_base set.", __func__);
- return -1;
- }
-
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- r = event_finalize_nolock_(base, flags, ev, cb);
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- return r;
-}
-
-int
-event_finalize(unsigned flags, struct event *ev, event_finalize_callback_fn cb)
-{
- return event_finalize_impl_(flags, ev, cb);
-}
-
-int
-event_free_finalize(unsigned flags, struct event *ev, event_finalize_callback_fn cb)
-{
- return event_finalize_impl_(flags|EVENT_FINALIZE_FREE_, ev, cb);
-}
-
-void
-event_callback_finalize_nolock_(struct event_base *base, unsigned flags, struct event_callback *evcb, void (*cb)(struct event_callback *, void *))
-{
- struct event *ev = NULL;
- if (evcb->evcb_flags & EVLIST_INIT) {
- ev = event_callback_to_event(evcb);
- event_del_nolock_(ev, EVENT_DEL_NOBLOCK);
- } else {
- event_callback_cancel_nolock_(base, evcb, 0); /*XXX can this fail?*/
- }
-
- evcb->evcb_closure = EV_CLOSURE_CB_FINALIZE;
- evcb->evcb_cb_union.evcb_cbfinalize = cb;
- event_callback_activate_nolock_(base, evcb); /* XXX can this really fail?*/
- evcb->evcb_flags |= EVLIST_FINALIZING;
-}
-
-void
-event_callback_finalize_(struct event_base *base, unsigned flags, struct event_callback *evcb, void (*cb)(struct event_callback *, void *))
-{
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- event_callback_finalize_nolock_(base, flags, evcb, cb);
- EVBASE_RELEASE_LOCK(base, th_base_lock);
-}
-
-/** Internal: Finalize all of the n_cbs callbacks in evcbs. The provided
- * callback will be invoked on *one of them*, after they have *all* been
- * finalized. */
-int
-event_callback_finalize_many_(struct event_base *base, int n_cbs, struct event_callback **evcbs, void (*cb)(struct event_callback *, void *))
-{
- int n_pending = 0, i;
-
- if (base == NULL)
- base = current_base;
-
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
-
- event_debug(("%s: %d events finalizing", __func__, n_cbs));
-
- /* At most one can be currently executing; the rest we just
- * cancel... But we always make sure that the finalize callback
- * runs. */
- for (i = 0; i < n_cbs; ++i) {
- struct event_callback *evcb = evcbs[i];
- if (evcb == base->current_event) {
- event_callback_finalize_nolock_(base, 0, evcb, cb);
- ++n_pending;
- } else {
- event_callback_cancel_nolock_(base, evcb, 0);
- }
- }
-
- if (n_pending == 0) {
- /* Just do the first one. */
- event_callback_finalize_nolock_(base, 0, evcbs[0], cb);
- }
-
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- return 0;
-}
-
+#define EVENT_FINALIZE_FREE_ 0x10000
+static int
+event_finalize_nolock_(struct event_base *base, unsigned flags, struct event *ev, event_finalize_callback_fn cb)
+{
+ ev_uint8_t closure = (flags & EVENT_FINALIZE_FREE_) ?
+ EV_CLOSURE_EVENT_FINALIZE_FREE : EV_CLOSURE_EVENT_FINALIZE;
+
+ event_del_nolock_(ev, EVENT_DEL_NOBLOCK);
+ ev->ev_closure = closure;
+ ev->ev_evcallback.evcb_cb_union.evcb_evfinalize = cb;
+ event_active_nolock_(ev, EV_FINALIZE, 1);
+ ev->ev_flags |= EVLIST_FINALIZING;
+ return 0;
+}
+
+static int
+event_finalize_impl_(unsigned flags, struct event *ev, event_finalize_callback_fn cb)
+{
+ int r;
+ struct event_base *base = ev->ev_base;
+ if (EVUTIL_FAILURE_CHECK(!base)) {
+ event_warnx("%s: event has no event_base set.", __func__);
+ return -1;
+ }
+
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ r = event_finalize_nolock_(base, flags, ev, cb);
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ return r;
+}
+
+int
+event_finalize(unsigned flags, struct event *ev, event_finalize_callback_fn cb)
+{
+ return event_finalize_impl_(flags, ev, cb);
+}
+
+int
+event_free_finalize(unsigned flags, struct event *ev, event_finalize_callback_fn cb)
+{
+ return event_finalize_impl_(flags|EVENT_FINALIZE_FREE_, ev, cb);
+}
+
+void
+event_callback_finalize_nolock_(struct event_base *base, unsigned flags, struct event_callback *evcb, void (*cb)(struct event_callback *, void *))
+{
+ struct event *ev = NULL;
+ if (evcb->evcb_flags & EVLIST_INIT) {
+ ev = event_callback_to_event(evcb);
+ event_del_nolock_(ev, EVENT_DEL_NOBLOCK);
+ } else {
+ event_callback_cancel_nolock_(base, evcb, 0); /*XXX can this fail?*/
+ }
+
+ evcb->evcb_closure = EV_CLOSURE_CB_FINALIZE;
+ evcb->evcb_cb_union.evcb_cbfinalize = cb;
+ event_callback_activate_nolock_(base, evcb); /* XXX can this really fail?*/
+ evcb->evcb_flags |= EVLIST_FINALIZING;
+}
+
+void
+event_callback_finalize_(struct event_base *base, unsigned flags, struct event_callback *evcb, void (*cb)(struct event_callback *, void *))
+{
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ event_callback_finalize_nolock_(base, flags, evcb, cb);
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+}
+
+/** Internal: Finalize all of the n_cbs callbacks in evcbs. The provided
+ * callback will be invoked on *one of them*, after they have *all* been
+ * finalized. */
+int
+event_callback_finalize_many_(struct event_base *base, int n_cbs, struct event_callback **evcbs, void (*cb)(struct event_callback *, void *))
+{
+ int n_pending = 0, i;
+
+ if (base == NULL)
+ base = current_base;
+
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+
+ event_debug(("%s: %d events finalizing", __func__, n_cbs));
+
+ /* At most one can be currently executing; the rest we just
+ * cancel... But we always make sure that the finalize callback
+ * runs. */
+ for (i = 0; i < n_cbs; ++i) {
+ struct event_callback *evcb = evcbs[i];
+ if (evcb == base->current_event) {
+ event_callback_finalize_nolock_(base, 0, evcb, cb);
+ ++n_pending;
+ } else {
+ event_callback_cancel_nolock_(base, evcb, 0);
+ }
+ }
+
+ if (n_pending == 0) {
+ /* Just do the first one. */
+ event_callback_finalize_nolock_(base, 0, evcbs[0], cb);
+ }
+
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ return 0;
+}
+
/*
* Set's the priority of an event - if an event is already scheduled
* changing the priority is going to fail.
@@ -2355,7 +2355,7 @@ event_callback_finalize_many_(struct event_base *base, int n_cbs, struct event_c
int
event_priority_set(struct event *ev, int pri)
{
- event_debug_assert_is_setup_(ev);
+ event_debug_assert_is_setup_(ev);
if (ev->ev_flags & EVLIST_ACTIVE)
return (-1);
@@ -2382,16 +2382,16 @@ event_pending(const struct event *ev, short event, struct timeval *tv)
}
EVBASE_ACQUIRE_LOCK(ev->ev_base, th_base_lock);
- event_debug_assert_is_setup_(ev);
+ event_debug_assert_is_setup_(ev);
if (ev->ev_flags & EVLIST_INSERTED)
- flags |= (ev->ev_events & (EV_READ|EV_WRITE|EV_CLOSED|EV_SIGNAL));
- if (ev->ev_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER))
+ flags |= (ev->ev_events & (EV_READ|EV_WRITE|EV_CLOSED|EV_SIGNAL));
+ if (ev->ev_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER))
flags |= ev->ev_res;
if (ev->ev_flags & EVLIST_TIMEOUT)
flags |= EV_TIMEOUT;
- event &= (EV_TIMEOUT|EV_READ|EV_WRITE|EV_CLOSED|EV_SIGNAL);
+ event &= (EV_TIMEOUT|EV_READ|EV_WRITE|EV_CLOSED|EV_SIGNAL);
/* See if there is a timeout that we should report */
if (tv != NULL && (flags & event & EV_TIMEOUT)) {
@@ -2418,7 +2418,7 @@ event_initialized(const struct event *ev)
void
event_get_assignment(const struct event *event, struct event_base **base_out, evutil_socket_t *fd_out, short *events_out, event_callback_fn *callback_out, void **arg_out)
{
- event_debug_assert_is_setup_(event);
+ event_debug_assert_is_setup_(event);
if (base_out)
*base_out = event->ev_base;
@@ -2441,46 +2441,46 @@ event_get_struct_event_size(void)
evutil_socket_t
event_get_fd(const struct event *ev)
{
- event_debug_assert_is_setup_(ev);
+ event_debug_assert_is_setup_(ev);
return ev->ev_fd;
}
struct event_base *
event_get_base(const struct event *ev)
{
- event_debug_assert_is_setup_(ev);
+ event_debug_assert_is_setup_(ev);
return ev->ev_base;
}
short
event_get_events(const struct event *ev)
{
- event_debug_assert_is_setup_(ev);
+ event_debug_assert_is_setup_(ev);
return ev->ev_events;
}
event_callback_fn
event_get_callback(const struct event *ev)
{
- event_debug_assert_is_setup_(ev);
+ event_debug_assert_is_setup_(ev);
return ev->ev_callback;
}
void *
event_get_callback_arg(const struct event *ev)
{
- event_debug_assert_is_setup_(ev);
+ event_debug_assert_is_setup_(ev);
return ev->ev_arg;
}
int
-event_get_priority(const struct event *ev)
-{
- event_debug_assert_is_setup_(ev);
- return ev->ev_pri;
-}
-
-int
+event_get_priority(const struct event *ev)
+{
+ event_debug_assert_is_setup_(ev);
+ return ev->ev_pri;
+}
+
+int
event_add(struct event *ev, const struct timeval *tv)
{
int res;
@@ -2492,7 +2492,7 @@ event_add(struct event *ev, const struct timeval *tv)
EVBASE_ACQUIRE_LOCK(ev->ev_base, th_base_lock);
- res = event_add_nolock_(ev, tv, 0);
+ res = event_add_nolock_(ev, tv, 0);
EVBASE_RELEASE_LOCK(ev->ev_base, th_base_lock);
@@ -2509,15 +2509,15 @@ evthread_notify_base_default(struct event_base *base)
char buf[1];
int r;
buf[0] = (char) 0;
-#ifdef _WIN32
+#ifdef _WIN32
r = send(base->th_notify_fd[1], buf, 1, 0);
#else
r = write(base->th_notify_fd[1], buf, 1);
#endif
- return (r < 0 && ! EVUTIL_ERR_IS_EAGAIN(errno)) ? -1 : 0;
+ return (r < 0 && ! EVUTIL_ERR_IS_EAGAIN(errno)) ? -1 : 0;
}
-#ifdef EVENT__HAVE_EVENTFD
+#ifdef EVENT__HAVE_EVENTFD
/* Helper callback: wake an event_base from another thread. This version
* assumes that you have a working eventfd() implementation. */
static int
@@ -2533,10 +2533,10 @@ evthread_notify_base_eventfd(struct event_base *base)
}
#endif
-
+
/** Tell the thread currently running the event_loop for base (if any) that it
* needs to stop waiting in its dispatch function (if it is) and process all
- * active callbacks. */
+ * active callbacks. */
static int
evthread_notify_base(struct event_base *base)
{
@@ -2549,52 +2549,52 @@ evthread_notify_base(struct event_base *base)
return base->th_notify_fn(base);
}
-/* Implementation function to remove a timeout on a currently pending event.
- */
-int
-event_remove_timer_nolock_(struct event *ev)
-{
- struct event_base *base = ev->ev_base;
-
- EVENT_BASE_ASSERT_LOCKED(base);
- event_debug_assert_is_setup_(ev);
-
- event_debug(("event_remove_timer_nolock: event: %p", ev));
-
- /* If it's not pending on a timeout, we don't need to do anything. */
- if (ev->ev_flags & EVLIST_TIMEOUT) {
- event_queue_remove_timeout(base, ev);
- evutil_timerclear(&ev->ev_.ev_io.ev_timeout);
- }
-
- return (0);
-}
-
-int
-event_remove_timer(struct event *ev)
-{
- int res;
-
- if (EVUTIL_FAILURE_CHECK(!ev->ev_base)) {
- event_warnx("%s: event has no event_base set.", __func__);
- return -1;
- }
-
- EVBASE_ACQUIRE_LOCK(ev->ev_base, th_base_lock);
-
- res = event_remove_timer_nolock_(ev);
-
- EVBASE_RELEASE_LOCK(ev->ev_base, th_base_lock);
-
- return (res);
-}
-
+/* Implementation function to remove a timeout on a currently pending event.
+ */
+int
+event_remove_timer_nolock_(struct event *ev)
+{
+ struct event_base *base = ev->ev_base;
+
+ EVENT_BASE_ASSERT_LOCKED(base);
+ event_debug_assert_is_setup_(ev);
+
+ event_debug(("event_remove_timer_nolock: event: %p", ev));
+
+ /* If it's not pending on a timeout, we don't need to do anything. */
+ if (ev->ev_flags & EVLIST_TIMEOUT) {
+ event_queue_remove_timeout(base, ev);
+ evutil_timerclear(&ev->ev_.ev_io.ev_timeout);
+ }
+
+ return (0);
+}
+
+int
+event_remove_timer(struct event *ev)
+{
+ int res;
+
+ if (EVUTIL_FAILURE_CHECK(!ev->ev_base)) {
+ event_warnx("%s: event has no event_base set.", __func__);
+ return -1;
+ }
+
+ EVBASE_ACQUIRE_LOCK(ev->ev_base, th_base_lock);
+
+ res = event_remove_timer_nolock_(ev);
+
+ EVBASE_RELEASE_LOCK(ev->ev_base, th_base_lock);
+
+ return (res);
+}
+
/* Implementation function to add an event. Works just like event_add,
* except: 1) it requires that we have the lock. 2) if tv_is_absolute is set,
* we treat tv as an absolute time, not as an interval to add to the current
* time */
-int
-event_add_nolock_(struct event *ev, const struct timeval *tv,
+int
+event_add_nolock_(struct event *ev, const struct timeval *tv,
int tv_is_absolute)
{
struct event_base *base = ev->ev_base;
@@ -2602,32 +2602,32 @@ event_add_nolock_(struct event *ev, const struct timeval *tv,
int notify = 0;
EVENT_BASE_ASSERT_LOCKED(base);
- event_debug_assert_is_setup_(ev);
+ event_debug_assert_is_setup_(ev);
event_debug((
- "event_add: event: %p (fd "EV_SOCK_FMT"), %s%s%s%scall %p",
+ "event_add: event: %p (fd "EV_SOCK_FMT"), %s%s%s%scall %p",
ev,
EV_SOCK_ARG(ev->ev_fd),
ev->ev_events & EV_READ ? "EV_READ " : " ",
ev->ev_events & EV_WRITE ? "EV_WRITE " : " ",
- ev->ev_events & EV_CLOSED ? "EV_CLOSED " : " ",
+ ev->ev_events & EV_CLOSED ? "EV_CLOSED " : " ",
tv ? "EV_TIMEOUT " : " ",
ev->ev_callback));
EVUTIL_ASSERT(!(ev->ev_flags & ~EVLIST_ALL));
- if (ev->ev_flags & EVLIST_FINALIZING) {
- /* XXXX debug */
- return (-1);
- }
-
+ if (ev->ev_flags & EVLIST_FINALIZING) {
+ /* XXXX debug */
+ return (-1);
+ }
+
/*
* prepare for timeout insertion further below, if we get a
* failure on any step, we should not change any state.
*/
if (tv != NULL && !(ev->ev_flags & EVLIST_TIMEOUT)) {
- if (min_heap_reserve_(&base->timeheap,
- 1 + min_heap_size_(&base->timeheap)) == -1)
+ if (min_heap_reserve_(&base->timeheap,
+ 1 + min_heap_size_(&base->timeheap)) == -1)
return (-1); /* ENOMEM == errno */
}
@@ -2635,23 +2635,23 @@ event_add_nolock_(struct event *ev, const struct timeval *tv,
* callback, and we are not the main thread, then we want to wait
* until the callback is done before we mess with the event, or else
* we can race on ev_ncalls and ev_pncalls below. */
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
- if (base->current_event == event_to_event_callback(ev) &&
- (ev->ev_events & EV_SIGNAL)
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
+ if (base->current_event == event_to_event_callback(ev) &&
+ (ev->ev_events & EV_SIGNAL)
&& !EVBASE_IN_THREAD(base)) {
++base->current_event_waiters;
EVTHREAD_COND_WAIT(base->current_event_cond, base->th_base_lock);
}
#endif
- if ((ev->ev_events & (EV_READ|EV_WRITE|EV_CLOSED|EV_SIGNAL)) &&
- !(ev->ev_flags & (EVLIST_INSERTED|EVLIST_ACTIVE|EVLIST_ACTIVE_LATER))) {
- if (ev->ev_events & (EV_READ|EV_WRITE|EV_CLOSED))
- res = evmap_io_add_(base, ev->ev_fd, ev);
+ if ((ev->ev_events & (EV_READ|EV_WRITE|EV_CLOSED|EV_SIGNAL)) &&
+ !(ev->ev_flags & (EVLIST_INSERTED|EVLIST_ACTIVE|EVLIST_ACTIVE_LATER))) {
+ if (ev->ev_events & (EV_READ|EV_WRITE|EV_CLOSED))
+ res = evmap_io_add_(base, ev->ev_fd, ev);
else if (ev->ev_events & EV_SIGNAL)
- res = evmap_signal_add_(base, (int)ev->ev_fd, ev);
+ res = evmap_signal_add_(base, (int)ev->ev_fd, ev);
if (res != -1)
- event_queue_insert_inserted(base, ev);
+ event_queue_insert_inserted(base, ev);
if (res == 1) {
/* evmap says we need to notify the main thread. */
notify = 1;
@@ -2666,10 +2666,10 @@ event_add_nolock_(struct event *ev, const struct timeval *tv,
if (res != -1 && tv != NULL) {
struct timeval now;
int common_timeout;
-#ifdef USE_REINSERT_TIMEOUT
- int was_common;
- int old_timeout_idx;
-#endif
+#ifdef USE_REINSERT_TIMEOUT
+ int was_common;
+ int old_timeout_idx;
+#endif
/*
* for persistent timeout events, we remember the
@@ -2677,14 +2677,14 @@ event_add_nolock_(struct event *ev, const struct timeval *tv,
*
* If tv_is_absolute, this was already set.
*/
- if (ev->ev_closure == EV_CLOSURE_EVENT_PERSIST && !tv_is_absolute)
+ if (ev->ev_closure == EV_CLOSURE_EVENT_PERSIST && !tv_is_absolute)
ev->ev_io_timeout = *tv;
-#ifndef USE_REINSERT_TIMEOUT
+#ifndef USE_REINSERT_TIMEOUT
if (ev->ev_flags & EVLIST_TIMEOUT) {
- event_queue_remove_timeout(base, ev);
+ event_queue_remove_timeout(base, ev);
}
-#endif
+#endif
/* Check if it is active due to a timeout. Rescheduling
* this timeout before the callback can be executed
@@ -2701,17 +2701,17 @@ event_add_nolock_(struct event *ev, const struct timeval *tv,
}
}
- event_queue_remove_active(base, event_to_event_callback(ev));
+ event_queue_remove_active(base, event_to_event_callback(ev));
}
gettime(base, &now);
common_timeout = is_common_timeout(tv, base);
-#ifdef USE_REINSERT_TIMEOUT
- was_common = is_common_timeout(&ev->ev_timeout, base);
- old_timeout_idx = COMMON_TIMEOUT_IDX(&ev->ev_timeout);
-#endif
-
+#ifdef USE_REINSERT_TIMEOUT
+ was_common = is_common_timeout(&ev->ev_timeout, base);
+ old_timeout_idx = COMMON_TIMEOUT_IDX(&ev->ev_timeout);
+#endif
+
if (tv_is_absolute) {
ev->ev_timeout = *tv;
} else if (common_timeout) {
@@ -2725,15 +2725,15 @@ event_add_nolock_(struct event *ev, const struct timeval *tv,
}
event_debug((
- "event_add: event %p, timeout in %d seconds %d useconds, call %p",
- ev, (int)tv->tv_sec, (int)tv->tv_usec, ev->ev_callback));
-
-#ifdef USE_REINSERT_TIMEOUT
- event_queue_reinsert_timeout(base, ev, was_common, common_timeout, old_timeout_idx);
-#else
- event_queue_insert_timeout(base, ev);
-#endif
-
+ "event_add: event %p, timeout in %d seconds %d useconds, call %p",
+ ev, (int)tv->tv_sec, (int)tv->tv_usec, ev->ev_callback));
+
+#ifdef USE_REINSERT_TIMEOUT
+ event_queue_reinsert_timeout(base, ev, was_common, common_timeout, old_timeout_idx);
+#else
+ event_queue_insert_timeout(base, ev);
+#endif
+
if (common_timeout) {
struct common_timeout_list *ctl =
get_common_timeout_list(base, &ev->ev_timeout);
@@ -2741,18 +2741,18 @@ event_add_nolock_(struct event *ev, const struct timeval *tv,
common_timeout_schedule(ctl, &now, ev);
}
} else {
- struct event* top = NULL;
+ struct event* top = NULL;
/* See if the earliest timeout is now earlier than it
* was before: if so, we will need to tell the main
- * thread to wake up earlier than it would otherwise.
- * We double check the timeout of the top element to
- * handle time distortions due to system suspension.
- */
- if (min_heap_elt_is_top_(ev))
- notify = 1;
- else if ((top = min_heap_top_(&base->timeheap)) != NULL &&
- evutil_timercmp(&top->ev_timeout, &now, <))
+ * thread to wake up earlier than it would otherwise.
+ * We double check the timeout of the top element to
+ * handle time distortions due to system suspension.
+ */
+ if (min_heap_elt_is_top_(ev))
notify = 1;
+ else if ((top = min_heap_top_(&base->timeheap)) != NULL &&
+ evutil_timercmp(&top->ev_timeout, &now, <))
+ notify = 1;
}
}
@@ -2760,55 +2760,55 @@ event_add_nolock_(struct event *ev, const struct timeval *tv,
if (res != -1 && notify && EVBASE_NEED_NOTIFY(base))
evthread_notify_base(base);
- event_debug_note_add_(ev);
+ event_debug_note_add_(ev);
return (res);
}
-static int
-event_del_(struct event *ev, int blocking)
+static int
+event_del_(struct event *ev, int blocking)
{
int res;
- struct event_base *base = ev->ev_base;
+ struct event_base *base = ev->ev_base;
- if (EVUTIL_FAILURE_CHECK(!base)) {
+ if (EVUTIL_FAILURE_CHECK(!base)) {
event_warnx("%s: event has no event_base set.", __func__);
return -1;
}
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- res = event_del_nolock_(ev, blocking);
- EVBASE_RELEASE_LOCK(base, th_base_lock);
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ res = event_del_nolock_(ev, blocking);
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
- return (res);
-}
+ return (res);
+}
-int
-event_del(struct event *ev)
-{
- return event_del_(ev, EVENT_DEL_AUTOBLOCK);
-}
+int
+event_del(struct event *ev)
+{
+ return event_del_(ev, EVENT_DEL_AUTOBLOCK);
+}
-int
-event_del_block(struct event *ev)
-{
- return event_del_(ev, EVENT_DEL_BLOCK);
+int
+event_del_block(struct event *ev)
+{
+ return event_del_(ev, EVENT_DEL_BLOCK);
}
-int
-event_del_noblock(struct event *ev)
-{
- return event_del_(ev, EVENT_DEL_NOBLOCK);
-}
-
-/** Helper for event_del: always called with th_base_lock held.
- *
- * "blocking" must be one of the EVENT_DEL_{BLOCK, NOBLOCK, AUTOBLOCK,
- * EVEN_IF_FINALIZING} values. See those for more information.
- */
-int
-event_del_nolock_(struct event *ev, int blocking)
+int
+event_del_noblock(struct event *ev)
{
+ return event_del_(ev, EVENT_DEL_NOBLOCK);
+}
+
+/** Helper for event_del: always called with th_base_lock held.
+ *
+ * "blocking" must be one of the EVENT_DEL_{BLOCK, NOBLOCK, AUTOBLOCK,
+ * EVEN_IF_FINALIZING} values. See those for more information.
+ */
+int
+event_del_nolock_(struct event *ev, int blocking)
+{
struct event_base *base;
int res = 0, notify = 0;
@@ -2821,15 +2821,15 @@ event_del_nolock_(struct event *ev, int blocking)
EVENT_BASE_ASSERT_LOCKED(ev->ev_base);
- if (blocking != EVENT_DEL_EVEN_IF_FINALIZING) {
- if (ev->ev_flags & EVLIST_FINALIZING) {
- /* XXXX Debug */
- return 0;
- }
+ if (blocking != EVENT_DEL_EVEN_IF_FINALIZING) {
+ if (ev->ev_flags & EVLIST_FINALIZING) {
+ /* XXXX Debug */
+ return 0;
+ }
}
- base = ev->ev_base;
-
+ base = ev->ev_base;
+
EVUTIL_ASSERT(!(ev->ev_flags & ~EVLIST_ALL));
/* See if we are just active executing this event in a loop */
@@ -2848,52 +2848,52 @@ event_del_nolock_(struct event *ev, int blocking)
* dispatch loop early anyway, so we wouldn't gain anything by
* doing it.
*/
- event_queue_remove_timeout(base, ev);
+ event_queue_remove_timeout(base, ev);
}
if (ev->ev_flags & EVLIST_ACTIVE)
- event_queue_remove_active(base, event_to_event_callback(ev));
- else if (ev->ev_flags & EVLIST_ACTIVE_LATER)
- event_queue_remove_active_later(base, event_to_event_callback(ev));
+ event_queue_remove_active(base, event_to_event_callback(ev));
+ else if (ev->ev_flags & EVLIST_ACTIVE_LATER)
+ event_queue_remove_active_later(base, event_to_event_callback(ev));
if (ev->ev_flags & EVLIST_INSERTED) {
- event_queue_remove_inserted(base, ev);
- if (ev->ev_events & (EV_READ|EV_WRITE|EV_CLOSED))
- res = evmap_io_del_(base, ev->ev_fd, ev);
+ event_queue_remove_inserted(base, ev);
+ if (ev->ev_events & (EV_READ|EV_WRITE|EV_CLOSED))
+ res = evmap_io_del_(base, ev->ev_fd, ev);
else
- res = evmap_signal_del_(base, (int)ev->ev_fd, ev);
+ res = evmap_signal_del_(base, (int)ev->ev_fd, ev);
if (res == 1) {
/* evmap says we need to notify the main thread. */
notify = 1;
res = 0;
}
- /* If we do not have events, let's notify event base so it can
- * exit without waiting */
- if (!event_haveevents(base) && !N_ACTIVE_CALLBACKS(base))
- notify = 1;
+ /* If we do not have events, let's notify event base so it can
+ * exit without waiting */
+ if (!event_haveevents(base) && !N_ACTIVE_CALLBACKS(base))
+ notify = 1;
}
/* if we are not in the right thread, we need to wake up the loop */
if (res != -1 && notify && EVBASE_NEED_NOTIFY(base))
evthread_notify_base(base);
- event_debug_note_del_(ev);
-
- /* If the main thread is currently executing this event's callback,
- * and we are not the main thread, then we want to wait until the
- * callback is done before returning. That way, when this function
- * returns, it will be safe to free the user-supplied argument.
- */
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
- if (blocking != EVENT_DEL_NOBLOCK &&
- base->current_event == event_to_event_callback(ev) &&
- !EVBASE_IN_THREAD(base) &&
- (blocking == EVENT_DEL_BLOCK || !(ev->ev_events & EV_FINALIZE))) {
- ++base->current_event_waiters;
- EVTHREAD_COND_WAIT(base->current_event_cond, base->th_base_lock);
- }
-#endif
-
+ event_debug_note_del_(ev);
+
+ /* If the main thread is currently executing this event's callback,
+ * and we are not the main thread, then we want to wait until the
+ * callback is done before returning. That way, when this function
+ * returns, it will be safe to free the user-supplied argument.
+ */
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
+ if (blocking != EVENT_DEL_NOBLOCK &&
+ base->current_event == event_to_event_callback(ev) &&
+ !EVBASE_IN_THREAD(base) &&
+ (blocking == EVENT_DEL_BLOCK || !(ev->ev_events & EV_FINALIZE))) {
+ ++base->current_event_waiters;
+ EVTHREAD_COND_WAIT(base->current_event_cond, base->th_base_lock);
+ }
+#endif
+
return (res);
}
@@ -2907,54 +2907,54 @@ event_active(struct event *ev, int res, short ncalls)
EVBASE_ACQUIRE_LOCK(ev->ev_base, th_base_lock);
- event_debug_assert_is_setup_(ev);
+ event_debug_assert_is_setup_(ev);
- event_active_nolock_(ev, res, ncalls);
+ event_active_nolock_(ev, res, ncalls);
EVBASE_RELEASE_LOCK(ev->ev_base, th_base_lock);
}
void
-event_active_nolock_(struct event *ev, int res, short ncalls)
+event_active_nolock_(struct event *ev, int res, short ncalls)
{
struct event_base *base;
event_debug(("event_active: %p (fd "EV_SOCK_FMT"), res %d, callback %p",
ev, EV_SOCK_ARG(ev->ev_fd), (int)res, ev->ev_callback));
- base = ev->ev_base;
- EVENT_BASE_ASSERT_LOCKED(base);
-
- if (ev->ev_flags & EVLIST_FINALIZING) {
- /* XXXX debug */
- return;
- }
-
- switch ((ev->ev_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER))) {
- default:
- case EVLIST_ACTIVE|EVLIST_ACTIVE_LATER:
- EVUTIL_ASSERT(0);
- break;
- case EVLIST_ACTIVE:
- /* We get different kinds of events, add them together */
+ base = ev->ev_base;
+ EVENT_BASE_ASSERT_LOCKED(base);
+
+ if (ev->ev_flags & EVLIST_FINALIZING) {
+ /* XXXX debug */
+ return;
+ }
+
+ switch ((ev->ev_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER))) {
+ default:
+ case EVLIST_ACTIVE|EVLIST_ACTIVE_LATER:
+ EVUTIL_ASSERT(0);
+ break;
+ case EVLIST_ACTIVE:
+ /* We get different kinds of events, add them together */
ev->ev_res |= res;
return;
- case EVLIST_ACTIVE_LATER:
- ev->ev_res |= res;
- break;
- case 0:
- ev->ev_res = res;
- break;
+ case EVLIST_ACTIVE_LATER:
+ ev->ev_res |= res;
+ break;
+ case 0:
+ ev->ev_res = res;
+ break;
}
if (ev->ev_pri < base->event_running_priority)
base->event_continue = 1;
if (ev->ev_events & EV_SIGNAL) {
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
- if (base->current_event == event_to_event_callback(ev) &&
- !EVBASE_IN_THREAD(base)) {
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
+ if (base->current_event == event_to_event_callback(ev) &&
+ !EVBASE_IN_THREAD(base)) {
++base->current_event_waiters;
EVTHREAD_COND_WAIT(base->current_event_cond, base->th_base_lock);
}
@@ -2963,180 +2963,180 @@ event_active_nolock_(struct event *ev, int res, short ncalls)
ev->ev_pncalls = NULL;
}
- event_callback_activate_nolock_(base, event_to_event_callback(ev));
-}
-
-void
-event_active_later_(struct event *ev, int res)
-{
- EVBASE_ACQUIRE_LOCK(ev->ev_base, th_base_lock);
- event_active_later_nolock_(ev, res);
- EVBASE_RELEASE_LOCK(ev->ev_base, th_base_lock);
-}
-
-void
-event_active_later_nolock_(struct event *ev, int res)
-{
- struct event_base *base = ev->ev_base;
- EVENT_BASE_ASSERT_LOCKED(base);
-
- if (ev->ev_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER)) {
- /* We get different kinds of events, add them together */
- ev->ev_res |= res;
- return;
- }
-
- ev->ev_res = res;
-
- event_callback_activate_later_nolock_(base, event_to_event_callback(ev));
-}
-
-int
-event_callback_activate_(struct event_base *base,
- struct event_callback *evcb)
-{
- int r;
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- r = event_callback_activate_nolock_(base, evcb);
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- return r;
-}
-
-int
-event_callback_activate_nolock_(struct event_base *base,
- struct event_callback *evcb)
-{
- int r = 1;
-
- if (evcb->evcb_flags & EVLIST_FINALIZING)
- return 0;
-
- switch (evcb->evcb_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER)) {
- default:
- EVUTIL_ASSERT(0);
- EVUTIL_FALLTHROUGH;
- case EVLIST_ACTIVE_LATER:
- event_queue_remove_active_later(base, evcb);
- r = 0;
- break;
- case EVLIST_ACTIVE:
- return 0;
- case 0:
- break;
- }
-
- event_queue_insert_active(base, evcb);
-
- if (EVBASE_NEED_NOTIFY(base))
- evthread_notify_base(base);
-
- return r;
-}
-
-int
-event_callback_activate_later_nolock_(struct event_base *base,
- struct event_callback *evcb)
-{
- if (evcb->evcb_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER))
- return 0;
-
- event_queue_insert_active_later(base, evcb);
- if (EVBASE_NEED_NOTIFY(base))
- evthread_notify_base(base);
- return 1;
-}
-
-void
-event_callback_init_(struct event_base *base,
- struct event_callback *cb)
-{
- memset(cb, 0, sizeof(*cb));
- cb->evcb_pri = base->nactivequeues - 1;
-}
-
-int
-event_callback_cancel_(struct event_base *base,
- struct event_callback *evcb)
-{
- int r;
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- r = event_callback_cancel_nolock_(base, evcb, 0);
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- return r;
-}
-
-int
-event_callback_cancel_nolock_(struct event_base *base,
- struct event_callback *evcb, int even_if_finalizing)
-{
- if ((evcb->evcb_flags & EVLIST_FINALIZING) && !even_if_finalizing)
- return 0;
-
- if (evcb->evcb_flags & EVLIST_INIT)
- return event_del_nolock_(event_callback_to_event(evcb),
- even_if_finalizing ? EVENT_DEL_EVEN_IF_FINALIZING : EVENT_DEL_AUTOBLOCK);
-
- switch ((evcb->evcb_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER))) {
- default:
- case EVLIST_ACTIVE|EVLIST_ACTIVE_LATER:
- EVUTIL_ASSERT(0);
- break;
- case EVLIST_ACTIVE:
- /* We get different kinds of events, add them together */
- event_queue_remove_active(base, evcb);
- return 0;
- case EVLIST_ACTIVE_LATER:
- event_queue_remove_active_later(base, evcb);
- break;
- case 0:
- break;
- }
-
- return 0;
+ event_callback_activate_nolock_(base, event_to_event_callback(ev));
}
void
-event_deferred_cb_init_(struct event_callback *cb, ev_uint8_t priority, deferred_cb_fn fn, void *arg)
+event_active_later_(struct event *ev, int res)
{
- memset(cb, 0, sizeof(*cb));
- cb->evcb_cb_union.evcb_selfcb = fn;
- cb->evcb_arg = arg;
- cb->evcb_pri = priority;
- cb->evcb_closure = EV_CLOSURE_CB_SELF;
+ EVBASE_ACQUIRE_LOCK(ev->ev_base, th_base_lock);
+ event_active_later_nolock_(ev, res);
+ EVBASE_RELEASE_LOCK(ev->ev_base, th_base_lock);
}
void
-event_deferred_cb_set_priority_(struct event_callback *cb, ev_uint8_t priority)
-{
- cb->evcb_pri = priority;
-}
-
+event_active_later_nolock_(struct event *ev, int res)
+{
+ struct event_base *base = ev->ev_base;
+ EVENT_BASE_ASSERT_LOCKED(base);
+
+ if (ev->ev_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER)) {
+ /* We get different kinds of events, add them together */
+ ev->ev_res |= res;
+ return;
+ }
+
+ ev->ev_res = res;
+
+ event_callback_activate_later_nolock_(base, event_to_event_callback(ev));
+}
+
+int
+event_callback_activate_(struct event_base *base,
+ struct event_callback *evcb)
+{
+ int r;
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ r = event_callback_activate_nolock_(base, evcb);
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ return r;
+}
+
+int
+event_callback_activate_nolock_(struct event_base *base,
+ struct event_callback *evcb)
+{
+ int r = 1;
+
+ if (evcb->evcb_flags & EVLIST_FINALIZING)
+ return 0;
+
+ switch (evcb->evcb_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER)) {
+ default:
+ EVUTIL_ASSERT(0);
+ EVUTIL_FALLTHROUGH;
+ case EVLIST_ACTIVE_LATER:
+ event_queue_remove_active_later(base, evcb);
+ r = 0;
+ break;
+ case EVLIST_ACTIVE:
+ return 0;
+ case 0:
+ break;
+ }
+
+ event_queue_insert_active(base, evcb);
+
+ if (EVBASE_NEED_NOTIFY(base))
+ evthread_notify_base(base);
+
+ return r;
+}
+
+int
+event_callback_activate_later_nolock_(struct event_base *base,
+ struct event_callback *evcb)
+{
+ if (evcb->evcb_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER))
+ return 0;
+
+ event_queue_insert_active_later(base, evcb);
+ if (EVBASE_NEED_NOTIFY(base))
+ evthread_notify_base(base);
+ return 1;
+}
+
void
-event_deferred_cb_cancel_(struct event_base *base, struct event_callback *cb)
-{
- if (!base)
- base = current_base;
- event_callback_cancel_(base, cb);
-}
-
-#define MAX_DEFERREDS_QUEUED 32
-int
-event_deferred_cb_schedule_(struct event_base *base, struct event_callback *cb)
-{
- int r = 1;
- if (!base)
- base = current_base;
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- if (base->n_deferreds_queued > MAX_DEFERREDS_QUEUED) {
- r = event_callback_activate_later_nolock_(base, cb);
- } else {
- r = event_callback_activate_nolock_(base, cb);
- if (r) {
- ++base->n_deferreds_queued;
- }
- }
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- return r;
+event_callback_init_(struct event_base *base,
+ struct event_callback *cb)
+{
+ memset(cb, 0, sizeof(*cb));
+ cb->evcb_pri = base->nactivequeues - 1;
+}
+
+int
+event_callback_cancel_(struct event_base *base,
+ struct event_callback *evcb)
+{
+ int r;
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ r = event_callback_cancel_nolock_(base, evcb, 0);
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ return r;
+}
+
+int
+event_callback_cancel_nolock_(struct event_base *base,
+ struct event_callback *evcb, int even_if_finalizing)
+{
+ if ((evcb->evcb_flags & EVLIST_FINALIZING) && !even_if_finalizing)
+ return 0;
+
+ if (evcb->evcb_flags & EVLIST_INIT)
+ return event_del_nolock_(event_callback_to_event(evcb),
+ even_if_finalizing ? EVENT_DEL_EVEN_IF_FINALIZING : EVENT_DEL_AUTOBLOCK);
+
+ switch ((evcb->evcb_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER))) {
+ default:
+ case EVLIST_ACTIVE|EVLIST_ACTIVE_LATER:
+ EVUTIL_ASSERT(0);
+ break;
+ case EVLIST_ACTIVE:
+ /* We get different kinds of events, add them together */
+ event_queue_remove_active(base, evcb);
+ return 0;
+ case EVLIST_ACTIVE_LATER:
+ event_queue_remove_active_later(base, evcb);
+ break;
+ case 0:
+ break;
+ }
+
+ return 0;
+}
+
+void
+event_deferred_cb_init_(struct event_callback *cb, ev_uint8_t priority, deferred_cb_fn fn, void *arg)
+{
+ memset(cb, 0, sizeof(*cb));
+ cb->evcb_cb_union.evcb_selfcb = fn;
+ cb->evcb_arg = arg;
+ cb->evcb_pri = priority;
+ cb->evcb_closure = EV_CLOSURE_CB_SELF;
+}
+
+void
+event_deferred_cb_set_priority_(struct event_callback *cb, ev_uint8_t priority)
+{
+ cb->evcb_pri = priority;
+}
+
+void
+event_deferred_cb_cancel_(struct event_base *base, struct event_callback *cb)
+{
+ if (!base)
+ base = current_base;
+ event_callback_cancel_(base, cb);
+}
+
+#define MAX_DEFERREDS_QUEUED 32
+int
+event_deferred_cb_schedule_(struct event_base *base, struct event_callback *cb)
+{
+ int r = 1;
+ if (!base)
+ base = current_base;
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ if (base->n_deferreds_queued > MAX_DEFERREDS_QUEUED) {
+ r = event_callback_activate_later_nolock_(base, cb);
+ } else {
+ r = event_callback_activate_nolock_(base, cb);
+ if (r) {
+ ++base->n_deferreds_queued;
+ }
+ }
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ return r;
}
static int
@@ -3148,7 +3148,7 @@ timeout_next(struct event_base *base, struct timeval **tv_p)
struct timeval *tv = *tv_p;
int res = 0;
- ev = min_heap_top_(&base->timeheap);
+ ev = min_heap_top_(&base->timeheap);
if (ev == NULL) {
/* if no time-based events are active wait for I/O */
@@ -3170,7 +3170,7 @@ timeout_next(struct event_base *base, struct timeval **tv_p)
EVUTIL_ASSERT(tv->tv_sec >= 0);
EVUTIL_ASSERT(tv->tv_usec >= 0);
- event_debug(("timeout_next: event: %p, in %d seconds, %d useconds", ev, (int)tv->tv_sec, (int)tv->tv_usec));
+ event_debug(("timeout_next: event: %p, in %d seconds, %d useconds", ev, (int)tv->tv_sec, (int)tv->tv_usec));
out:
return (res);
@@ -3184,147 +3184,147 @@ timeout_process(struct event_base *base)
struct timeval now;
struct event *ev;
- if (min_heap_empty_(&base->timeheap)) {
+ if (min_heap_empty_(&base->timeheap)) {
return;
}
gettime(base, &now);
- while ((ev = min_heap_top_(&base->timeheap))) {
+ while ((ev = min_heap_top_(&base->timeheap))) {
if (evutil_timercmp(&ev->ev_timeout, &now, >))
break;
/* delete this event from the I/O queues */
- event_del_nolock_(ev, EVENT_DEL_NOBLOCK);
-
- event_debug(("timeout_process: event: %p, call %p",
- ev, ev->ev_callback));
- event_active_nolock_(ev, EV_TIMEOUT, 1);
- }
-}
-
-#ifndef MAX
-#define MAX(a,b) (((a)>(b))?(a):(b))
-#endif
-
-#define MAX_EVENT_COUNT(var, v) var = MAX(var, v)
-
-/* These are a fancy way to spell
- if (~flags & EVLIST_INTERNAL)
- base->event_count--/++;
-*/
-#define DECR_EVENT_COUNT(base,flags) \
- ((base)->event_count -= !((flags) & EVLIST_INTERNAL))
-#define INCR_EVENT_COUNT(base,flags) do { \
- ((base)->event_count += !((flags) & EVLIST_INTERNAL)); \
- MAX_EVENT_COUNT((base)->event_count_max, (base)->event_count); \
-} while (0)
-
-static void
-event_queue_remove_inserted(struct event_base *base, struct event *ev)
-{
- EVENT_BASE_ASSERT_LOCKED(base);
- if (EVUTIL_FAILURE_CHECK(!(ev->ev_flags & EVLIST_INSERTED))) {
- event_errx(1, "%s: %p(fd "EV_SOCK_FMT") not on queue %x", __func__,
- ev, EV_SOCK_ARG(ev->ev_fd), EVLIST_INSERTED);
- return;
- }
- DECR_EVENT_COUNT(base, ev->ev_flags);
- ev->ev_flags &= ~EVLIST_INSERTED;
-}
-static void
-event_queue_remove_active(struct event_base *base, struct event_callback *evcb)
-{
- EVENT_BASE_ASSERT_LOCKED(base);
- if (EVUTIL_FAILURE_CHECK(!(evcb->evcb_flags & EVLIST_ACTIVE))) {
- event_errx(1, "%s: %p not on queue %x", __func__,
- evcb, EVLIST_ACTIVE);
- return;
- }
- DECR_EVENT_COUNT(base, evcb->evcb_flags);
- evcb->evcb_flags &= ~EVLIST_ACTIVE;
- base->event_count_active--;
-
- TAILQ_REMOVE(&base->activequeues[evcb->evcb_pri],
- evcb, evcb_active_next);
-}
-static void
-event_queue_remove_active_later(struct event_base *base, struct event_callback *evcb)
-{
- EVENT_BASE_ASSERT_LOCKED(base);
- if (EVUTIL_FAILURE_CHECK(!(evcb->evcb_flags & EVLIST_ACTIVE_LATER))) {
- event_errx(1, "%s: %p not on queue %x", __func__,
- evcb, EVLIST_ACTIVE_LATER);
- return;
- }
- DECR_EVENT_COUNT(base, evcb->evcb_flags);
- evcb->evcb_flags &= ~EVLIST_ACTIVE_LATER;
- base->event_count_active--;
-
- TAILQ_REMOVE(&base->active_later_queue, evcb, evcb_active_next);
-}
+ event_del_nolock_(ev, EVENT_DEL_NOBLOCK);
+
+ event_debug(("timeout_process: event: %p, call %p",
+ ev, ev->ev_callback));
+ event_active_nolock_(ev, EV_TIMEOUT, 1);
+ }
+}
+
+#ifndef MAX
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+
+#define MAX_EVENT_COUNT(var, v) var = MAX(var, v)
+
+/* These are a fancy way to spell
+ if (~flags & EVLIST_INTERNAL)
+ base->event_count--/++;
+*/
+#define DECR_EVENT_COUNT(base,flags) \
+ ((base)->event_count -= !((flags) & EVLIST_INTERNAL))
+#define INCR_EVENT_COUNT(base,flags) do { \
+ ((base)->event_count += !((flags) & EVLIST_INTERNAL)); \
+ MAX_EVENT_COUNT((base)->event_count_max, (base)->event_count); \
+} while (0)
+
static void
-event_queue_remove_timeout(struct event_base *base, struct event *ev)
+event_queue_remove_inserted(struct event_base *base, struct event *ev)
{
EVENT_BASE_ASSERT_LOCKED(base);
- if (EVUTIL_FAILURE_CHECK(!(ev->ev_flags & EVLIST_TIMEOUT))) {
+ if (EVUTIL_FAILURE_CHECK(!(ev->ev_flags & EVLIST_INSERTED))) {
+ event_errx(1, "%s: %p(fd "EV_SOCK_FMT") not on queue %x", __func__,
+ ev, EV_SOCK_ARG(ev->ev_fd), EVLIST_INSERTED);
+ return;
+ }
+ DECR_EVENT_COUNT(base, ev->ev_flags);
+ ev->ev_flags &= ~EVLIST_INSERTED;
+}
+static void
+event_queue_remove_active(struct event_base *base, struct event_callback *evcb)
+{
+ EVENT_BASE_ASSERT_LOCKED(base);
+ if (EVUTIL_FAILURE_CHECK(!(evcb->evcb_flags & EVLIST_ACTIVE))) {
+ event_errx(1, "%s: %p not on queue %x", __func__,
+ evcb, EVLIST_ACTIVE);
+ return;
+ }
+ DECR_EVENT_COUNT(base, evcb->evcb_flags);
+ evcb->evcb_flags &= ~EVLIST_ACTIVE;
+ base->event_count_active--;
+
+ TAILQ_REMOVE(&base->activequeues[evcb->evcb_pri],
+ evcb, evcb_active_next);
+}
+static void
+event_queue_remove_active_later(struct event_base *base, struct event_callback *evcb)
+{
+ EVENT_BASE_ASSERT_LOCKED(base);
+ if (EVUTIL_FAILURE_CHECK(!(evcb->evcb_flags & EVLIST_ACTIVE_LATER))) {
+ event_errx(1, "%s: %p not on queue %x", __func__,
+ evcb, EVLIST_ACTIVE_LATER);
+ return;
+ }
+ DECR_EVENT_COUNT(base, evcb->evcb_flags);
+ evcb->evcb_flags &= ~EVLIST_ACTIVE_LATER;
+ base->event_count_active--;
+
+ TAILQ_REMOVE(&base->active_later_queue, evcb, evcb_active_next);
+}
+static void
+event_queue_remove_timeout(struct event_base *base, struct event *ev)
+{
+ EVENT_BASE_ASSERT_LOCKED(base);
+ if (EVUTIL_FAILURE_CHECK(!(ev->ev_flags & EVLIST_TIMEOUT))) {
event_errx(1, "%s: %p(fd "EV_SOCK_FMT") not on queue %x", __func__,
- ev, EV_SOCK_ARG(ev->ev_fd), EVLIST_TIMEOUT);
- return;
- }
- DECR_EVENT_COUNT(base, ev->ev_flags);
- ev->ev_flags &= ~EVLIST_TIMEOUT;
-
- if (is_common_timeout(&ev->ev_timeout, base)) {
- struct common_timeout_list *ctl =
- get_common_timeout_list(base, &ev->ev_timeout);
- TAILQ_REMOVE(&ctl->events, ev,
- ev_timeout_pos.ev_next_with_common_timeout);
- } else {
- min_heap_erase_(&base->timeheap, ev);
- }
-}
-
-#ifdef USE_REINSERT_TIMEOUT
-/* Remove and reinsert 'ev' into the timeout queue. */
-static void
-event_queue_reinsert_timeout(struct event_base *base, struct event *ev,
- int was_common, int is_common, int old_timeout_idx)
-{
- struct common_timeout_list *ctl;
- if (!(ev->ev_flags & EVLIST_TIMEOUT)) {
- event_queue_insert_timeout(base, ev);
+ ev, EV_SOCK_ARG(ev->ev_fd), EVLIST_TIMEOUT);
return;
}
-
- switch ((was_common<<1) | is_common) {
- case 3: /* Changing from one common timeout to another */
- ctl = base->common_timeout_queues[old_timeout_idx];
- TAILQ_REMOVE(&ctl->events, ev,
- ev_timeout_pos.ev_next_with_common_timeout);
- ctl = get_common_timeout_list(base, &ev->ev_timeout);
- insert_common_timeout_inorder(ctl, ev);
- break;
- case 2: /* Was common; is no longer common */
- ctl = base->common_timeout_queues[old_timeout_idx];
- TAILQ_REMOVE(&ctl->events, ev,
- ev_timeout_pos.ev_next_with_common_timeout);
- min_heap_push_(&base->timeheap, ev);
+ DECR_EVENT_COUNT(base, ev->ev_flags);
+ ev->ev_flags &= ~EVLIST_TIMEOUT;
+
+ if (is_common_timeout(&ev->ev_timeout, base)) {
+ struct common_timeout_list *ctl =
+ get_common_timeout_list(base, &ev->ev_timeout);
+ TAILQ_REMOVE(&ctl->events, ev,
+ ev_timeout_pos.ev_next_with_common_timeout);
+ } else {
+ min_heap_erase_(&base->timeheap, ev);
+ }
+}
+
+#ifdef USE_REINSERT_TIMEOUT
+/* Remove and reinsert 'ev' into the timeout queue. */
+static void
+event_queue_reinsert_timeout(struct event_base *base, struct event *ev,
+ int was_common, int is_common, int old_timeout_idx)
+{
+ struct common_timeout_list *ctl;
+ if (!(ev->ev_flags & EVLIST_TIMEOUT)) {
+ event_queue_insert_timeout(base, ev);
+ return;
+ }
+
+ switch ((was_common<<1) | is_common) {
+ case 3: /* Changing from one common timeout to another */
+ ctl = base->common_timeout_queues[old_timeout_idx];
+ TAILQ_REMOVE(&ctl->events, ev,
+ ev_timeout_pos.ev_next_with_common_timeout);
+ ctl = get_common_timeout_list(base, &ev->ev_timeout);
+ insert_common_timeout_inorder(ctl, ev);
break;
- case 1: /* Wasn't common; has become common. */
- min_heap_erase_(&base->timeheap, ev);
- ctl = get_common_timeout_list(base, &ev->ev_timeout);
- insert_common_timeout_inorder(ctl, ev);
+ case 2: /* Was common; is no longer common */
+ ctl = base->common_timeout_queues[old_timeout_idx];
+ TAILQ_REMOVE(&ctl->events, ev,
+ ev_timeout_pos.ev_next_with_common_timeout);
+ min_heap_push_(&base->timeheap, ev);
break;
- case 0: /* was in heap; is still on heap. */
- min_heap_adjust_(&base->timeheap, ev);
+ case 1: /* Wasn't common; has become common. */
+ min_heap_erase_(&base->timeheap, ev);
+ ctl = get_common_timeout_list(base, &ev->ev_timeout);
+ insert_common_timeout_inorder(ctl, ev);
break;
+ case 0: /* was in heap; is still on heap. */
+ min_heap_adjust_(&base->timeheap, ev);
+ break;
default:
- EVUTIL_ASSERT(0); /* unreachable */
- break;
+ EVUTIL_ASSERT(0); /* unreachable */
+ break;
}
}
-#endif
+#endif
/* Add 'ev' to the common timeout list in 'ev'. */
static void
@@ -3358,110 +3358,110 @@ insert_common_timeout_inorder(struct common_timeout_list *ctl,
}
static void
-event_queue_insert_inserted(struct event_base *base, struct event *ev)
-{
- EVENT_BASE_ASSERT_LOCKED(base);
-
- if (EVUTIL_FAILURE_CHECK(ev->ev_flags & EVLIST_INSERTED)) {
- event_errx(1, "%s: %p(fd "EV_SOCK_FMT") already inserted", __func__,
- ev, EV_SOCK_ARG(ev->ev_fd));
- return;
- }
-
- INCR_EVENT_COUNT(base, ev->ev_flags);
-
- ev->ev_flags |= EVLIST_INSERTED;
-}
-
-static void
-event_queue_insert_active(struct event_base *base, struct event_callback *evcb)
+event_queue_insert_inserted(struct event_base *base, struct event *ev)
{
EVENT_BASE_ASSERT_LOCKED(base);
- if (evcb->evcb_flags & EVLIST_ACTIVE) {
+ if (EVUTIL_FAILURE_CHECK(ev->ev_flags & EVLIST_INSERTED)) {
+ event_errx(1, "%s: %p(fd "EV_SOCK_FMT") already inserted", __func__,
+ ev, EV_SOCK_ARG(ev->ev_fd));
+ return;
+ }
+
+ INCR_EVENT_COUNT(base, ev->ev_flags);
+
+ ev->ev_flags |= EVLIST_INSERTED;
+}
+
+static void
+event_queue_insert_active(struct event_base *base, struct event_callback *evcb)
+{
+ EVENT_BASE_ASSERT_LOCKED(base);
+
+ if (evcb->evcb_flags & EVLIST_ACTIVE) {
/* Double insertion is possible for active events */
+ return;
+ }
+
+ INCR_EVENT_COUNT(base, evcb->evcb_flags);
+
+ evcb->evcb_flags |= EVLIST_ACTIVE;
+
+ base->event_count_active++;
+ MAX_EVENT_COUNT(base->event_count_active_max, base->event_count_active);
+ EVUTIL_ASSERT(evcb->evcb_pri < base->nactivequeues);
+ TAILQ_INSERT_TAIL(&base->activequeues[evcb->evcb_pri],
+ evcb, evcb_active_next);
+}
+
+static void
+event_queue_insert_active_later(struct event_base *base, struct event_callback *evcb)
+{
+ EVENT_BASE_ASSERT_LOCKED(base);
+ if (evcb->evcb_flags & (EVLIST_ACTIVE_LATER|EVLIST_ACTIVE)) {
+ /* Double insertion is possible */
return;
}
- INCR_EVENT_COUNT(base, evcb->evcb_flags);
-
- evcb->evcb_flags |= EVLIST_ACTIVE;
-
- base->event_count_active++;
- MAX_EVENT_COUNT(base->event_count_active_max, base->event_count_active);
- EVUTIL_ASSERT(evcb->evcb_pri < base->nactivequeues);
- TAILQ_INSERT_TAIL(&base->activequeues[evcb->evcb_pri],
- evcb, evcb_active_next);
-}
-
-static void
-event_queue_insert_active_later(struct event_base *base, struct event_callback *evcb)
-{
- EVENT_BASE_ASSERT_LOCKED(base);
- if (evcb->evcb_flags & (EVLIST_ACTIVE_LATER|EVLIST_ACTIVE)) {
- /* Double insertion is possible */
- return;
- }
-
- INCR_EVENT_COUNT(base, evcb->evcb_flags);
- evcb->evcb_flags |= EVLIST_ACTIVE_LATER;
- base->event_count_active++;
- MAX_EVENT_COUNT(base->event_count_active_max, base->event_count_active);
- EVUTIL_ASSERT(evcb->evcb_pri < base->nactivequeues);
- TAILQ_INSERT_TAIL(&base->active_later_queue, evcb, evcb_active_next);
-}
-
-static void
-event_queue_insert_timeout(struct event_base *base, struct event *ev)
-{
- EVENT_BASE_ASSERT_LOCKED(base);
-
- if (EVUTIL_FAILURE_CHECK(ev->ev_flags & EVLIST_TIMEOUT)) {
- event_errx(1, "%s: %p(fd "EV_SOCK_FMT") already on timeout", __func__,
- ev, EV_SOCK_ARG(ev->ev_fd));
- return;
- }
-
- INCR_EVENT_COUNT(base, ev->ev_flags);
-
- ev->ev_flags |= EVLIST_TIMEOUT;
-
- if (is_common_timeout(&ev->ev_timeout, base)) {
- struct common_timeout_list *ctl =
- get_common_timeout_list(base, &ev->ev_timeout);
- insert_common_timeout_inorder(ctl, ev);
- } else {
- min_heap_push_(&base->timeheap, ev);
- }
-}
-
-static void
-event_queue_make_later_events_active(struct event_base *base)
-{
- struct event_callback *evcb;
- EVENT_BASE_ASSERT_LOCKED(base);
-
- while ((evcb = TAILQ_FIRST(&base->active_later_queue))) {
- TAILQ_REMOVE(&base->active_later_queue, evcb, evcb_active_next);
- evcb->evcb_flags = (evcb->evcb_flags & ~EVLIST_ACTIVE_LATER) | EVLIST_ACTIVE;
- EVUTIL_ASSERT(evcb->evcb_pri < base->nactivequeues);
- TAILQ_INSERT_TAIL(&base->activequeues[evcb->evcb_pri], evcb, evcb_active_next);
- base->n_deferreds_queued += (evcb->evcb_closure == EV_CLOSURE_CB_SELF);
- }
-}
-
+ INCR_EVENT_COUNT(base, evcb->evcb_flags);
+ evcb->evcb_flags |= EVLIST_ACTIVE_LATER;
+ base->event_count_active++;
+ MAX_EVENT_COUNT(base->event_count_active_max, base->event_count_active);
+ EVUTIL_ASSERT(evcb->evcb_pri < base->nactivequeues);
+ TAILQ_INSERT_TAIL(&base->active_later_queue, evcb, evcb_active_next);
+}
+
+static void
+event_queue_insert_timeout(struct event_base *base, struct event *ev)
+{
+ EVENT_BASE_ASSERT_LOCKED(base);
+
+ if (EVUTIL_FAILURE_CHECK(ev->ev_flags & EVLIST_TIMEOUT)) {
+ event_errx(1, "%s: %p(fd "EV_SOCK_FMT") already on timeout", __func__,
+ ev, EV_SOCK_ARG(ev->ev_fd));
+ return;
+ }
+
+ INCR_EVENT_COUNT(base, ev->ev_flags);
+
+ ev->ev_flags |= EVLIST_TIMEOUT;
+
+ if (is_common_timeout(&ev->ev_timeout, base)) {
+ struct common_timeout_list *ctl =
+ get_common_timeout_list(base, &ev->ev_timeout);
+ insert_common_timeout_inorder(ctl, ev);
+ } else {
+ min_heap_push_(&base->timeheap, ev);
+ }
+}
+
+static void
+event_queue_make_later_events_active(struct event_base *base)
+{
+ struct event_callback *evcb;
+ EVENT_BASE_ASSERT_LOCKED(base);
+
+ while ((evcb = TAILQ_FIRST(&base->active_later_queue))) {
+ TAILQ_REMOVE(&base->active_later_queue, evcb, evcb_active_next);
+ evcb->evcb_flags = (evcb->evcb_flags & ~EVLIST_ACTIVE_LATER) | EVLIST_ACTIVE;
+ EVUTIL_ASSERT(evcb->evcb_pri < base->nactivequeues);
+ TAILQ_INSERT_TAIL(&base->activequeues[evcb->evcb_pri], evcb, evcb_active_next);
+ base->n_deferreds_queued += (evcb->evcb_closure == EV_CLOSURE_CB_SELF);
+ }
+}
+
/* Functions for debugging */
const char *
event_get_version(void)
{
- return (EVENT__VERSION);
+ return (EVENT__VERSION);
}
ev_uint32_t
event_get_version_number(void)
{
- return (EVENT__NUMERIC_VERSION);
+ return (EVENT__NUMERIC_VERSION);
}
/*
@@ -3475,19 +3475,19 @@ event_get_method(void)
return (current_base->evsel->name);
}
-#ifndef EVENT__DISABLE_MM_REPLACEMENT
-static void *(*mm_malloc_fn_)(size_t sz) = NULL;
-static void *(*mm_realloc_fn_)(void *p, size_t sz) = NULL;
-static void (*mm_free_fn_)(void *p) = NULL;
+#ifndef EVENT__DISABLE_MM_REPLACEMENT
+static void *(*mm_malloc_fn_)(size_t sz) = NULL;
+static void *(*mm_realloc_fn_)(void *p, size_t sz) = NULL;
+static void (*mm_free_fn_)(void *p) = NULL;
void *
event_mm_malloc_(size_t sz)
{
- if (sz == 0)
- return NULL;
-
- if (mm_malloc_fn_)
- return mm_malloc_fn_(sz);
+ if (sz == 0)
+ return NULL;
+
+ if (mm_malloc_fn_)
+ return mm_malloc_fn_(sz);
else
return malloc(sz);
}
@@ -3495,65 +3495,65 @@ event_mm_malloc_(size_t sz)
void *
event_mm_calloc_(size_t count, size_t size)
{
- if (count == 0 || size == 0)
- return NULL;
-
- if (mm_malloc_fn_) {
+ if (count == 0 || size == 0)
+ return NULL;
+
+ if (mm_malloc_fn_) {
size_t sz = count * size;
- void *p = NULL;
- if (count > EV_SIZE_MAX / size)
- goto error;
- p = mm_malloc_fn_(sz);
+ void *p = NULL;
+ if (count > EV_SIZE_MAX / size)
+ goto error;
+ p = mm_malloc_fn_(sz);
if (p)
- return memset(p, 0, sz);
- } else {
- void *p = calloc(count, size);
-#ifdef _WIN32
- /* Windows calloc doesn't reliably set ENOMEM */
- if (p == NULL)
- goto error;
-#endif
+ return memset(p, 0, sz);
+ } else {
+ void *p = calloc(count, size);
+#ifdef _WIN32
+ /* Windows calloc doesn't reliably set ENOMEM */
+ if (p == NULL)
+ goto error;
+#endif
return p;
- }
-
-error:
- errno = ENOMEM;
- return NULL;
+ }
+
+error:
+ errno = ENOMEM;
+ return NULL;
}
char *
event_mm_strdup_(const char *str)
{
- if (!str) {
- errno = EINVAL;
- return NULL;
- }
-
- if (mm_malloc_fn_) {
+ if (!str) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ if (mm_malloc_fn_) {
size_t ln = strlen(str);
- void *p = NULL;
- if (ln == EV_SIZE_MAX)
- goto error;
- p = mm_malloc_fn_(ln+1);
+ void *p = NULL;
+ if (ln == EV_SIZE_MAX)
+ goto error;
+ p = mm_malloc_fn_(ln+1);
if (p)
- return memcpy(p, str, ln+1);
+ return memcpy(p, str, ln+1);
} else
-#ifdef _WIN32
+#ifdef _WIN32
return _strdup(str);
#else
return strdup(str);
#endif
-
-error:
- errno = ENOMEM;
- return NULL;
+
+error:
+ errno = ENOMEM;
+ return NULL;
}
void *
event_mm_realloc_(void *ptr, size_t sz)
{
- if (mm_realloc_fn_)
- return mm_realloc_fn_(ptr, sz);
+ if (mm_realloc_fn_)
+ return mm_realloc_fn_(ptr, sz);
else
return realloc(ptr, sz);
}
@@ -3561,8 +3561,8 @@ event_mm_realloc_(void *ptr, size_t sz)
void
event_mm_free_(void *ptr)
{
- if (mm_free_fn_)
- mm_free_fn_(ptr);
+ if (mm_free_fn_)
+ mm_free_fn_(ptr);
else
free(ptr);
}
@@ -3572,13 +3572,13 @@ event_set_mem_functions(void *(*malloc_fn)(size_t sz),
void *(*realloc_fn)(void *ptr, size_t sz),
void (*free_fn)(void *ptr))
{
- mm_malloc_fn_ = malloc_fn;
- mm_realloc_fn_ = realloc_fn;
- mm_free_fn_ = free_fn;
+ mm_malloc_fn_ = malloc_fn;
+ mm_realloc_fn_ = realloc_fn;
+ mm_free_fn_ = free_fn;
}
#endif
-#ifdef EVENT__HAVE_EVENTFD
+#ifdef EVENT__HAVE_EVENTFD
static void
evthread_notify_drain_eventfd(evutil_socket_t fd, short what, void *arg)
{
@@ -3601,7 +3601,7 @@ evthread_notify_drain_default(evutil_socket_t fd, short what, void *arg)
{
unsigned char buf[1024];
struct event_base *base = arg;
-#ifdef _WIN32
+#ifdef _WIN32
while (recv(fd, (char*)buf, sizeof(buf), 0) > 0)
;
#else
@@ -3617,50 +3617,50 @@ evthread_notify_drain_default(evutil_socket_t fd, short what, void *arg)
int
evthread_make_base_notifiable(struct event_base *base)
{
- int r;
+ int r;
if (!base)
return -1;
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- r = evthread_make_base_notifiable_nolock_(base);
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- return r;
-}
-
-static int
-evthread_make_base_notifiable_nolock_(struct event_base *base)
-{
- void (*cb)(evutil_socket_t, short, void *);
- int (*notify)(struct event_base *);
-
- if (base->th_notify_fn != NULL) {
- /* The base is already notifiable: we're doing fine. */
- return 0;
- }
-
-#if defined(EVENT__HAVE_WORKING_KQUEUE)
- if (base->evsel == &kqops && event_kq_add_notify_event_(base) == 0) {
- base->th_notify_fn = event_kq_notify_base_;
- /* No need to add an event here; the backend can wake
- * itself up just fine. */
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ r = evthread_make_base_notifiable_nolock_(base);
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ return r;
+}
+
+static int
+evthread_make_base_notifiable_nolock_(struct event_base *base)
+{
+ void (*cb)(evutil_socket_t, short, void *);
+ int (*notify)(struct event_base *);
+
+ if (base->th_notify_fn != NULL) {
+ /* The base is already notifiable: we're doing fine. */
return 0;
- }
+ }
+
+#if defined(EVENT__HAVE_WORKING_KQUEUE)
+ if (base->evsel == &kqops && event_kq_add_notify_event_(base) == 0) {
+ base->th_notify_fn = event_kq_notify_base_;
+ /* No need to add an event here; the backend can wake
+ * itself up just fine. */
+ return 0;
+ }
#endif
-
-#ifdef EVENT__HAVE_EVENTFD
- base->th_notify_fd[0] = evutil_eventfd_(0,
- EVUTIL_EFD_CLOEXEC|EVUTIL_EFD_NONBLOCK);
+
+#ifdef EVENT__HAVE_EVENTFD
+ base->th_notify_fd[0] = evutil_eventfd_(0,
+ EVUTIL_EFD_CLOEXEC|EVUTIL_EFD_NONBLOCK);
if (base->th_notify_fd[0] >= 0) {
- base->th_notify_fd[1] = -1;
+ base->th_notify_fd[1] = -1;
notify = evthread_notify_base_eventfd;
cb = evthread_notify_drain_eventfd;
- } else
+ } else
#endif
- if (evutil_make_internal_pipe_(base->th_notify_fd) == 0) {
- notify = evthread_notify_base_default;
- cb = evthread_notify_drain_default;
- } else {
- return -1;
+ if (evutil_make_internal_pipe_(base->th_notify_fd) == 0) {
+ notify = evthread_notify_base_default;
+ cb = evthread_notify_drain_default;
+ } else {
+ return -1;
}
base->th_notify_fn = notify;
@@ -3673,211 +3673,211 @@ evthread_make_base_notifiable_nolock_(struct event_base *base)
base->th_notify.ev_flags |= EVLIST_INTERNAL;
event_priority_set(&base->th_notify, 0);
- return event_add_nolock_(&base->th_notify, NULL, 0);
-}
-
-int
-event_base_foreach_event_nolock_(struct event_base *base,
- event_base_foreach_event_cb fn, void *arg)
-{
- int r, i;
- unsigned u;
- struct event *ev;
-
- /* Start out with all the EVLIST_INSERTED events. */
- if ((r = evmap_foreach_event_(base, fn, arg)))
- return r;
-
- /* Okay, now we deal with those events that have timeouts and are in
- * the min-heap. */
- for (u = 0; u < base->timeheap.n; ++u) {
- ev = base->timeheap.p[u];
- if (ev->ev_flags & EVLIST_INSERTED) {
- /* we already processed this one */
- continue;
- }
- if ((r = fn(base, ev, arg)))
- return r;
- }
-
- /* Now for the events in one of the timeout queues.
- * the min-heap. */
- for (i = 0; i < base->n_common_timeouts; ++i) {
- struct common_timeout_list *ctl =
- base->common_timeout_queues[i];
- TAILQ_FOREACH(ev, &ctl->events,
- ev_timeout_pos.ev_next_with_common_timeout) {
- if (ev->ev_flags & EVLIST_INSERTED) {
- /* we already processed this one */
- continue;
- }
- if ((r = fn(base, ev, arg)))
- return r;
- }
- }
-
- /* Finally, we deal wit all the active events that we haven't touched
- * yet. */
- for (i = 0; i < base->nactivequeues; ++i) {
- struct event_callback *evcb;
- TAILQ_FOREACH(evcb, &base->activequeues[i], evcb_active_next) {
- if ((evcb->evcb_flags & (EVLIST_INIT|EVLIST_INSERTED|EVLIST_TIMEOUT)) != EVLIST_INIT) {
- /* This isn't an event (evlist_init clear), or
- * we already processed it. (inserted or
- * timeout set */
- continue;
- }
- ev = event_callback_to_event(evcb);
- if ((r = fn(base, ev, arg)))
- return r;
- }
- }
-
- return 0;
-}
-
-/* Helper for event_base_dump_events: called on each event in the event base;
- * dumps only the inserted events. */
-static int
-dump_inserted_event_fn(const struct event_base *base, const struct event *e, void *arg)
-{
- FILE *output = arg;
- const char *gloss = (e->ev_events & EV_SIGNAL) ?
- "sig" : "fd ";
-
- if (! (e->ev_flags & (EVLIST_INSERTED|EVLIST_TIMEOUT)))
- return 0;
-
- fprintf(output, " %p [%s "EV_SOCK_FMT"]%s%s%s%s%s%s%s",
- (void*)e, gloss, EV_SOCK_ARG(e->ev_fd),
- (e->ev_events&EV_READ)?" Read":"",
- (e->ev_events&EV_WRITE)?" Write":"",
- (e->ev_events&EV_CLOSED)?" EOF":"",
- (e->ev_events&EV_SIGNAL)?" Signal":"",
- (e->ev_events&EV_PERSIST)?" Persist":"",
- (e->ev_events&EV_ET)?" ET":"",
- (e->ev_flags&EVLIST_INTERNAL)?" Internal":"");
- if (e->ev_flags & EVLIST_TIMEOUT) {
- struct timeval tv;
- tv.tv_sec = e->ev_timeout.tv_sec;
- tv.tv_usec = e->ev_timeout.tv_usec & MICROSECONDS_MASK;
- evutil_timeradd(&tv, &base->tv_clock_diff, &tv);
- fprintf(output, " Timeout=%ld.%06d",
- (long)tv.tv_sec, (int)(tv.tv_usec & MICROSECONDS_MASK));
- }
- fputc('\n', output);
-
- return 0;
-}
-
-/* Helper for event_base_dump_events: called on each event in the event base;
- * dumps only the active events. */
-static int
-dump_active_event_fn(const struct event_base *base, const struct event *e, void *arg)
-{
- FILE *output = arg;
- const char *gloss = (e->ev_events & EV_SIGNAL) ?
- "sig" : "fd ";
-
- if (! (e->ev_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER)))
- return 0;
-
- fprintf(output, " %p [%s "EV_SOCK_FMT", priority=%d]%s%s%s%s%s active%s%s\n",
- (void*)e, gloss, EV_SOCK_ARG(e->ev_fd), e->ev_pri,
- (e->ev_res&EV_READ)?" Read":"",
- (e->ev_res&EV_WRITE)?" Write":"",
- (e->ev_res&EV_CLOSED)?" EOF":"",
- (e->ev_res&EV_SIGNAL)?" Signal":"",
- (e->ev_res&EV_TIMEOUT)?" Timeout":"",
- (e->ev_flags&EVLIST_INTERNAL)?" [Internal]":"",
- (e->ev_flags&EVLIST_ACTIVE_LATER)?" [NextTime]":"");
-
- return 0;
-}
-
-int
-event_base_foreach_event(struct event_base *base,
- event_base_foreach_event_cb fn, void *arg)
-{
- int r;
- if ((!fn) || (!base)) {
- return -1;
- }
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- r = event_base_foreach_event_nolock_(base, fn, arg);
- EVBASE_RELEASE_LOCK(base, th_base_lock);
- return r;
-}
-
-
+ return event_add_nolock_(&base->th_notify, NULL, 0);
+}
+
+int
+event_base_foreach_event_nolock_(struct event_base *base,
+ event_base_foreach_event_cb fn, void *arg)
+{
+ int r, i;
+ unsigned u;
+ struct event *ev;
+
+ /* Start out with all the EVLIST_INSERTED events. */
+ if ((r = evmap_foreach_event_(base, fn, arg)))
+ return r;
+
+ /* Okay, now we deal with those events that have timeouts and are in
+ * the min-heap. */
+ for (u = 0; u < base->timeheap.n; ++u) {
+ ev = base->timeheap.p[u];
+ if (ev->ev_flags & EVLIST_INSERTED) {
+ /* we already processed this one */
+ continue;
+ }
+ if ((r = fn(base, ev, arg)))
+ return r;
+ }
+
+ /* Now for the events in one of the timeout queues.
+ * the min-heap. */
+ for (i = 0; i < base->n_common_timeouts; ++i) {
+ struct common_timeout_list *ctl =
+ base->common_timeout_queues[i];
+ TAILQ_FOREACH(ev, &ctl->events,
+ ev_timeout_pos.ev_next_with_common_timeout) {
+ if (ev->ev_flags & EVLIST_INSERTED) {
+ /* we already processed this one */
+ continue;
+ }
+ if ((r = fn(base, ev, arg)))
+ return r;
+ }
+ }
+
+ /* Finally, we deal wit all the active events that we haven't touched
+ * yet. */
+ for (i = 0; i < base->nactivequeues; ++i) {
+ struct event_callback *evcb;
+ TAILQ_FOREACH(evcb, &base->activequeues[i], evcb_active_next) {
+ if ((evcb->evcb_flags & (EVLIST_INIT|EVLIST_INSERTED|EVLIST_TIMEOUT)) != EVLIST_INIT) {
+ /* This isn't an event (evlist_init clear), or
+ * we already processed it. (inserted or
+ * timeout set */
+ continue;
+ }
+ ev = event_callback_to_event(evcb);
+ if ((r = fn(base, ev, arg)))
+ return r;
+ }
+ }
+
+ return 0;
+}
+
+/* Helper for event_base_dump_events: called on each event in the event base;
+ * dumps only the inserted events. */
+static int
+dump_inserted_event_fn(const struct event_base *base, const struct event *e, void *arg)
+{
+ FILE *output = arg;
+ const char *gloss = (e->ev_events & EV_SIGNAL) ?
+ "sig" : "fd ";
+
+ if (! (e->ev_flags & (EVLIST_INSERTED|EVLIST_TIMEOUT)))
+ return 0;
+
+ fprintf(output, " %p [%s "EV_SOCK_FMT"]%s%s%s%s%s%s%s",
+ (void*)e, gloss, EV_SOCK_ARG(e->ev_fd),
+ (e->ev_events&EV_READ)?" Read":"",
+ (e->ev_events&EV_WRITE)?" Write":"",
+ (e->ev_events&EV_CLOSED)?" EOF":"",
+ (e->ev_events&EV_SIGNAL)?" Signal":"",
+ (e->ev_events&EV_PERSIST)?" Persist":"",
+ (e->ev_events&EV_ET)?" ET":"",
+ (e->ev_flags&EVLIST_INTERNAL)?" Internal":"");
+ if (e->ev_flags & EVLIST_TIMEOUT) {
+ struct timeval tv;
+ tv.tv_sec = e->ev_timeout.tv_sec;
+ tv.tv_usec = e->ev_timeout.tv_usec & MICROSECONDS_MASK;
+ evutil_timeradd(&tv, &base->tv_clock_diff, &tv);
+ fprintf(output, " Timeout=%ld.%06d",
+ (long)tv.tv_sec, (int)(tv.tv_usec & MICROSECONDS_MASK));
+ }
+ fputc('\n', output);
+
+ return 0;
+}
+
+/* Helper for event_base_dump_events: called on each event in the event base;
+ * dumps only the active events. */
+static int
+dump_active_event_fn(const struct event_base *base, const struct event *e, void *arg)
+{
+ FILE *output = arg;
+ const char *gloss = (e->ev_events & EV_SIGNAL) ?
+ "sig" : "fd ";
+
+ if (! (e->ev_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER)))
+ return 0;
+
+ fprintf(output, " %p [%s "EV_SOCK_FMT", priority=%d]%s%s%s%s%s active%s%s\n",
+ (void*)e, gloss, EV_SOCK_ARG(e->ev_fd), e->ev_pri,
+ (e->ev_res&EV_READ)?" Read":"",
+ (e->ev_res&EV_WRITE)?" Write":"",
+ (e->ev_res&EV_CLOSED)?" EOF":"",
+ (e->ev_res&EV_SIGNAL)?" Signal":"",
+ (e->ev_res&EV_TIMEOUT)?" Timeout":"",
+ (e->ev_flags&EVLIST_INTERNAL)?" [Internal]":"",
+ (e->ev_flags&EVLIST_ACTIVE_LATER)?" [NextTime]":"");
+
+ return 0;
+}
+
+int
+event_base_foreach_event(struct event_base *base,
+ event_base_foreach_event_cb fn, void *arg)
+{
+ int r;
+ if ((!fn) || (!base)) {
+ return -1;
+ }
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ r = event_base_foreach_event_nolock_(base, fn, arg);
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ return r;
+}
+
+
void
event_base_dump_events(struct event_base *base, FILE *output)
{
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
fprintf(output, "Inserted events:\n");
- event_base_foreach_event_nolock_(base, dump_inserted_event_fn, output);
-
- fprintf(output, "Active events:\n");
- event_base_foreach_event_nolock_(base, dump_active_event_fn, output);
- EVBASE_RELEASE_LOCK(base, th_base_lock);
-}
-
-void
-event_base_active_by_fd(struct event_base *base, evutil_socket_t fd, short events)
-{
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
-
- /* Activate any non timer events */
- if (!(events & EV_TIMEOUT)) {
- evmap_io_active_(base, fd, events & (EV_READ|EV_WRITE|EV_CLOSED));
- } else {
- /* If we want to activate timer events, loop and activate each event with
- * the same fd in both the timeheap and common timeouts list */
- int i;
- unsigned u;
- struct event *ev;
-
- for (u = 0; u < base->timeheap.n; ++u) {
- ev = base->timeheap.p[u];
- if (ev->ev_fd == fd) {
- event_active_nolock_(ev, EV_TIMEOUT, 1);
- }
- }
-
- for (i = 0; i < base->n_common_timeouts; ++i) {
- struct common_timeout_list *ctl = base->common_timeout_queues[i];
- TAILQ_FOREACH(ev, &ctl->events,
- ev_timeout_pos.ev_next_with_common_timeout) {
- if (ev->ev_fd == fd) {
- event_active_nolock_(ev, EV_TIMEOUT, 1);
- }
- }
+ event_base_foreach_event_nolock_(base, dump_inserted_event_fn, output);
+
+ fprintf(output, "Active events:\n");
+ event_base_foreach_event_nolock_(base, dump_active_event_fn, output);
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+}
+
+void
+event_base_active_by_fd(struct event_base *base, evutil_socket_t fd, short events)
+{
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+
+ /* Activate any non timer events */
+ if (!(events & EV_TIMEOUT)) {
+ evmap_io_active_(base, fd, events & (EV_READ|EV_WRITE|EV_CLOSED));
+ } else {
+ /* If we want to activate timer events, loop and activate each event with
+ * the same fd in both the timeheap and common timeouts list */
+ int i;
+ unsigned u;
+ struct event *ev;
+
+ for (u = 0; u < base->timeheap.n; ++u) {
+ ev = base->timeheap.p[u];
+ if (ev->ev_fd == fd) {
+ event_active_nolock_(ev, EV_TIMEOUT, 1);
+ }
}
+
+ for (i = 0; i < base->n_common_timeouts; ++i) {
+ struct common_timeout_list *ctl = base->common_timeout_queues[i];
+ TAILQ_FOREACH(ev, &ctl->events,
+ ev_timeout_pos.ev_next_with_common_timeout) {
+ if (ev->ev_fd == fd) {
+ event_active_nolock_(ev, EV_TIMEOUT, 1);
+ }
+ }
+ }
}
-
- EVBASE_RELEASE_LOCK(base, th_base_lock);
+
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
}
void
-event_base_active_by_signal(struct event_base *base, int sig)
-{
- EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- evmap_signal_active_(base, sig, 1);
- EVBASE_RELEASE_LOCK(base, th_base_lock);
-}
-
-
-void
-event_base_add_virtual_(struct event_base *base)
+event_base_active_by_signal(struct event_base *base, int sig)
{
EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ evmap_signal_active_(base, sig, 1);
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+}
+
+
+void
+event_base_add_virtual_(struct event_base *base)
+{
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
base->virtual_event_count++;
- MAX_EVENT_COUNT(base->virtual_event_count_max, base->virtual_event_count);
+ MAX_EVENT_COUNT(base->virtual_event_count_max, base->virtual_event_count);
EVBASE_RELEASE_LOCK(base, th_base_lock);
}
void
-event_base_del_virtual_(struct event_base *base)
+event_base_del_virtual_(struct event_base *base)
{
EVBASE_ACQUIRE_LOCK(base, th_base_lock);
EVUTIL_ASSERT(base->virtual_event_count > 0);
@@ -3887,65 +3887,65 @@ event_base_del_virtual_(struct event_base *base)
EVBASE_RELEASE_LOCK(base, th_base_lock);
}
-static void
-event_free_debug_globals_locks(void)
-{
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
-#ifndef EVENT__DISABLE_DEBUG_MODE
- if (event_debug_map_lock_ != NULL) {
- EVTHREAD_FREE_LOCK(event_debug_map_lock_, 0);
- event_debug_map_lock_ = NULL;
- evthreadimpl_disable_lock_debugging_();
- }
-#endif /* EVENT__DISABLE_DEBUG_MODE */
-#endif /* EVENT__DISABLE_THREAD_SUPPORT */
- return;
-}
-
-static void
-event_free_debug_globals(void)
-{
- event_free_debug_globals_locks();
-}
-
-static void
-event_free_evsig_globals(void)
-{
- evsig_free_globals_();
-}
-
-static void
-event_free_evutil_globals(void)
-{
- evutil_free_globals_();
-}
-
-static void
-event_free_globals(void)
-{
- event_free_debug_globals();
- event_free_evsig_globals();
- event_free_evutil_globals();
-}
-
-void
-libevent_global_shutdown(void)
-{
- event_disable_debug_mode();
- event_free_globals();
-}
-
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+static void
+event_free_debug_globals_locks(void)
+{
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#ifndef EVENT__DISABLE_DEBUG_MODE
+ if (event_debug_map_lock_ != NULL) {
+ EVTHREAD_FREE_LOCK(event_debug_map_lock_, 0);
+ event_debug_map_lock_ = NULL;
+ evthreadimpl_disable_lock_debugging_();
+ }
+#endif /* EVENT__DISABLE_DEBUG_MODE */
+#endif /* EVENT__DISABLE_THREAD_SUPPORT */
+ return;
+}
+
+static void
+event_free_debug_globals(void)
+{
+ event_free_debug_globals_locks();
+}
+
+static void
+event_free_evsig_globals(void)
+{
+ evsig_free_globals_();
+}
+
+static void
+event_free_evutil_globals(void)
+{
+ evutil_free_globals_();
+}
+
+static void
+event_free_globals(void)
+{
+ event_free_debug_globals();
+ event_free_evsig_globals();
+ event_free_evutil_globals();
+}
+
+void
+libevent_global_shutdown(void)
+{
+ event_disable_debug_mode();
+ event_free_globals();
+}
+
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
int
event_global_setup_locks_(const int enable_locks)
{
-#ifndef EVENT__DISABLE_DEBUG_MODE
- EVTHREAD_SETUP_GLOBAL_LOCK(event_debug_map_lock_, 0);
+#ifndef EVENT__DISABLE_DEBUG_MODE
+ EVTHREAD_SETUP_GLOBAL_LOCK(event_debug_map_lock_, 0);
#endif
if (evsig_global_setup_locks_(enable_locks) < 0)
return -1;
- if (evutil_global_setup_locks_(enable_locks) < 0)
- return -1;
+ if (evutil_global_setup_locks_(enable_locks) < 0)
+ return -1;
if (evutil_secure_rng_global_setup_locks_(enable_locks) < 0)
return -1;
return 0;
@@ -3953,29 +3953,29 @@ event_global_setup_locks_(const int enable_locks)
#endif
void
-event_base_assert_ok_(struct event_base *base)
+event_base_assert_ok_(struct event_base *base)
{
EVBASE_ACQUIRE_LOCK(base, th_base_lock);
- event_base_assert_ok_nolock_(base);
- EVBASE_RELEASE_LOCK(base, th_base_lock);
-}
-
-void
-event_base_assert_ok_nolock_(struct event_base *base)
-{
- int i;
- int count;
-
- /* First do checks on the per-fd and per-signal lists */
- evmap_check_integrity_(base);
-
+ event_base_assert_ok_nolock_(base);
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+}
+
+void
+event_base_assert_ok_nolock_(struct event_base *base)
+{
+ int i;
+ int count;
+
+ /* First do checks on the per-fd and per-signal lists */
+ evmap_check_integrity_(base);
+
/* Check the heap property */
for (i = 1; i < (int)base->timeheap.n; ++i) {
int parent = (i - 1) / 2;
struct event *ev, *p_ev;
ev = base->timeheap.p[i];
p_ev = base->timeheap.p[parent];
- EVUTIL_ASSERT(ev->ev_flags & EVLIST_TIMEOUT);
+ EVUTIL_ASSERT(ev->ev_flags & EVLIST_TIMEOUT);
EVUTIL_ASSERT(evutil_timercmp(&p_ev->ev_timeout, &ev->ev_timeout, <=));
EVUTIL_ASSERT(ev->ev_timeout_pos.min_heap_idx == i);
}
@@ -3984,37 +3984,37 @@ event_base_assert_ok_nolock_(struct event_base *base)
for (i = 0; i < base->n_common_timeouts; ++i) {
struct common_timeout_list *ctl = base->common_timeout_queues[i];
struct event *last=NULL, *ev;
-
- EVUTIL_ASSERT_TAILQ_OK(&ctl->events, event, ev_timeout_pos.ev_next_with_common_timeout);
-
+
+ EVUTIL_ASSERT_TAILQ_OK(&ctl->events, event, ev_timeout_pos.ev_next_with_common_timeout);
+
TAILQ_FOREACH(ev, &ctl->events, ev_timeout_pos.ev_next_with_common_timeout) {
if (last)
EVUTIL_ASSERT(evutil_timercmp(&last->ev_timeout, &ev->ev_timeout, <=));
- EVUTIL_ASSERT(ev->ev_flags & EVLIST_TIMEOUT);
+ EVUTIL_ASSERT(ev->ev_flags & EVLIST_TIMEOUT);
EVUTIL_ASSERT(is_common_timeout(&ev->ev_timeout,base));
EVUTIL_ASSERT(COMMON_TIMEOUT_IDX(&ev->ev_timeout) == i);
last = ev;
}
}
- /* Check the active queues. */
- count = 0;
- for (i = 0; i < base->nactivequeues; ++i) {
- struct event_callback *evcb;
- EVUTIL_ASSERT_TAILQ_OK(&base->activequeues[i], event_callback, evcb_active_next);
- TAILQ_FOREACH(evcb, &base->activequeues[i], evcb_active_next) {
- EVUTIL_ASSERT((evcb->evcb_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER)) == EVLIST_ACTIVE);
- EVUTIL_ASSERT(evcb->evcb_pri == i);
- ++count;
- }
- }
-
- {
- struct event_callback *evcb;
- TAILQ_FOREACH(evcb, &base->active_later_queue, evcb_active_next) {
- EVUTIL_ASSERT((evcb->evcb_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER)) == EVLIST_ACTIVE_LATER);
- ++count;
- }
- }
- EVUTIL_ASSERT(count == base->event_count_active);
+ /* Check the active queues. */
+ count = 0;
+ for (i = 0; i < base->nactivequeues; ++i) {
+ struct event_callback *evcb;
+ EVUTIL_ASSERT_TAILQ_OK(&base->activequeues[i], event_callback, evcb_active_next);
+ TAILQ_FOREACH(evcb, &base->activequeues[i], evcb_active_next) {
+ EVUTIL_ASSERT((evcb->evcb_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER)) == EVLIST_ACTIVE);
+ EVUTIL_ASSERT(evcb->evcb_pri == i);
+ ++count;
+ }
+ }
+
+ {
+ struct event_callback *evcb;
+ TAILQ_FOREACH(evcb, &base->active_later_queue, evcb_active_next) {
+ EVUTIL_ASSERT((evcb->evcb_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER)) == EVLIST_ACTIVE_LATER);
+ ++count;
+ }
+ }
+ EVUTIL_ASSERT(count == base->event_count_active);
}
diff --git a/contrib/libs/libevent/event_core/ya.make b/contrib/libs/libevent/event_core/ya.make
index 3988de817a..06d292321c 100644
--- a/contrib/libs/libevent/event_core/ya.make
+++ b/contrib/libs/libevent/event_core/ya.make
@@ -1,7 +1,7 @@
-# Generated by devtools/yamaker.
-
-LIBRARY()
-
+# Generated by devtools/yamaker.
+
+LIBRARY()
+
WITHOUT_LICENSE_TEXTS()
OWNER(
@@ -13,68 +13,68 @@ OWNER(
LICENSE(BSD-3-Clause)
-PEERDIR(
- contrib/libs/libc_compat
-)
-
-ADDINCL(
- contrib/libs/libevent
- contrib/libs/libevent/include
-)
-
-NO_COMPILER_WARNINGS()
-
-NO_RUNTIME()
-
-CFLAGS(
- -DHAVE_CONFIG_H
- -DEVENT__HAVE_STRLCPY=1
-)
-
-SRCDIR(contrib/libs/libevent)
-
-SRCS(
- buffer.c
- bufferevent.c
- bufferevent_filter.c
- bufferevent_pair.c
- bufferevent_ratelim.c
- bufferevent_sock.c
- event.c
- evmap.c
- evthread.c
- evutil.c
- evutil_rand.c
- evutil_time.c
- listener.c
- log.c
- signal.c
-)
-
-IF (OS_WINDOWS)
- SRCS(
- buffer_iocp.c
- bufferevent_async.c
- event_iocp.c
- win32select.c
- )
-ELSE()
- SRCS(
- poll.c
- select.c
- )
-ENDIF()
-
-IF (OS_LINUX)
- SRCS(
- epoll.c
- )
-ENDIF()
-
-IF (OS_FREEBSD OR OS_DARWIN)
- SRCS(
- kqueue.c
- )
-ENDIF()
-
-END()
+PEERDIR(
+ contrib/libs/libc_compat
+)
+
+ADDINCL(
+ contrib/libs/libevent
+ contrib/libs/libevent/include
+)
+
+NO_COMPILER_WARNINGS()
+
+NO_RUNTIME()
+
+CFLAGS(
+ -DHAVE_CONFIG_H
+ -DEVENT__HAVE_STRLCPY=1
+)
+
+SRCDIR(contrib/libs/libevent)
+
+SRCS(
+ buffer.c
+ bufferevent.c
+ bufferevent_filter.c
+ bufferevent_pair.c
+ bufferevent_ratelim.c
+ bufferevent_sock.c
+ event.c
+ evmap.c
+ evthread.c
+ evutil.c
+ evutil_rand.c
+ evutil_time.c
+ listener.c
+ log.c
+ signal.c
+)
+
+IF (OS_WINDOWS)
+ SRCS(
+ buffer_iocp.c
+ bufferevent_async.c
+ event_iocp.c
+ win32select.c
+ )
+ELSE()
+ SRCS(
+ poll.c
+ select.c
+ )
+ENDIF()
+
+IF (OS_LINUX)
+ SRCS(
+ epoll.c
+ )
+ENDIF()
+
+IF (OS_FREEBSD OR OS_DARWIN)
+ SRCS(
+ kqueue.c
+ )
+ENDIF()
+
+END()
diff --git a/contrib/libs/libevent/event_extra/ya.make b/contrib/libs/libevent/event_extra/ya.make
index 9f4c289e62..0970f6e372 100644
--- a/contrib/libs/libevent/event_extra/ya.make
+++ b/contrib/libs/libevent/event_extra/ya.make
@@ -1,7 +1,7 @@
-# Generated by devtools/yamaker.
-
-LIBRARY()
-
+# Generated by devtools/yamaker.
+
+LIBRARY()
+
WITHOUT_LICENSE_TEXTS()
OWNER(
@@ -13,31 +13,31 @@ OWNER(
LICENSE(BSD-3-Clause)
-PEERDIR(
- contrib/libs/libc_compat
-)
-
-ADDINCL(
- contrib/libs/libevent
- contrib/libs/libevent/include
-)
-
-NO_COMPILER_WARNINGS()
-
-NO_RUNTIME()
-
-CFLAGS(
- -DHAVE_CONFIG_H
- -DEVENT__HAVE_STRLCPY=1
-)
-
-SRCDIR(contrib/libs/libevent)
-
-SRCS(
- evdns.c
- event_tagging.c
- evrpc.c
- http.c
-)
-
-END()
+PEERDIR(
+ contrib/libs/libc_compat
+)
+
+ADDINCL(
+ contrib/libs/libevent
+ contrib/libs/libevent/include
+)
+
+NO_COMPILER_WARNINGS()
+
+NO_RUNTIME()
+
+CFLAGS(
+ -DHAVE_CONFIG_H
+ -DEVENT__HAVE_STRLCPY=1
+)
+
+SRCDIR(contrib/libs/libevent)
+
+SRCS(
+ evdns.c
+ event_tagging.c
+ evrpc.c
+ http.c
+)
+
+END()
diff --git a/contrib/libs/libevent/event_iocp.c b/contrib/libs/libevent/event_iocp.c
index 6b2a2e15ef..9acaf650cc 100644
--- a/contrib/libs/libevent/event_iocp.c
+++ b/contrib/libs/libevent/event_iocp.c
@@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "evconfig-private.h"
+#include "evconfig-private.h"
#ifndef _WIN32_WINNT
/* Minimum required for InitializeCriticalSectionAndSpinCount */
@@ -46,7 +46,7 @@
#define NOTIFICATION_KEY ((ULONG_PTR)-1)
void
-event_overlapped_init_(struct event_overlapped *o, iocp_callback cb)
+event_overlapped_init_(struct event_overlapped *o, iocp_callback cb)
{
memset(o, 0, sizeof(struct event_overlapped));
o->cb = cb;
@@ -61,9 +61,9 @@ handle_entry(OVERLAPPED *o, ULONG_PTR completion_key, DWORD nBytes, int ok)
}
static void
-loop(void *port_)
+loop(void *port_)
{
- struct event_iocp_port *port = port_;
+ struct event_iocp_port *port = port_;
long ms = port->ms;
HANDLE p = port->port;
@@ -99,7 +99,7 @@ loop(void *port_)
}
int
-event_iocp_port_associate_(struct event_iocp_port *port, evutil_socket_t fd,
+event_iocp_port_associate_(struct event_iocp_port *port, evutil_socket_t fd,
ev_uintptr_t key)
{
HANDLE h;
@@ -151,7 +151,7 @@ init_extension_functions(struct win32_extension_fns *ext)
const GUID connectex = WSAID_CONNECTEX;
const GUID getacceptexsockaddrs = WSAID_GETACCEPTEXSOCKADDRS;
SOCKET s = socket(AF_INET, SOCK_STREAM, 0);
- if (s == EVUTIL_INVALID_SOCKET)
+ if (s == EVUTIL_INVALID_SOCKET)
return;
ext->AcceptEx = get_extension_function(s, &acceptex);
ext->ConnectEx = get_extension_function(s, &connectex);
@@ -165,7 +165,7 @@ init_extension_functions(struct win32_extension_fns *ext)
static struct win32_extension_fns the_extension_fns;
const struct win32_extension_fns *
-event_get_win32_extension_fns_(void)
+event_get_win32_extension_fns_(void)
{
return &the_extension_fns;
}
@@ -173,7 +173,7 @@ event_get_win32_extension_fns_(void)
#define N_CPUS_DEFAULT 2
struct event_iocp_port *
-event_iocp_port_launch_(int n_cpus)
+event_iocp_port_launch_(int n_cpus)
{
struct event_iocp_port *port;
int i;
@@ -224,7 +224,7 @@ err:
}
static void
-event_iocp_port_unlock_and_free_(struct event_iocp_port *port)
+event_iocp_port_unlock_and_free_(struct event_iocp_port *port)
{
DeleteCriticalSection(&port->lock);
CloseHandle(port->port);
@@ -247,7 +247,7 @@ event_iocp_notify_all(struct event_iocp_port *port)
}
int
-event_iocp_shutdown_(struct event_iocp_port *port, long waitMsec)
+event_iocp_shutdown_(struct event_iocp_port *port, long waitMsec)
{
DWORD ms = INFINITE;
int n;
@@ -265,7 +265,7 @@ event_iocp_shutdown_(struct event_iocp_port *port, long waitMsec)
n = port->n_live_threads;
LeaveCriticalSection(&port->lock);
if (n == 0) {
- event_iocp_port_unlock_and_free_(port);
+ event_iocp_port_unlock_and_free_(port);
return 0;
} else {
return -1;
@@ -273,7 +273,7 @@ event_iocp_shutdown_(struct event_iocp_port *port, long waitMsec)
}
int
-event_iocp_activate_overlapped_(
+event_iocp_activate_overlapped_(
struct event_iocp_port *port, struct event_overlapped *o,
ev_uintptr_t key, ev_uint32_t n)
{
@@ -284,9 +284,9 @@ event_iocp_activate_overlapped_(
}
struct event_iocp_port *
-event_base_get_iocp_(struct event_base *base)
+event_base_get_iocp_(struct event_base *base)
{
-#ifdef _WIN32
+#ifdef _WIN32
return base->iocp;
#else
return NULL;
diff --git a/contrib/libs/libevent/event_openssl/ya.make b/contrib/libs/libevent/event_openssl/ya.make
index fe042893c0..bc5079a9d7 100644
--- a/contrib/libs/libevent/event_openssl/ya.make
+++ b/contrib/libs/libevent/event_openssl/ya.make
@@ -1,7 +1,7 @@
-# Generated by devtools/yamaker.
-
-LIBRARY()
-
+# Generated by devtools/yamaker.
+
+LIBRARY()
+
WITHOUT_LICENSE_TEXTS()
OWNER(
@@ -13,29 +13,29 @@ OWNER(
LICENSE(BSD-3-Clause)
-PEERDIR(
- contrib/libs/libc_compat
- contrib/libs/openssl
-)
-
-ADDINCL(
- contrib/libs/libevent
- contrib/libs/libevent/include
-)
-
-NO_COMPILER_WARNINGS()
-
-NO_RUNTIME()
-
-CFLAGS(
- -DHAVE_CONFIG_H
- -DEVENT__HAVE_STRLCPY=1
-)
-
-SRCDIR(contrib/libs/libevent)
-
-SRCS(
- bufferevent_openssl.c
-)
-
-END()
+PEERDIR(
+ contrib/libs/libc_compat
+ contrib/libs/openssl
+)
+
+ADDINCL(
+ contrib/libs/libevent
+ contrib/libs/libevent/include
+)
+
+NO_COMPILER_WARNINGS()
+
+NO_RUNTIME()
+
+CFLAGS(
+ -DHAVE_CONFIG_H
+ -DEVENT__HAVE_STRLCPY=1
+)
+
+SRCDIR(contrib/libs/libevent)
+
+SRCS(
+ bufferevent_openssl.c
+)
+
+END()
diff --git a/contrib/libs/libevent/event_tagging.c b/contrib/libs/libevent/event_tagging.c
index b021e8c8de..32a01290dd 100644
--- a/contrib/libs/libevent/event_tagging.c
+++ b/contrib/libs/libevent/event_tagging.c
@@ -26,27 +26,27 @@
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
-#ifdef EVENT__HAVE_SYS_TYPES_H
+#ifdef EVENT__HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef EVENT__HAVE_SYS_PARAM_H
+#ifdef EVENT__HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
-#ifdef _WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
-#endif
-
-#ifdef EVENT__HAVE_SYS_IOCTL_H
+#endif
+
+#ifdef EVENT__HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#include <sys/queue.h>
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -54,10 +54,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifndef _WIN32
+#ifndef _WIN32
#include <syslog.h>
#endif
-#ifdef EVENT__HAVE_UNISTD_H
+#ifdef EVENT__HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <limits.h>
@@ -93,13 +93,13 @@
a final padding nibble with value 0 is appended.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_decode_int(ev_uint32_t *pnumber, struct evbuffer *evbuf);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_decode_int64(ev_uint64_t *pnumber, struct evbuffer *evbuf);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_encode_tag(struct evbuffer *evbuf, ev_uint32_t tag);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_decode_tag(ev_uint32_t *ptag, struct evbuffer *evbuf);
void
@@ -217,14 +217,14 @@ decode_tag_internal(ev_uint32_t *ptag, struct evbuffer *evbuf, int dodrain)
while (count++ < len) {
ev_uint8_t lower = *data++;
- if (shift >= 28) {
- /* Make sure it fits into 32 bits */
- if (shift > 28)
- return (-1);
- if ((lower & 0x7f) > 15)
- return (-1);
- }
- number |= (lower & (unsigned)0x7f) << shift;
+ if (shift >= 28) {
+ /* Make sure it fits into 32 bits */
+ if (shift > 28)
+ return (-1);
+ if ((lower & 0x7f) > 15)
+ return (-1);
+ }
+ number |= (lower & (unsigned)0x7f) << shift;
shift += 7;
if (!(lower & 0x80)) {
diff --git a/contrib/libs/libevent/event_thread/ya.make b/contrib/libs/libevent/event_thread/ya.make
index 63579b456a..00fb32fdf9 100644
--- a/contrib/libs/libevent/event_thread/ya.make
+++ b/contrib/libs/libevent/event_thread/ya.make
@@ -1,7 +1,7 @@
-# Generated by devtools/yamaker.
-
-LIBRARY()
-
+# Generated by devtools/yamaker.
+
+LIBRARY()
+
WITHOUT_LICENSE_TEXTS()
OWNER(
@@ -13,34 +13,34 @@ OWNER(
LICENSE(BSD-3-Clause)
-PEERDIR(
- contrib/libs/libc_compat
-)
-
-ADDINCL(
- contrib/libs/libevent
- contrib/libs/libevent/include
-)
-
-NO_COMPILER_WARNINGS()
-
-NO_RUNTIME()
-
-CFLAGS(
- -DHAVE_CONFIG_H
- -DEVENT__HAVE_STRLCPY=1
-)
-
-SRCDIR(contrib/libs/libevent)
-
-IF (OS_WINDOWS)
- SRCS(
- evthread_win32.c
- )
-ELSE()
- SRCS(
- evthread_pthread.c
- )
-ENDIF()
-
-END()
+PEERDIR(
+ contrib/libs/libc_compat
+)
+
+ADDINCL(
+ contrib/libs/libevent
+ contrib/libs/libevent/include
+)
+
+NO_COMPILER_WARNINGS()
+
+NO_RUNTIME()
+
+CFLAGS(
+ -DHAVE_CONFIG_H
+ -DEVENT__HAVE_STRLCPY=1
+)
+
+SRCDIR(contrib/libs/libevent)
+
+IF (OS_WINDOWS)
+ SRCS(
+ evthread_win32.c
+ )
+ELSE()
+ SRCS(
+ evthread_pthread.c
+ )
+ENDIF()
+
+END()
diff --git a/contrib/libs/libevent/evmap-internal.h b/contrib/libs/libevent/evmap-internal.h
index dfc81d5087..f1f5c08994 100644
--- a/contrib/libs/libevent/evmap-internal.h
+++ b/contrib/libs/libevent/evmap-internal.h
@@ -23,8 +23,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVMAP_INTERNAL_H_INCLUDED_
-#define EVMAP_INTERNAL_H_INCLUDED_
+#ifndef EVMAP_INTERNAL_H_INCLUDED_
+#define EVMAP_INTERNAL_H_INCLUDED_
/** @file evmap-internal.h
*
@@ -39,15 +39,15 @@ struct event;
/** Initialize an event_map for use.
*/
-void evmap_io_initmap_(struct event_io_map* ctx);
-void evmap_signal_initmap_(struct event_signal_map* ctx);
+void evmap_io_initmap_(struct event_io_map* ctx);
+void evmap_signal_initmap_(struct event_signal_map* ctx);
/** Remove all entries from an event_map.
@param ctx the map to clear.
*/
-void evmap_io_clear_(struct event_io_map* ctx);
-void evmap_signal_clear_(struct event_signal_map* ctx);
+void evmap_io_clear_(struct event_io_map* ctx);
+void evmap_signal_clear_(struct event_signal_map* ctx);
/** Add an IO event (some combination of EV_READ or EV_WRITE) to an
event_base's list of events on a given file descriptor, and tell the
@@ -59,7 +59,7 @@ void evmap_signal_clear_(struct event_signal_map* ctx);
@param fd the file descriptor corresponding to ev.
@param ev the event to add.
*/
-int evmap_io_add_(struct event_base *base, evutil_socket_t fd, struct event *ev);
+int evmap_io_add_(struct event_base *base, evutil_socket_t fd, struct event *ev);
/** Remove an IO event (some combination of EV_READ or EV_WRITE) to an
event_base's list of events on a given file descriptor, and tell the
underlying eventops about the fd if its state has changed.
@@ -68,50 +68,50 @@ int evmap_io_add_(struct event_base *base, evutil_socket_t fd, struct event *ev)
@param fd the file descriptor corresponding to ev.
@param ev the event to remove.
*/
-int evmap_io_del_(struct event_base *base, evutil_socket_t fd, struct event *ev);
+int evmap_io_del_(struct event_base *base, evutil_socket_t fd, struct event *ev);
/** Active the set of events waiting on an event_base for a given fd.
@param base the event_base to operate on.
@param fd the file descriptor that has become active.
@param events a bitmask of EV_READ|EV_WRITE|EV_ET.
*/
-void evmap_io_active_(struct event_base *base, evutil_socket_t fd, short events);
+void evmap_io_active_(struct event_base *base, evutil_socket_t fd, short events);
/* These functions behave in the same way as evmap_io_*, except they work on
* signals rather than fds. signals use a linear map everywhere; fds use
* either a linear map or a hashtable. */
-int evmap_signal_add_(struct event_base *base, int signum, struct event *ev);
-int evmap_signal_del_(struct event_base *base, int signum, struct event *ev);
-void evmap_signal_active_(struct event_base *base, evutil_socket_t signum, int ncalls);
-
-/* Return the fdinfo object associated with a given fd. If the fd has no
- * events associated with it, the result may be NULL.
- */
-void *evmap_io_get_fdinfo_(struct event_io_map *ctx, evutil_socket_t fd);
-
-/* Helper for event_reinit(): Tell the backend to re-add every fd and signal
- * for which we have a pending event.
- */
-int evmap_reinit_(struct event_base *base);
-
-/* Helper for event_base_free(): Call event_del() on every pending fd and
- * signal event.
- */
-void evmap_delete_all_(struct event_base *base);
-
-/* Helper for event_base_assert_ok_(): Check referential integrity of the
- * evmaps.
- */
-void evmap_check_integrity_(struct event_base *base);
-
-/* Helper: Call fn on every fd or signal event, passing as its arguments the
- * provided event_base, the event, and arg. If fn returns 0, process the next
- * event. If it returns any other value, return that value and process no
- * more events.
- */
-int evmap_foreach_event_(struct event_base *base,
- event_base_foreach_event_cb fn,
- void *arg);
-
-#endif /* EVMAP_INTERNAL_H_INCLUDED_ */
+int evmap_signal_add_(struct event_base *base, int signum, struct event *ev);
+int evmap_signal_del_(struct event_base *base, int signum, struct event *ev);
+void evmap_signal_active_(struct event_base *base, evutil_socket_t signum, int ncalls);
+
+/* Return the fdinfo object associated with a given fd. If the fd has no
+ * events associated with it, the result may be NULL.
+ */
+void *evmap_io_get_fdinfo_(struct event_io_map *ctx, evutil_socket_t fd);
+
+/* Helper for event_reinit(): Tell the backend to re-add every fd and signal
+ * for which we have a pending event.
+ */
+int evmap_reinit_(struct event_base *base);
+
+/* Helper for event_base_free(): Call event_del() on every pending fd and
+ * signal event.
+ */
+void evmap_delete_all_(struct event_base *base);
+
+/* Helper for event_base_assert_ok_(): Check referential integrity of the
+ * evmaps.
+ */
+void evmap_check_integrity_(struct event_base *base);
+
+/* Helper: Call fn on every fd or signal event, passing as its arguments the
+ * provided event_base, the event, and arg. If fn returns 0, process the next
+ * event. If it returns any other value, return that value and process no
+ * more events.
+ */
+int evmap_foreach_event_(struct event_base *base,
+ event_base_foreach_event_cb fn,
+ void *arg);
+
+#endif /* EVMAP_INTERNAL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/evmap.c b/contrib/libs/libevent/evmap.c
index e4e35c6877..11c7617f79 100644
--- a/contrib/libs/libevent/evmap.c
+++ b/contrib/libs/libevent/evmap.c
@@ -24,26 +24,26 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
#include <sys/types.h>
-#if !defined(_WIN32) && defined(EVENT__HAVE_SYS_TIME_H)
+#if !defined(_WIN32) && defined(EVENT__HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/queue.h>
#include <stdio.h>
#include <stdlib.h>
-#ifndef _WIN32
+#ifndef _WIN32
#include <unistd.h>
#endif
#include <errno.h>
-#include <limits.h>
+#include <limits.h>
#include <signal.h>
#include <string.h>
#include <time.h>
@@ -57,16 +57,16 @@
write on a given fd, and the number of each.
*/
struct evmap_io {
- struct event_dlist events;
+ struct event_dlist events;
ev_uint16_t nread;
ev_uint16_t nwrite;
- ev_uint16_t nclose;
+ ev_uint16_t nclose;
};
/* An entry for an evmap_signal list: notes all the events that want to know
when a signal triggers. */
struct evmap_signal {
- struct event_dlist events;
+ struct event_dlist events;
};
/* On some platforms, fds start at 0 and increment by 1 as they are
@@ -113,38 +113,38 @@ HT_GENERATE(event_io_map, event_map_entry, map_node, hashsocket, eqsocket,
#define GET_IO_SLOT(x, map, slot, type) \
do { \
- struct event_map_entry key_, *ent_; \
- key_.fd = slot; \
- ent_ = HT_FIND(event_io_map, map, &key_); \
- (x) = ent_ ? &ent_->ent.type : NULL; \
+ struct event_map_entry key_, *ent_; \
+ key_.fd = slot; \
+ ent_ = HT_FIND(event_io_map, map, &key_); \
+ (x) = ent_ ? &ent_->ent.type : NULL; \
} while (0);
#define GET_IO_SLOT_AND_CTOR(x, map, slot, type, ctor, fdinfo_len) \
do { \
- struct event_map_entry key_, *ent_; \
- key_.fd = slot; \
- HT_FIND_OR_INSERT_(event_io_map, map_node, hashsocket, map, \
- event_map_entry, &key_, ptr, \
+ struct event_map_entry key_, *ent_; \
+ key_.fd = slot; \
+ HT_FIND_OR_INSERT_(event_io_map, map_node, hashsocket, map, \
+ event_map_entry, &key_, ptr, \
{ \
- ent_ = *ptr; \
+ ent_ = *ptr; \
}, \
{ \
- ent_ = mm_calloc(1,sizeof(struct event_map_entry)+fdinfo_len); \
- if (EVUTIL_UNLIKELY(ent_ == NULL)) \
+ ent_ = mm_calloc(1,sizeof(struct event_map_entry)+fdinfo_len); \
+ if (EVUTIL_UNLIKELY(ent_ == NULL)) \
return (-1); \
- ent_->fd = slot; \
- (ctor)(&ent_->ent.type); \
- HT_FOI_INSERT_(map_node, map, &key_, ent_, ptr) \
+ ent_->fd = slot; \
+ (ctor)(&ent_->ent.type); \
+ HT_FOI_INSERT_(map_node, map, &key_, ent_, ptr) \
}); \
- (x) = &ent_->ent.type; \
+ (x) = &ent_->ent.type; \
} while (0)
-void evmap_io_initmap_(struct event_io_map *ctx)
+void evmap_io_initmap_(struct event_io_map *ctx)
{
HT_INIT(event_io_map, ctx);
}
-void evmap_io_clear_(struct event_io_map *ctx)
+void evmap_io_clear_(struct event_io_map *ctx)
{
struct event_map_entry **ent, **next, *this;
for (ent = HT_START(event_io_map, ctx); ent; ent = next) {
@@ -186,14 +186,14 @@ void evmap_io_clear_(struct event_io_map *ctx)
GET_SIGNAL_SLOT_AND_CTOR(x,map,slot,type,ctor,fdinfo_len)
#define FDINFO_OFFSET sizeof(struct evmap_io)
void
-evmap_io_initmap_(struct event_io_map* ctx)
+evmap_io_initmap_(struct event_io_map* ctx)
{
- evmap_signal_initmap_(ctx);
+ evmap_signal_initmap_(ctx);
}
void
-evmap_io_clear_(struct event_io_map* ctx)
+evmap_io_clear_(struct event_io_map* ctx)
{
- evmap_signal_clear_(ctx);
+ evmap_signal_clear_(ctx);
}
#endif
@@ -208,15 +208,15 @@ evmap_make_space(struct event_signal_map *map, int slot, int msize)
int nentries = map->nentries ? map->nentries : 32;
void **tmp;
- if (slot > INT_MAX / 2)
- return (-1);
-
+ if (slot > INT_MAX / 2)
+ return (-1);
+
while (nentries <= slot)
nentries <<= 1;
- if (nentries > INT_MAX / msize)
- return (-1);
-
+ if (nentries > INT_MAX / msize)
+ return (-1);
+
tmp = (void **)mm_realloc(map->entries, nentries * msize);
if (tmp == NULL)
return (-1);
@@ -232,14 +232,14 @@ evmap_make_space(struct event_signal_map *map, int slot, int msize)
}
void
-evmap_signal_initmap_(struct event_signal_map *ctx)
+evmap_signal_initmap_(struct event_signal_map *ctx)
{
ctx->nentries = 0;
ctx->entries = NULL;
}
void
-evmap_signal_clear_(struct event_signal_map *ctx)
+evmap_signal_clear_(struct event_signal_map *ctx)
{
if (ctx->entries != NULL) {
int i;
@@ -260,22 +260,22 @@ evmap_signal_clear_(struct event_signal_map *ctx)
static void
evmap_io_init(struct evmap_io *entry)
{
- LIST_INIT(&entry->events);
+ LIST_INIT(&entry->events);
entry->nread = 0;
entry->nwrite = 0;
- entry->nclose = 0;
+ entry->nclose = 0;
}
/* return -1 on error, 0 on success if nothing changed in the event backend,
* and 1 on success if something did. */
int
-evmap_io_add_(struct event_base *base, evutil_socket_t fd, struct event *ev)
+evmap_io_add_(struct event_base *base, evutil_socket_t fd, struct event *ev)
{
const struct eventop *evsel = base->evsel;
struct event_io_map *io = &base->io;
struct evmap_io *ctx = NULL;
- int nread, nwrite, nclose, retval = 0;
+ int nread, nwrite, nclose, retval = 0;
short res = 0, old = 0;
struct event *old_ev;
@@ -295,14 +295,14 @@ evmap_io_add_(struct event_base *base, evutil_socket_t fd, struct event *ev)
nread = ctx->nread;
nwrite = ctx->nwrite;
- nclose = ctx->nclose;
+ nclose = ctx->nclose;
if (nread)
old |= EV_READ;
if (nwrite)
old |= EV_WRITE;
- if (nclose)
- old |= EV_CLOSED;
+ if (nclose)
+ old |= EV_CLOSED;
if (ev->ev_events & EV_READ) {
if (++nread == 1)
@@ -312,17 +312,17 @@ evmap_io_add_(struct event_base *base, evutil_socket_t fd, struct event *ev)
if (++nwrite == 1)
res |= EV_WRITE;
}
- if (ev->ev_events & EV_CLOSED) {
- if (++nclose == 1)
- res |= EV_CLOSED;
- }
- if (EVUTIL_UNLIKELY(nread > 0xffff || nwrite > 0xffff || nclose > 0xffff)) {
+ if (ev->ev_events & EV_CLOSED) {
+ if (++nclose == 1)
+ res |= EV_CLOSED;
+ }
+ if (EVUTIL_UNLIKELY(nread > 0xffff || nwrite > 0xffff || nclose > 0xffff)) {
event_warnx("Too many events reading or writing on fd %d",
(int)fd);
return -1;
}
if (EVENT_DEBUG_MODE_IS_ON() &&
- (old_ev = LIST_FIRST(&ctx->events)) &&
+ (old_ev = LIST_FIRST(&ctx->events)) &&
(old_ev->ev_events&EV_ET) != (ev->ev_events&EV_ET)) {
event_warnx("Tried to mix edge-triggered and non-edge-triggered"
" events on fd %d", (int)fd);
@@ -342,8 +342,8 @@ evmap_io_add_(struct event_base *base, evutil_socket_t fd, struct event *ev)
ctx->nread = (ev_uint16_t) nread;
ctx->nwrite = (ev_uint16_t) nwrite;
- ctx->nclose = (ev_uint16_t) nclose;
- LIST_INSERT_HEAD(&ctx->events, ev, ev_io_next);
+ ctx->nclose = (ev_uint16_t) nclose;
+ LIST_INSERT_HEAD(&ctx->events, ev, ev_io_next);
return (retval);
}
@@ -351,12 +351,12 @@ evmap_io_add_(struct event_base *base, evutil_socket_t fd, struct event *ev)
/* return -1 on error, 0 on success if nothing changed in the event backend,
* and 1 on success if something did. */
int
-evmap_io_del_(struct event_base *base, evutil_socket_t fd, struct event *ev)
+evmap_io_del_(struct event_base *base, evutil_socket_t fd, struct event *ev)
{
const struct eventop *evsel = base->evsel;
struct event_io_map *io = &base->io;
struct evmap_io *ctx;
- int nread, nwrite, nclose, retval = 0;
+ int nread, nwrite, nclose, retval = 0;
short res = 0, old = 0;
if (fd < 0)
@@ -373,14 +373,14 @@ evmap_io_del_(struct event_base *base, evutil_socket_t fd, struct event *ev)
nread = ctx->nread;
nwrite = ctx->nwrite;
- nclose = ctx->nclose;
+ nclose = ctx->nclose;
if (nread)
old |= EV_READ;
if (nwrite)
old |= EV_WRITE;
- if (nclose)
- old |= EV_CLOSED;
+ if (nclose)
+ old |= EV_CLOSED;
if (ev->ev_events & EV_READ) {
if (--nread == 0)
@@ -392,48 +392,48 @@ evmap_io_del_(struct event_base *base, evutil_socket_t fd, struct event *ev)
res |= EV_WRITE;
EVUTIL_ASSERT(nwrite >= 0);
}
- if (ev->ev_events & EV_CLOSED) {
- if (--nclose == 0)
- res |= EV_CLOSED;
- EVUTIL_ASSERT(nclose >= 0);
- }
+ if (ev->ev_events & EV_CLOSED) {
+ if (--nclose == 0)
+ res |= EV_CLOSED;
+ EVUTIL_ASSERT(nclose >= 0);
+ }
if (res) {
void *extra = ((char*)ctx) + sizeof(struct evmap_io);
- if (evsel->del(base, ev->ev_fd,
- old, (ev->ev_events & EV_ET) | res, extra) == -1) {
- retval = -1;
- } else {
- retval = 1;
- }
+ if (evsel->del(base, ev->ev_fd,
+ old, (ev->ev_events & EV_ET) | res, extra) == -1) {
+ retval = -1;
+ } else {
+ retval = 1;
+ }
}
ctx->nread = nread;
ctx->nwrite = nwrite;
- ctx->nclose = nclose;
- LIST_REMOVE(ev, ev_io_next);
+ ctx->nclose = nclose;
+ LIST_REMOVE(ev, ev_io_next);
return (retval);
}
void
-evmap_io_active_(struct event_base *base, evutil_socket_t fd, short events)
+evmap_io_active_(struct event_base *base, evutil_socket_t fd, short events)
{
struct event_io_map *io = &base->io;
struct evmap_io *ctx;
struct event *ev;
#ifndef EVMAP_USE_HT
- if (fd < 0 || fd >= io->nentries)
- return;
+ if (fd < 0 || fd >= io->nentries)
+ return;
#endif
GET_IO_SLOT(ctx, io, fd, evmap_io);
- if (NULL == ctx)
- return;
- LIST_FOREACH(ev, &ctx->events, ev_io_next) {
+ if (NULL == ctx)
+ return;
+ LIST_FOREACH(ev, &ctx->events, ev_io_next) {
if (ev->ev_events & (events & ~EV_ET))
- event_active_nolock_(ev, ev->ev_events & events, 1);
+ event_active_nolock_(ev, ev->ev_events & events, 1);
}
}
@@ -442,20 +442,20 @@ evmap_io_active_(struct event_base *base, evutil_socket_t fd, short events)
static void
evmap_signal_init(struct evmap_signal *entry)
{
- LIST_INIT(&entry->events);
+ LIST_INIT(&entry->events);
}
int
-evmap_signal_add_(struct event_base *base, int sig, struct event *ev)
+evmap_signal_add_(struct event_base *base, int sig, struct event *ev)
{
const struct eventop *evsel = base->evsigsel;
struct event_signal_map *map = &base->sigmap;
struct evmap_signal *ctx = NULL;
- if (sig < 0 || sig >= NSIG)
- return (-1);
-
+ if (sig < 0 || sig >= NSIG)
+ return (-1);
+
if (sig >= map->nentries) {
if (evmap_make_space(
map, sig, sizeof(struct evmap_signal *)) == -1)
@@ -464,32 +464,32 @@ evmap_signal_add_(struct event_base *base, int sig, struct event *ev)
GET_SIGNAL_SLOT_AND_CTOR(ctx, map, sig, evmap_signal, evmap_signal_init,
base->evsigsel->fdinfo_len);
- if (LIST_EMPTY(&ctx->events)) {
+ if (LIST_EMPTY(&ctx->events)) {
if (evsel->add(base, ev->ev_fd, 0, EV_SIGNAL, NULL)
== -1)
return (-1);
}
- LIST_INSERT_HEAD(&ctx->events, ev, ev_signal_next);
+ LIST_INSERT_HEAD(&ctx->events, ev, ev_signal_next);
return (1);
}
int
-evmap_signal_del_(struct event_base *base, int sig, struct event *ev)
+evmap_signal_del_(struct event_base *base, int sig, struct event *ev)
{
const struct eventop *evsel = base->evsigsel;
struct event_signal_map *map = &base->sigmap;
struct evmap_signal *ctx;
- if (sig < 0 || sig >= map->nentries)
+ if (sig < 0 || sig >= map->nentries)
return (-1);
GET_SIGNAL_SLOT(ctx, map, sig, evmap_signal);
- LIST_REMOVE(ev, ev_signal_next);
-
- if (LIST_FIRST(&ctx->events) == NULL) {
+ LIST_REMOVE(ev, ev_signal_next);
+
+ if (LIST_FIRST(&ctx->events) == NULL) {
if (evsel->del(base, ev->ev_fd, 0, EV_SIGNAL, NULL) == -1)
return (-1);
}
@@ -498,24 +498,24 @@ evmap_signal_del_(struct event_base *base, int sig, struct event *ev)
}
void
-evmap_signal_active_(struct event_base *base, evutil_socket_t sig, int ncalls)
+evmap_signal_active_(struct event_base *base, evutil_socket_t sig, int ncalls)
{
struct event_signal_map *map = &base->sigmap;
struct evmap_signal *ctx;
struct event *ev;
- if (sig < 0 || sig >= map->nentries)
- return;
+ if (sig < 0 || sig >= map->nentries)
+ return;
GET_SIGNAL_SLOT(ctx, map, sig, evmap_signal);
- if (!ctx)
- return;
- LIST_FOREACH(ev, &ctx->events, ev_signal_next)
- event_active_nolock_(ev, EV_SIGNAL, ncalls);
+ if (!ctx)
+ return;
+ LIST_FOREACH(ev, &ctx->events, ev_signal_next)
+ event_active_nolock_(ev, EV_SIGNAL, ncalls);
}
void *
-evmap_io_get_fdinfo_(struct event_io_map *map, evutil_socket_t fd)
+evmap_io_get_fdinfo_(struct event_io_map *map, evutil_socket_t fd)
{
struct evmap_io *ctx;
GET_IO_SLOT(ctx, map, fd, evmap_io);
@@ -525,177 +525,177 @@ evmap_io_get_fdinfo_(struct event_io_map *map, evutil_socket_t fd)
return NULL;
}
-/* Callback type for evmap_io_foreach_fd */
-typedef int (*evmap_io_foreach_fd_cb)(
- struct event_base *, evutil_socket_t, struct evmap_io *, void *);
-
-/* Multipurpose helper function: Iterate over every file descriptor event_base
- * for which we could have EV_READ or EV_WRITE events. For each such fd, call
- * fn(base, signum, evmap_io, arg), where fn is the user-provided
- * function, base is the event_base, signum is the signal number, evmap_io
- * is an evmap_io structure containing a list of events pending on the
- * file descriptor, and arg is the user-supplied argument.
- *
- * If fn returns 0, continue on to the next signal. Otherwise, return the same
- * value that fn returned.
- *
- * Note that there is no guarantee that the file descriptors will be processed
- * in any particular order.
- */
-static int
-evmap_io_foreach_fd(struct event_base *base,
- evmap_io_foreach_fd_cb fn,
- void *arg)
-{
- evutil_socket_t fd;
- struct event_io_map *iomap = &base->io;
- int r = 0;
-#ifdef EVMAP_USE_HT
- struct event_map_entry **mapent;
- HT_FOREACH(mapent, event_io_map, iomap) {
- struct evmap_io *ctx = &(*mapent)->ent.evmap_io;
- fd = (*mapent)->fd;
-#else
- for (fd = 0; fd < iomap->nentries; ++fd) {
- struct evmap_io *ctx = iomap->entries[fd];
- if (!ctx)
- continue;
-#endif
- if ((r = fn(base, fd, ctx, arg)))
- break;
- }
- return r;
-}
-
-/* Callback type for evmap_signal_foreach_signal */
-typedef int (*evmap_signal_foreach_signal_cb)(
- struct event_base *, int, struct evmap_signal *, void *);
-
-/* Multipurpose helper function: Iterate over every signal number in the
- * event_base for which we could have signal events. For each such signal,
- * call fn(base, signum, evmap_signal, arg), where fn is the user-provided
- * function, base is the event_base, signum is the signal number, evmap_signal
- * is an evmap_signal structure containing a list of events pending on the
- * signal, and arg is the user-supplied argument.
- *
- * If fn returns 0, continue on to the next signal. Otherwise, return the same
- * value that fn returned.
- */
-static int
-evmap_signal_foreach_signal(struct event_base *base,
- evmap_signal_foreach_signal_cb fn,
- void *arg)
-{
- struct event_signal_map *sigmap = &base->sigmap;
- int r = 0;
- int signum;
-
- for (signum = 0; signum < sigmap->nentries; ++signum) {
- struct evmap_signal *ctx = sigmap->entries[signum];
- if (!ctx)
- continue;
- if ((r = fn(base, signum, ctx, arg)))
- break;
- }
- return r;
-}
-
-/* Helper for evmap_reinit_: tell the backend to add every fd for which we have
- * pending events, with the appropriate combination of EV_READ, EV_WRITE, and
- * EV_ET. */
-static int
-evmap_io_reinit_iter_fn(struct event_base *base, evutil_socket_t fd,
- struct evmap_io *ctx, void *arg)
-{
- const struct eventop *evsel = base->evsel;
- void *extra;
- int *result = arg;
- short events = 0;
- struct event *ev;
- EVUTIL_ASSERT(ctx);
-
- extra = ((char*)ctx) + sizeof(struct evmap_io);
- if (ctx->nread)
- events |= EV_READ;
- if (ctx->nwrite)
- events |= EV_WRITE;
- if (ctx->nclose)
- events |= EV_CLOSED;
- if (evsel->fdinfo_len)
- memset(extra, 0, evsel->fdinfo_len);
- if (events &&
- (ev = LIST_FIRST(&ctx->events)) &&
- (ev->ev_events & EV_ET))
- events |= EV_ET;
- if (evsel->add(base, fd, 0, events, extra) == -1)
- *result = -1;
-
- return 0;
-}
-
-/* Helper for evmap_reinit_: tell the backend to add every signal for which we
- * have pending events. */
-static int
-evmap_signal_reinit_iter_fn(struct event_base *base,
- int signum, struct evmap_signal *ctx, void *arg)
-{
- const struct eventop *evsel = base->evsigsel;
- int *result = arg;
-
- if (!LIST_EMPTY(&ctx->events)) {
- if (evsel->add(base, signum, 0, EV_SIGNAL, NULL) == -1)
- *result = -1;
- }
- return 0;
-}
-
-int
-evmap_reinit_(struct event_base *base)
-{
- int result = 0;
-
- evmap_io_foreach_fd(base, evmap_io_reinit_iter_fn, &result);
- if (result < 0)
- return -1;
- evmap_signal_foreach_signal(base, evmap_signal_reinit_iter_fn, &result);
- if (result < 0)
- return -1;
- return 0;
-}
-
-/* Helper for evmap_delete_all_: delete every event in an event_dlist. */
-static int
-delete_all_in_dlist(struct event_dlist *dlist)
-{
- struct event *ev;
- while ((ev = LIST_FIRST(dlist)))
- event_del(ev);
- return 0;
-}
-
-/* Helper for evmap_delete_all_: delete every event pending on an fd. */
-static int
-evmap_io_delete_all_iter_fn(struct event_base *base, evutil_socket_t fd,
- struct evmap_io *io_info, void *arg)
-{
- return delete_all_in_dlist(&io_info->events);
-}
-
-/* Helper for evmap_delete_all_: delete every event pending on a signal. */
-static int
-evmap_signal_delete_all_iter_fn(struct event_base *base, int signum,
- struct evmap_signal *sig_info, void *arg)
-{
- return delete_all_in_dlist(&sig_info->events);
-}
-
-void
-evmap_delete_all_(struct event_base *base)
-{
- evmap_signal_foreach_signal(base, evmap_signal_delete_all_iter_fn, NULL);
- evmap_io_foreach_fd(base, evmap_io_delete_all_iter_fn, NULL);
-}
-
+/* Callback type for evmap_io_foreach_fd */
+typedef int (*evmap_io_foreach_fd_cb)(
+ struct event_base *, evutil_socket_t, struct evmap_io *, void *);
+
+/* Multipurpose helper function: Iterate over every file descriptor event_base
+ * for which we could have EV_READ or EV_WRITE events. For each such fd, call
+ * fn(base, signum, evmap_io, arg), where fn is the user-provided
+ * function, base is the event_base, signum is the signal number, evmap_io
+ * is an evmap_io structure containing a list of events pending on the
+ * file descriptor, and arg is the user-supplied argument.
+ *
+ * If fn returns 0, continue on to the next signal. Otherwise, return the same
+ * value that fn returned.
+ *
+ * Note that there is no guarantee that the file descriptors will be processed
+ * in any particular order.
+ */
+static int
+evmap_io_foreach_fd(struct event_base *base,
+ evmap_io_foreach_fd_cb fn,
+ void *arg)
+{
+ evutil_socket_t fd;
+ struct event_io_map *iomap = &base->io;
+ int r = 0;
+#ifdef EVMAP_USE_HT
+ struct event_map_entry **mapent;
+ HT_FOREACH(mapent, event_io_map, iomap) {
+ struct evmap_io *ctx = &(*mapent)->ent.evmap_io;
+ fd = (*mapent)->fd;
+#else
+ for (fd = 0; fd < iomap->nentries; ++fd) {
+ struct evmap_io *ctx = iomap->entries[fd];
+ if (!ctx)
+ continue;
+#endif
+ if ((r = fn(base, fd, ctx, arg)))
+ break;
+ }
+ return r;
+}
+
+/* Callback type for evmap_signal_foreach_signal */
+typedef int (*evmap_signal_foreach_signal_cb)(
+ struct event_base *, int, struct evmap_signal *, void *);
+
+/* Multipurpose helper function: Iterate over every signal number in the
+ * event_base for which we could have signal events. For each such signal,
+ * call fn(base, signum, evmap_signal, arg), where fn is the user-provided
+ * function, base is the event_base, signum is the signal number, evmap_signal
+ * is an evmap_signal structure containing a list of events pending on the
+ * signal, and arg is the user-supplied argument.
+ *
+ * If fn returns 0, continue on to the next signal. Otherwise, return the same
+ * value that fn returned.
+ */
+static int
+evmap_signal_foreach_signal(struct event_base *base,
+ evmap_signal_foreach_signal_cb fn,
+ void *arg)
+{
+ struct event_signal_map *sigmap = &base->sigmap;
+ int r = 0;
+ int signum;
+
+ for (signum = 0; signum < sigmap->nentries; ++signum) {
+ struct evmap_signal *ctx = sigmap->entries[signum];
+ if (!ctx)
+ continue;
+ if ((r = fn(base, signum, ctx, arg)))
+ break;
+ }
+ return r;
+}
+
+/* Helper for evmap_reinit_: tell the backend to add every fd for which we have
+ * pending events, with the appropriate combination of EV_READ, EV_WRITE, and
+ * EV_ET. */
+static int
+evmap_io_reinit_iter_fn(struct event_base *base, evutil_socket_t fd,
+ struct evmap_io *ctx, void *arg)
+{
+ const struct eventop *evsel = base->evsel;
+ void *extra;
+ int *result = arg;
+ short events = 0;
+ struct event *ev;
+ EVUTIL_ASSERT(ctx);
+
+ extra = ((char*)ctx) + sizeof(struct evmap_io);
+ if (ctx->nread)
+ events |= EV_READ;
+ if (ctx->nwrite)
+ events |= EV_WRITE;
+ if (ctx->nclose)
+ events |= EV_CLOSED;
+ if (evsel->fdinfo_len)
+ memset(extra, 0, evsel->fdinfo_len);
+ if (events &&
+ (ev = LIST_FIRST(&ctx->events)) &&
+ (ev->ev_events & EV_ET))
+ events |= EV_ET;
+ if (evsel->add(base, fd, 0, events, extra) == -1)
+ *result = -1;
+
+ return 0;
+}
+
+/* Helper for evmap_reinit_: tell the backend to add every signal for which we
+ * have pending events. */
+static int
+evmap_signal_reinit_iter_fn(struct event_base *base,
+ int signum, struct evmap_signal *ctx, void *arg)
+{
+ const struct eventop *evsel = base->evsigsel;
+ int *result = arg;
+
+ if (!LIST_EMPTY(&ctx->events)) {
+ if (evsel->add(base, signum, 0, EV_SIGNAL, NULL) == -1)
+ *result = -1;
+ }
+ return 0;
+}
+
+int
+evmap_reinit_(struct event_base *base)
+{
+ int result = 0;
+
+ evmap_io_foreach_fd(base, evmap_io_reinit_iter_fn, &result);
+ if (result < 0)
+ return -1;
+ evmap_signal_foreach_signal(base, evmap_signal_reinit_iter_fn, &result);
+ if (result < 0)
+ return -1;
+ return 0;
+}
+
+/* Helper for evmap_delete_all_: delete every event in an event_dlist. */
+static int
+delete_all_in_dlist(struct event_dlist *dlist)
+{
+ struct event *ev;
+ while ((ev = LIST_FIRST(dlist)))
+ event_del(ev);
+ return 0;
+}
+
+/* Helper for evmap_delete_all_: delete every event pending on an fd. */
+static int
+evmap_io_delete_all_iter_fn(struct event_base *base, evutil_socket_t fd,
+ struct evmap_io *io_info, void *arg)
+{
+ return delete_all_in_dlist(&io_info->events);
+}
+
+/* Helper for evmap_delete_all_: delete every event pending on a signal. */
+static int
+evmap_signal_delete_all_iter_fn(struct event_base *base, int signum,
+ struct evmap_signal *sig_info, void *arg)
+{
+ return delete_all_in_dlist(&sig_info->events);
+}
+
+void
+evmap_delete_all_(struct event_base *base)
+{
+ evmap_signal_foreach_signal(base, evmap_signal_delete_all_iter_fn, NULL);
+ evmap_io_foreach_fd(base, evmap_io_delete_all_iter_fn, NULL);
+}
+
/** Per-fd structure for use with changelists. It keeps track, for each fd or
* signal using the changelist, of where its entry in the changelist is.
*/
@@ -705,7 +705,7 @@ struct event_changelist_fdinfo {
};
void
-event_changelist_init_(struct event_changelist *changelist)
+event_changelist_init_(struct event_changelist *changelist)
{
changelist->changes = NULL;
changelist->changes_size = 0;
@@ -730,26 +730,26 @@ event_change_get_fdinfo(struct event_base *base,
return (void*)ptr;
}
-/** Callback helper for event_changelist_assert_ok */
-static int
-event_changelist_assert_ok_foreach_iter_fn(
- struct event_base *base,
- evutil_socket_t fd, struct evmap_io *io, void *arg)
-{
- struct event_changelist *changelist = &base->changelist;
- struct event_changelist_fdinfo *f;
- f = (void*)
- ( ((char*)io) + sizeof(struct evmap_io) );
- if (f->idxplus1) {
- struct event_change *c = &changelist->changes[f->idxplus1 - 1];
- EVUTIL_ASSERT(c->fd == fd);
- }
- return 0;
-}
-
+/** Callback helper for event_changelist_assert_ok */
+static int
+event_changelist_assert_ok_foreach_iter_fn(
+ struct event_base *base,
+ evutil_socket_t fd, struct evmap_io *io, void *arg)
+{
+ struct event_changelist *changelist = &base->changelist;
+ struct event_changelist_fdinfo *f;
+ f = (void*)
+ ( ((char*)io) + sizeof(struct evmap_io) );
+ if (f->idxplus1) {
+ struct event_change *c = &changelist->changes[f->idxplus1 - 1];
+ EVUTIL_ASSERT(c->fd == fd);
+ }
+ return 0;
+}
+
/** Make sure that the changelist is consistent with the evmap structures. */
static void
-event_changelist_assert_ok(struct event_base *base)
+event_changelist_assert_ok(struct event_base *base)
{
int i;
struct event_changelist *changelist = &base->changelist;
@@ -764,19 +764,19 @@ event_changelist_assert_ok(struct event_base *base)
EVUTIL_ASSERT(f->idxplus1 == i + 1);
}
- evmap_io_foreach_fd(base,
- event_changelist_assert_ok_foreach_iter_fn,
- NULL);
+ evmap_io_foreach_fd(base,
+ event_changelist_assert_ok_foreach_iter_fn,
+ NULL);
}
-
-#ifdef DEBUG_CHANGELIST
-#define event_changelist_check(base) event_changelist_assert_ok((base))
+
+#ifdef DEBUG_CHANGELIST
+#define event_changelist_check(base) event_changelist_assert_ok((base))
#else
#define event_changelist_check(base) ((void)0)
#endif
void
-event_changelist_remove_all_(struct event_changelist *changelist,
+event_changelist_remove_all_(struct event_changelist *changelist,
struct event_base *base)
{
int i;
@@ -797,11 +797,11 @@ event_changelist_remove_all_(struct event_changelist *changelist,
}
void
-event_changelist_freemem_(struct event_changelist *changelist)
+event_changelist_freemem_(struct event_changelist *changelist)
{
if (changelist->changes)
mm_free(changelist->changes);
- event_changelist_init_(changelist); /* zero it all out. */
+ event_changelist_init_(changelist); /* zero it all out. */
}
/** Increase the size of 'changelist' to hold more changes. */
@@ -863,13 +863,13 @@ event_changelist_get_or_construct(struct event_changelist *changelist,
}
int
-event_changelist_add_(struct event_base *base, evutil_socket_t fd, short old, short events,
+event_changelist_add_(struct event_base *base, evutil_socket_t fd, short old, short events,
void *p)
{
struct event_changelist *changelist = &base->changelist;
struct event_changelist_fdinfo *fdinfo = p;
struct event_change *change;
- ev_uint8_t evchange = EV_CHANGE_ADD | (events & (EV_ET|EV_PERSIST|EV_SIGNAL));
+ ev_uint8_t evchange = EV_CHANGE_ADD | (events & (EV_ET|EV_PERSIST|EV_SIGNAL));
event_changelist_check(base);
@@ -881,25 +881,25 @@ event_changelist_add_(struct event_base *base, evutil_socket_t fd, short old, sh
* since the delete might fail (because the fd had been closed since
* the last add, for instance. */
- if (events & (EV_READ|EV_SIGNAL))
- change->read_change = evchange;
- if (events & EV_WRITE)
- change->write_change = evchange;
- if (events & EV_CLOSED)
- change->close_change = evchange;
+ if (events & (EV_READ|EV_SIGNAL))
+ change->read_change = evchange;
+ if (events & EV_WRITE)
+ change->write_change = evchange;
+ if (events & EV_CLOSED)
+ change->close_change = evchange;
event_changelist_check(base);
return (0);
}
int
-event_changelist_del_(struct event_base *base, evutil_socket_t fd, short old, short events,
+event_changelist_del_(struct event_base *base, evutil_socket_t fd, short old, short events,
void *p)
{
struct event_changelist *changelist = &base->changelist;
struct event_changelist_fdinfo *fdinfo = p;
struct event_change *change;
- ev_uint8_t del = EV_CHANGE_DEL | (events & EV_ET);
+ ev_uint8_t del = EV_CHANGE_DEL | (events & EV_ET);
event_changelist_check(base);
change = event_changelist_get_or_construct(changelist, fd, old, fdinfo);
@@ -907,11 +907,11 @@ event_changelist_del_(struct event_base *base, evutil_socket_t fd, short old, sh
if (!change)
return -1;
- /* A delete on an event set that doesn't contain the event to be
- deleted produces a no-op. This effectively emoves any previous
- uncommitted add, rather than replacing it: on those platforms where
- "add, delete, dispatch" is not the same as "no-op, dispatch", we
- want the no-op behavior.
+ /* A delete on an event set that doesn't contain the event to be
+ deleted produces a no-op. This effectively emoves any previous
+ uncommitted add, rather than replacing it: on those platforms where
+ "add, delete, dispatch" is not the same as "no-op, dispatch", we
+ want the no-op behavior.
If we have a no-op item, we could remove it it from the list
entirely, but really there's not much point: skipping the no-op
@@ -923,140 +923,140 @@ event_changelist_del_(struct event_base *base, evutil_socket_t fd, short old, sh
*/
if (events & (EV_READ|EV_SIGNAL)) {
- if (!(change->old_events & (EV_READ | EV_SIGNAL)))
+ if (!(change->old_events & (EV_READ | EV_SIGNAL)))
change->read_change = 0;
else
- change->read_change = del;
+ change->read_change = del;
}
if (events & EV_WRITE) {
- if (!(change->old_events & EV_WRITE))
+ if (!(change->old_events & EV_WRITE))
change->write_change = 0;
else
- change->write_change = del;
- }
- if (events & EV_CLOSED) {
- if (!(change->old_events & EV_CLOSED))
- change->close_change = 0;
- else
- change->close_change = del;
+ change->write_change = del;
}
+ if (events & EV_CLOSED) {
+ if (!(change->old_events & EV_CLOSED))
+ change->close_change = 0;
+ else
+ change->close_change = del;
+ }
event_changelist_check(base);
return (0);
}
-/* Helper for evmap_check_integrity_: verify that all of the events pending on
- * given fd are set up correctly, and that the nread and nwrite counts on that
- * fd are correct. */
-static int
-evmap_io_check_integrity_fn(struct event_base *base, evutil_socket_t fd,
- struct evmap_io *io_info, void *arg)
+/* Helper for evmap_check_integrity_: verify that all of the events pending on
+ * given fd are set up correctly, and that the nread and nwrite counts on that
+ * fd are correct. */
+static int
+evmap_io_check_integrity_fn(struct event_base *base, evutil_socket_t fd,
+ struct evmap_io *io_info, void *arg)
{
struct event *ev;
- int n_read = 0, n_write = 0, n_close = 0;
-
- /* First, make sure the list itself isn't corrupt. Otherwise,
- * running LIST_FOREACH could be an exciting adventure. */
- EVUTIL_ASSERT_LIST_OK(&io_info->events, event, ev_io_next);
+ int n_read = 0, n_write = 0, n_close = 0;
- LIST_FOREACH(ev, &io_info->events, ev_io_next) {
+ /* First, make sure the list itself isn't corrupt. Otherwise,
+ * running LIST_FOREACH could be an exciting adventure. */
+ EVUTIL_ASSERT_LIST_OK(&io_info->events, event, ev_io_next);
+
+ LIST_FOREACH(ev, &io_info->events, ev_io_next) {
EVUTIL_ASSERT(ev->ev_flags & EVLIST_INSERTED);
- EVUTIL_ASSERT(ev->ev_fd == fd);
- EVUTIL_ASSERT(!(ev->ev_events & EV_SIGNAL));
- EVUTIL_ASSERT((ev->ev_events & (EV_READ|EV_WRITE|EV_CLOSED)));
- if (ev->ev_events & EV_READ)
- ++n_read;
- if (ev->ev_events & EV_WRITE)
- ++n_write;
- if (ev->ev_events & EV_CLOSED)
- ++n_close;
+ EVUTIL_ASSERT(ev->ev_fd == fd);
+ EVUTIL_ASSERT(!(ev->ev_events & EV_SIGNAL));
+ EVUTIL_ASSERT((ev->ev_events & (EV_READ|EV_WRITE|EV_CLOSED)));
+ if (ev->ev_events & EV_READ)
+ ++n_read;
+ if (ev->ev_events & EV_WRITE)
+ ++n_write;
+ if (ev->ev_events & EV_CLOSED)
+ ++n_close;
}
- EVUTIL_ASSERT(n_read == io_info->nread);
- EVUTIL_ASSERT(n_write == io_info->nwrite);
- EVUTIL_ASSERT(n_close == io_info->nclose);
-
- return 0;
-}
-
-/* Helper for evmap_check_integrity_: verify that all of the events pending
- * on given signal are set up correctly. */
-static int
-evmap_signal_check_integrity_fn(struct event_base *base,
- int signum, struct evmap_signal *sig_info, void *arg)
-{
- struct event *ev;
- /* First, make sure the list itself isn't corrupt. */
- EVUTIL_ASSERT_LIST_OK(&sig_info->events, event, ev_signal_next);
-
- LIST_FOREACH(ev, &sig_info->events, ev_io_next) {
- EVUTIL_ASSERT(ev->ev_flags & EVLIST_INSERTED);
- EVUTIL_ASSERT(ev->ev_fd == signum);
- EVUTIL_ASSERT((ev->ev_events & EV_SIGNAL));
- EVUTIL_ASSERT(!(ev->ev_events & (EV_READ|EV_WRITE|EV_CLOSED)));
+ EVUTIL_ASSERT(n_read == io_info->nread);
+ EVUTIL_ASSERT(n_write == io_info->nwrite);
+ EVUTIL_ASSERT(n_close == io_info->nclose);
+
+ return 0;
+}
+
+/* Helper for evmap_check_integrity_: verify that all of the events pending
+ * on given signal are set up correctly. */
+static int
+evmap_signal_check_integrity_fn(struct event_base *base,
+ int signum, struct evmap_signal *sig_info, void *arg)
+{
+ struct event *ev;
+ /* First, make sure the list itself isn't corrupt. */
+ EVUTIL_ASSERT_LIST_OK(&sig_info->events, event, ev_signal_next);
+
+ LIST_FOREACH(ev, &sig_info->events, ev_io_next) {
+ EVUTIL_ASSERT(ev->ev_flags & EVLIST_INSERTED);
+ EVUTIL_ASSERT(ev->ev_fd == signum);
+ EVUTIL_ASSERT((ev->ev_events & EV_SIGNAL));
+ EVUTIL_ASSERT(!(ev->ev_events & (EV_READ|EV_WRITE|EV_CLOSED)));
}
- return 0;
-}
-
-void
-evmap_check_integrity_(struct event_base *base)
-{
- evmap_io_foreach_fd(base, evmap_io_check_integrity_fn, NULL);
- evmap_signal_foreach_signal(base, evmap_signal_check_integrity_fn, NULL);
-
- if (base->evsel->add == event_changelist_add_)
- event_changelist_assert_ok(base);
-}
-
-/* Helper type for evmap_foreach_event_: Bundles a function to call on every
- * event, and the user-provided void* to use as its third argument. */
-struct evmap_foreach_event_helper {
- event_base_foreach_event_cb fn;
- void *arg;
-};
-
-/* Helper for evmap_foreach_event_: calls a provided function on every event
- * pending on a given fd. */
-static int
-evmap_io_foreach_event_fn(struct event_base *base, evutil_socket_t fd,
- struct evmap_io *io_info, void *arg)
-{
- struct evmap_foreach_event_helper *h = arg;
- struct event *ev;
- int r;
- LIST_FOREACH(ev, &io_info->events, ev_io_next) {
- if ((r = h->fn(base, ev, h->arg)))
- return r;
+ return 0;
+}
+
+void
+evmap_check_integrity_(struct event_base *base)
+{
+ evmap_io_foreach_fd(base, evmap_io_check_integrity_fn, NULL);
+ evmap_signal_foreach_signal(base, evmap_signal_check_integrity_fn, NULL);
+
+ if (base->evsel->add == event_changelist_add_)
+ event_changelist_assert_ok(base);
+}
+
+/* Helper type for evmap_foreach_event_: Bundles a function to call on every
+ * event, and the user-provided void* to use as its third argument. */
+struct evmap_foreach_event_helper {
+ event_base_foreach_event_cb fn;
+ void *arg;
+};
+
+/* Helper for evmap_foreach_event_: calls a provided function on every event
+ * pending on a given fd. */
+static int
+evmap_io_foreach_event_fn(struct event_base *base, evutil_socket_t fd,
+ struct evmap_io *io_info, void *arg)
+{
+ struct evmap_foreach_event_helper *h = arg;
+ struct event *ev;
+ int r;
+ LIST_FOREACH(ev, &io_info->events, ev_io_next) {
+ if ((r = h->fn(base, ev, h->arg)))
+ return r;
}
- return 0;
-}
-
-/* Helper for evmap_foreach_event_: calls a provided function on every event
- * pending on a given signal. */
-static int
-evmap_signal_foreach_event_fn(struct event_base *base, int signum,
- struct evmap_signal *sig_info, void *arg)
-{
- struct event *ev;
- struct evmap_foreach_event_helper *h = arg;
- int r;
- LIST_FOREACH(ev, &sig_info->events, ev_signal_next) {
- if ((r = h->fn(base, ev, h->arg)))
- return r;
+ return 0;
+}
+
+/* Helper for evmap_foreach_event_: calls a provided function on every event
+ * pending on a given signal. */
+static int
+evmap_signal_foreach_event_fn(struct event_base *base, int signum,
+ struct evmap_signal *sig_info, void *arg)
+{
+ struct event *ev;
+ struct evmap_foreach_event_helper *h = arg;
+ int r;
+ LIST_FOREACH(ev, &sig_info->events, ev_signal_next) {
+ if ((r = h->fn(base, ev, h->arg)))
+ return r;
}
- return 0;
-}
-
-int
-evmap_foreach_event_(struct event_base *base,
- event_base_foreach_event_cb fn, void *arg)
-{
- struct evmap_foreach_event_helper h;
- int r;
- h.fn = fn;
- h.arg = arg;
- if ((r = evmap_io_foreach_fd(base, evmap_io_foreach_event_fn, &h)))
- return r;
- return evmap_signal_foreach_signal(base, evmap_signal_foreach_event_fn, &h);
+ return 0;
+}
+
+int
+evmap_foreach_event_(struct event_base *base,
+ event_base_foreach_event_cb fn, void *arg)
+{
+ struct evmap_foreach_event_helper h;
+ int r;
+ h.fn = fn;
+ h.arg = arg;
+ if ((r = evmap_io_foreach_fd(base, evmap_io_foreach_event_fn, &h)))
+ return r;
+ return evmap_signal_foreach_signal(base, evmap_signal_foreach_event_fn, &h);
}
-
+
diff --git a/contrib/libs/libevent/evport.c b/contrib/libs/libevent/evport.c
index a014386bfe..f85539bd94 100644
--- a/contrib/libs/libevent/evport.c
+++ b/contrib/libs/libevent/evport.c
@@ -54,10 +54,10 @@
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
-
-#ifdef EVENT__HAVE_EVENT_PORTS
+#include "evconfig-private.h"
+#ifdef EVENT__HAVE_EVENT_PORTS
+
#include <sys/time.h>
#include <sys/queue.h>
#include <errno.h>
@@ -78,8 +78,8 @@
#include "evsignal-internal.h"
#include "evmap-internal.h"
-#define INITIAL_EVENTS_PER_GETN 8
-#define MAX_EVENTS_PER_GETN 4096
+#define INITIAL_EVENTS_PER_GETN 8
+#define MAX_EVENTS_PER_GETN 4096
/*
* Per-file-descriptor information about what events we're subscribed to. These
@@ -87,12 +87,12 @@
*/
struct fd_info {
- /* combinations of EV_READ and EV_WRITE */
- short fdi_what;
- /* Index of this fd within ed_pending, plus 1. Zero if this fd is
- * not in ed_pending. (The +1 is a hack so that memset(0) will set
- * it to a nil index. */
- int pending_idx_plus_1;
+ /* combinations of EV_READ and EV_WRITE */
+ short fdi_what;
+ /* Index of this fd within ed_pending, plus 1. Zero if this fd is
+ * not in ed_pending. (The +1 is a hack so that memset(0) will set
+ * it to a nil index. */
+ int pending_idx_plus_1;
};
#define FDI_HAS_READ(fdi) ((fdi)->fdi_what & EV_READ)
@@ -103,15 +103,15 @@ struct fd_info {
struct evport_data {
int ed_port; /* event port for system events */
- /* How many elements of ed_pending should we look at? */
- int ed_npending;
- /* How many elements are allocated in ed_pending and pevtlist? */
- int ed_maxevents;
+ /* How many elements of ed_pending should we look at? */
+ int ed_npending;
+ /* How many elements are allocated in ed_pending and pevtlist? */
+ int ed_maxevents;
/* fdi's that we need to reassoc */
- int *ed_pending;
- /* storage space for incoming events. */
- port_event_t *ed_pevtlist;
-
+ int *ed_pending;
+ /* storage space for incoming events. */
+ port_event_t *ed_pevtlist;
+
};
static void* evport_init(struct event_base *);
@@ -119,7 +119,7 @@ static int evport_add(struct event_base *, int fd, short old, short events, void
static int evport_del(struct event_base *, int fd, short old, short events, void *);
static int evport_dispatch(struct event_base *, struct timeval *);
static void evport_dealloc(struct event_base *);
-static int grow(struct evport_data *, int min_events);
+static int grow(struct evport_data *, int min_events);
const struct eventop evportops = {
"evport",
@@ -130,7 +130,7 @@ const struct eventop evportops = {
evport_dealloc,
1, /* need reinit */
0, /* features */
- sizeof(struct fd_info), /* fdinfo length */
+ sizeof(struct fd_info), /* fdinfo length */
};
/*
@@ -150,47 +150,47 @@ evport_init(struct event_base *base)
return (NULL);
}
- if (grow(evpd, INITIAL_EVENTS_PER_GETN) < 0) {
+ if (grow(evpd, INITIAL_EVENTS_PER_GETN) < 0) {
close(evpd->ed_port);
mm_free(evpd);
- return NULL;
+ return NULL;
}
-
- evpd->ed_npending = 0;
+
+ evpd->ed_npending = 0;
- evsig_init_(base);
+ evsig_init_(base);
return (evpd);
}
-static int
-grow(struct evport_data *data, int min_events)
-{
- int newsize;
- int *new_pending;
- port_event_t *new_pevtlist;
- if (data->ed_maxevents) {
- newsize = data->ed_maxevents;
- do {
- newsize *= 2;
- } while (newsize < min_events);
- } else {
- newsize = min_events;
- }
-
- new_pending = mm_realloc(data->ed_pending, sizeof(int)*newsize);
- if (new_pending == NULL)
- return -1;
- data->ed_pending = new_pending;
- new_pevtlist = mm_realloc(data->ed_pevtlist, sizeof(port_event_t)*newsize);
- if (new_pevtlist == NULL)
- return -1;
- data->ed_pevtlist = new_pevtlist;
-
- data->ed_maxevents = newsize;
- return 0;
-}
-
+static int
+grow(struct evport_data *data, int min_events)
+{
+ int newsize;
+ int *new_pending;
+ port_event_t *new_pevtlist;
+ if (data->ed_maxevents) {
+ newsize = data->ed_maxevents;
+ do {
+ newsize *= 2;
+ } while (newsize < min_events);
+ } else {
+ newsize = min_events;
+ }
+
+ new_pending = mm_realloc(data->ed_pending, sizeof(int)*newsize);
+ if (new_pending == NULL)
+ return -1;
+ data->ed_pending = new_pending;
+ new_pevtlist = mm_realloc(data->ed_pevtlist, sizeof(port_event_t)*newsize);
+ if (new_pevtlist == NULL)
+ return -1;
+ data->ed_pevtlist = new_pevtlist;
+
+ data->ed_maxevents = newsize;
+ return 0;
+}
+
#ifdef CHECK_INVARIANTS
/*
* Checks some basic properties about the evport_data structure. Because it
@@ -236,7 +236,7 @@ reassociate(struct evport_data *epdp, struct fd_info *fdip, int fd)
if (sysevents != 0) {
if (port_associate(epdp->ed_port, PORT_SOURCE_FD,
- fd, sysevents, fdip) == -1) {
+ fd, sysevents, fdip) == -1) {
event_warn("port_associate");
return (-1);
}
@@ -257,12 +257,12 @@ evport_dispatch(struct event_base *base, struct timeval *tv)
{
int i, res;
struct evport_data *epdp = base->evbase;
- port_event_t *pevtlist = epdp->ed_pevtlist;
+ port_event_t *pevtlist = epdp->ed_pevtlist;
/*
* port_getn will block until it has at least nevents events. It will
* also return how many it's given us (which may be more than we asked
- * for, as long as it's less than our maximum (ed_maxevents)) in
+ * for, as long as it's less than our maximum (ed_maxevents)) in
* nevents.
*/
int nevents = 1;
@@ -285,25 +285,25 @@ evport_dispatch(struct event_base *base, struct timeval *tv)
* last time which need reassociation. See comment at the end of the
* loop below.
*/
- for (i = 0; i < epdp->ed_npending; ++i) {
+ for (i = 0; i < epdp->ed_npending; ++i) {
struct fd_info *fdi = NULL;
- const int fd = epdp->ed_pending[i];
- if (fd != -1) {
- /* We might have cleared out this event; we need
- * to be sure that it's still set. */
- fdi = evmap_io_get_fdinfo_(&base->io, fd);
+ const int fd = epdp->ed_pending[i];
+ if (fd != -1) {
+ /* We might have cleared out this event; we need
+ * to be sure that it's still set. */
+ fdi = evmap_io_get_fdinfo_(&base->io, fd);
}
if (fdi != NULL && FDI_HAS_EVENTS(fdi)) {
reassociate(epdp, fdi, fd);
- /* epdp->ed_pending[i] = -1; */
- fdi->pending_idx_plus_1 = 0;
+ /* epdp->ed_pending[i] = -1; */
+ fdi->pending_idx_plus_1 = 0;
}
}
EVBASE_RELEASE_LOCK(base, th_base_lock);
- res = port_getn(epdp->ed_port, pevtlist, epdp->ed_maxevents,
+ res = port_getn(epdp->ed_port, pevtlist, epdp->ed_maxevents,
(unsigned int *) &nevents, ts_p);
EVBASE_ACQUIRE_LOCK(base, th_base_lock);
@@ -325,13 +325,13 @@ evport_dispatch(struct event_base *base, struct timeval *tv)
for (i = 0; i < nevents; ++i) {
port_event_t *pevt = &pevtlist[i];
int fd = (int) pevt->portev_object;
- struct fd_info *fdi = pevt->portev_user;
- /*EVUTIL_ASSERT(evmap_io_get_fdinfo_(&base->io, fd) == fdi);*/
+ struct fd_info *fdi = pevt->portev_user;
+ /*EVUTIL_ASSERT(evmap_io_get_fdinfo_(&base->io, fd) == fdi);*/
check_evportop(epdp);
check_event(pevt);
epdp->ed_pending[i] = fd;
- fdi->pending_idx_plus_1 = i + 1;
+ fdi->pending_idx_plus_1 = i + 1;
/*
* Figure out what kind of event it was
@@ -353,17 +353,17 @@ evport_dispatch(struct event_base *base, struct timeval *tv)
if (pevt->portev_events & (POLLERR|POLLHUP|POLLNVAL))
res |= EV_READ|EV_WRITE;
- evmap_io_active_(base, fd, res);
+ evmap_io_active_(base, fd, res);
} /* end of all events gotten */
- epdp->ed_npending = nevents;
-
- if (nevents == epdp->ed_maxevents &&
- epdp->ed_maxevents < MAX_EVENTS_PER_GETN) {
- /* we used all the space this time. We should be ready
- * for more events next time around. */
- grow(epdp, epdp->ed_maxevents * 2);
- }
-
+ epdp->ed_npending = nevents;
+
+ if (nevents == epdp->ed_maxevents &&
+ epdp->ed_maxevents < MAX_EVENTS_PER_GETN) {
+ /* we used all the space this time. We should be ready
+ * for more events next time around. */
+ grow(epdp, epdp->ed_maxevents * 2);
+ }
+
check_evportop(epdp);
return (0);
@@ -379,7 +379,7 @@ static int
evport_add(struct event_base *base, int fd, short old, short events, void *p)
{
struct evport_data *evpd = base->evbase;
- struct fd_info *fdi = p;
+ struct fd_info *fdi = p;
check_evportop(evpd);
@@ -396,12 +396,12 @@ static int
evport_del(struct event_base *base, int fd, short old, short events, void *p)
{
struct evport_data *evpd = base->evbase;
- struct fd_info *fdi = p;
- int associated = ! fdi->pending_idx_plus_1;
+ struct fd_info *fdi = p;
+ int associated = ! fdi->pending_idx_plus_1;
check_evportop(evpd);
- fdi->fdi_what &= ~(events &(EV_READ|EV_WRITE));
+ fdi->fdi_what &= ~(events &(EV_READ|EV_WRITE));
if (associated) {
if (!FDI_HAS_EVENTS(fdi) &&
@@ -421,10 +421,10 @@ evport_del(struct event_base *base, int fd, short old, short events, void *p)
}
} else {
if ((fdi->fdi_what & (EV_READ|EV_WRITE)) == 0) {
- const int i = fdi->pending_idx_plus_1 - 1;
- EVUTIL_ASSERT(evpd->ed_pending[i] == fd);
+ const int i = fdi->pending_idx_plus_1 - 1;
+ EVUTIL_ASSERT(evpd->ed_pending[i] == fd);
evpd->ed_pending[i] = -1;
- fdi->pending_idx_plus_1 = 0;
+ fdi->pending_idx_plus_1 = 0;
}
}
return 0;
@@ -436,16 +436,16 @@ evport_dealloc(struct event_base *base)
{
struct evport_data *evpd = base->evbase;
- evsig_dealloc_(base);
+ evsig_dealloc_(base);
close(evpd->ed_port);
- if (evpd->ed_pending)
- mm_free(evpd->ed_pending);
- if (evpd->ed_pevtlist)
- mm_free(evpd->ed_pevtlist);
-
+ if (evpd->ed_pending)
+ mm_free(evpd->ed_pending);
+ if (evpd->ed_pevtlist)
+ mm_free(evpd->ed_pevtlist);
+
mm_free(evpd);
}
-
-#endif /* EVENT__HAVE_EVENT_PORTS */
+
+#endif /* EVENT__HAVE_EVENT_PORTS */
diff --git a/contrib/libs/libevent/evrpc-internal.h b/contrib/libs/libevent/evrpc-internal.h
index 9eb376386d..5af3aa6a98 100644
--- a/contrib/libs/libevent/evrpc-internal.h
+++ b/contrib/libs/libevent/evrpc-internal.h
@@ -24,10 +24,10 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVRPC_INTERNAL_H_INCLUDED_
-#define EVRPC_INTERNAL_H_INCLUDED_
+#ifndef EVRPC_INTERNAL_H_INCLUDED_
+#define EVRPC_INTERNAL_H_INCLUDED_
-#include "event2/http.h"
+#include "event2/http.h"
#include "http-internal.h"
struct evrpc;
@@ -57,7 +57,7 @@ TAILQ_HEAD(evrpc_hook_list, evrpc_hook);
struct evrpc_hook_ctx;
TAILQ_HEAD(evrpc_pause_list, evrpc_hook_ctx);
-struct evrpc_hooks_ {
+struct evrpc_hooks_ {
/* hooks for processing outbound and inbound rpcs */
struct evrpc_hook_list in_hooks;
struct evrpc_hook_list out_hooks;
@@ -70,7 +70,7 @@ struct evrpc_hooks_ {
#define paused_requests common.pause_requests
struct evrpc_base {
- struct evrpc_hooks_ common;
+ struct evrpc_hooks_ common;
/* the HTTP server under which we register our RPC calls */
struct evhttp* http_server;
@@ -80,11 +80,11 @@ struct evrpc_base {
};
struct evrpc_req_generic;
-void evrpc_reqstate_free_(struct evrpc_req_generic* rpc_state);
+void evrpc_reqstate_free_(struct evrpc_req_generic* rpc_state);
/* A pool for holding evhttp_connection objects */
struct evrpc_pool {
- struct evrpc_hooks_ common;
+ struct evrpc_hooks_ common;
struct event_base *base;
@@ -118,14 +118,14 @@ struct evrpc_hook_meta {
};
/* allows association of meta data with a request */
-static void evrpc_hook_associate_meta_(struct evrpc_hook_meta **pctx,
+static void evrpc_hook_associate_meta_(struct evrpc_hook_meta **pctx,
struct evhttp_connection *evcon);
/* creates a new meta data store */
-static struct evrpc_hook_meta *evrpc_hook_meta_new_(void);
+static struct evrpc_hook_meta *evrpc_hook_meta_new_(void);
/* frees the meta data associated with a request */
-static void evrpc_hook_context_free_(struct evrpc_hook_meta *ctx);
+static void evrpc_hook_context_free_(struct evrpc_hook_meta *ctx);
/* the server side of an rpc */
@@ -202,4 +202,4 @@ struct evrpc_request_wrapper {
int (*reply_unmarshal)(void *, struct evbuffer*);
};
-#endif /* EVRPC_INTERNAL_H_INCLUDED_ */
+#endif /* EVRPC_INTERNAL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/evrpc.c b/contrib/libs/libevent/evrpc.c
index 4a60ca5f07..979d3bdf32 100644
--- a/contrib/libs/libevent/evrpc.c
+++ b/contrib/libs/libevent/evrpc.c
@@ -25,9 +25,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
-#ifdef _WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
@@ -35,16 +35,16 @@
#endif
#include <sys/types.h>
-#ifndef _WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <sys/queue.h>
#include <stdio.h>
#include <stdlib.h>
-#ifndef _WIN32
+#ifndef _WIN32
#include <unistd.h>
#endif
#include <errno.h>
@@ -122,7 +122,7 @@ evrpc_add_hook(void *vbase,
int (*cb)(void *, struct evhttp_request *, struct evbuffer *, void *),
void *cb_arg)
{
- struct evrpc_hooks_ *base = vbase;
+ struct evrpc_hooks_ *base = vbase;
struct evrpc_hook_list *head = NULL;
struct evrpc_hook *hook = NULL;
switch (hook_type) {
@@ -168,7 +168,7 @@ evrpc_remove_hook_internal(struct evrpc_hook_list *head, void *handle)
int
evrpc_remove_hook(void *vbase, enum EVRPC_HOOK_TYPE hook_type, void *handle)
{
- struct evrpc_hooks_ *base = vbase;
+ struct evrpc_hooks_ *base = vbase;
struct evrpc_hook_list *head = NULL;
switch (hook_type) {
case EVRPC_INPUT:
@@ -302,7 +302,7 @@ evrpc_request_cb(struct evhttp_request *req, void *arg)
if (TAILQ_FIRST(&rpc->base->input_hooks) != NULL) {
int hook_res;
- evrpc_hook_associate_meta_(&rpc_state->hook_meta, req->evcon);
+ evrpc_hook_associate_meta_(&rpc_state->hook_meta, req->evcon);
/*
* allow hooks to modify the outgoing request
@@ -329,8 +329,8 @@ evrpc_request_cb(struct evhttp_request *req, void *arg)
return;
error:
- if (rpc_state)
- evrpc_reqstate_free_(rpc_state);
+ if (rpc_state)
+ evrpc_reqstate_free_(rpc_state);
evhttp_send_error(req, HTTP_SERVUNAVAIL, NULL);
return;
}
@@ -372,14 +372,14 @@ evrpc_request_cb_closure(void *arg, enum EVRPC_HOOK_RESULT hook_res)
return;
error:
- evrpc_reqstate_free_(rpc_state);
+ evrpc_reqstate_free_(rpc_state);
evhttp_send_error(req, HTTP_SERVUNAVAIL, NULL);
return;
}
void
-evrpc_reqstate_free_(struct evrpc_req_generic* rpc_state)
+evrpc_reqstate_free_(struct evrpc_req_generic* rpc_state)
{
struct evrpc *rpc;
EVUTIL_ASSERT(rpc_state != NULL);
@@ -387,7 +387,7 @@ evrpc_reqstate_free_(struct evrpc_req_generic* rpc_state)
/* clean up all memory */
if (rpc_state->hook_meta != NULL)
- evrpc_hook_context_free_(rpc_state->hook_meta);
+ evrpc_hook_context_free_(rpc_state->hook_meta);
if (rpc_state->request != NULL)
rpc->request_free(rpc_state->request);
if (rpc_state->reply != NULL)
@@ -427,7 +427,7 @@ evrpc_request_done(struct evrpc_req_generic *rpc_state)
if (TAILQ_FIRST(&rpc->base->output_hooks) != NULL) {
int hook_res;
- evrpc_hook_associate_meta_(&rpc_state->hook_meta, req->evcon);
+ evrpc_hook_associate_meta_(&rpc_state->hook_meta, req->evcon);
/* do hook based tweaks to the request */
hook_res = evrpc_process_hooks(&rpc->base->output_hooks,
@@ -453,7 +453,7 @@ evrpc_request_done(struct evrpc_req_generic *rpc_state)
return;
error:
- evrpc_reqstate_free_(rpc_state);
+ evrpc_reqstate_free_(rpc_state);
evhttp_send_error(req, HTTP_SERVUNAVAIL, NULL);
return;
}
@@ -488,12 +488,12 @@ evrpc_request_done_closure(void *arg, enum EVRPC_HOOK_RESULT hook_res)
}
evhttp_send_reply(req, HTTP_OK, "OK", rpc_state->rpc_data);
- evrpc_reqstate_free_(rpc_state);
+ evrpc_reqstate_free_(rpc_state);
return;
error:
- evrpc_reqstate_free_(rpc_state);
+ evrpc_reqstate_free_(rpc_state);
evhttp_send_error(req, HTTP_SERVUNAVAIL, NULL);
return;
}
@@ -529,7 +529,7 @@ static void
evrpc_request_wrapper_free(struct evrpc_request_wrapper *request)
{
if (request->hook_meta != NULL)
- evrpc_hook_context_free_(request->hook_meta);
+ evrpc_hook_context_free_(request->hook_meta);
mm_free(request->name);
mm_free(request);
}
@@ -593,8 +593,8 @@ evrpc_pool_add_connection(struct evrpc_pool *pool,
* unless a timeout was specifically set for a connection,
* the connection inherits the timeout from the pool.
*/
- if (!evutil_timerisset(&connection->timeout))
- evhttp_connection_set_timeout(connection, pool->timeout);
+ if (!evutil_timerisset(&connection->timeout))
+ evhttp_connection_set_timeout(connection, pool->timeout);
/*
* if we have any requests pending, schedule them with the new
@@ -621,7 +621,7 @@ evrpc_pool_set_timeout(struct evrpc_pool *pool, int timeout_in_secs)
{
struct evhttp_connection *evcon;
TAILQ_FOREACH(evcon, &pool->connections, next) {
- evhttp_connection_set_timeout(evcon, timeout_in_secs);
+ evhttp_connection_set_timeout(evcon, timeout_in_secs);
}
pool->timeout = timeout_in_secs;
}
@@ -678,7 +678,7 @@ evrpc_schedule_request(struct evhttp_connection *connection,
if (TAILQ_FIRST(&pool->output_hooks) != NULL) {
int hook_res;
- evrpc_hook_associate_meta_(&ctx->hook_meta, connection);
+ evrpc_hook_associate_meta_(&ctx->hook_meta, connection);
/* apply hooks to the outgoing request */
hook_res = evrpc_process_hooks(&pool->output_hooks,
@@ -763,7 +763,7 @@ static int
evrpc_pause_request(void *vbase, void *ctx,
void (*cb)(void *, enum EVRPC_HOOK_RESULT))
{
- struct evrpc_hooks_ *base = vbase;
+ struct evrpc_hooks_ *base = vbase;
struct evrpc_hook_ctx *pause = mm_malloc(sizeof(*pause));
if (pause == NULL)
return (-1);
@@ -778,7 +778,7 @@ evrpc_pause_request(void *vbase, void *ctx,
int
evrpc_resume_request(void *vbase, void *ctx, enum EVRPC_HOOK_RESULT res)
{
- struct evrpc_hooks_ *base = vbase;
+ struct evrpc_hooks_ *base = vbase;
struct evrpc_pause_list *head = &base->pause_requests;
struct evrpc_hook_ctx *pause;
@@ -875,7 +875,7 @@ evrpc_reply_done(struct evhttp_request *req, void *arg)
}
if (TAILQ_FIRST(&pool->input_hooks) != NULL) {
- evrpc_hook_associate_meta_(&ctx->hook_meta, ctx->evcon);
+ evrpc_hook_associate_meta_(&ctx->hook_meta, ctx->evcon);
/* apply hooks to the incoming request */
hook_res = evrpc_process_hooks(&pool->input_hooks,
@@ -892,7 +892,7 @@ evrpc_reply_done(struct evhttp_request *req, void *arg)
* layer is going to free it. we need to
* request ownership explicitly
*/
- evhttp_request_own(req);
+ evhttp_request_own(req);
evrpc_pause_request(pool, ctx,
evrpc_reply_done_closure);
@@ -973,7 +973,7 @@ evrpc_request_timeout(evutil_socket_t fd, short what, void *arg)
struct evhttp_connection *evcon = ctx->evcon;
EVUTIL_ASSERT(evcon != NULL);
- evhttp_connection_fail_(evcon, EVREQ_HTTP_TIMEOUT);
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_TIMEOUT);
}
/*
@@ -995,7 +995,7 @@ evrpc_meta_data_free(struct evrpc_meta_list *meta_data)
}
static struct evrpc_hook_meta *
-evrpc_hook_meta_new_(void)
+evrpc_hook_meta_new_(void)
{
struct evrpc_hook_meta *ctx;
ctx = mm_malloc(sizeof(struct evrpc_hook_meta));
@@ -1008,17 +1008,17 @@ evrpc_hook_meta_new_(void)
}
static void
-evrpc_hook_associate_meta_(struct evrpc_hook_meta **pctx,
+evrpc_hook_associate_meta_(struct evrpc_hook_meta **pctx,
struct evhttp_connection *evcon)
{
struct evrpc_hook_meta *ctx = *pctx;
if (ctx == NULL)
- *pctx = ctx = evrpc_hook_meta_new_();
+ *pctx = ctx = evrpc_hook_meta_new_();
ctx->evcon = evcon;
}
static void
-evrpc_hook_context_free_(struct evrpc_hook_meta *ctx)
+evrpc_hook_context_free_(struct evrpc_hook_meta *ctx)
{
evrpc_meta_data_free(&ctx->meta_data);
mm_free(ctx);
@@ -1034,7 +1034,7 @@ evrpc_hook_add_meta(void *ctx, const char *key,
struct evrpc_meta *meta = NULL;
if ((store = req->hook_meta) == NULL)
- store = req->hook_meta = evrpc_hook_meta_new_();
+ store = req->hook_meta = evrpc_hook_meta_new_();
meta = mm_malloc(sizeof(struct evrpc_meta));
EVUTIL_ASSERT(meta != NULL);
diff --git a/contrib/libs/libevent/evsignal-internal.h b/contrib/libs/libevent/evsignal-internal.h
index 5cff03b525..05e8e024f2 100644
--- a/contrib/libs/libevent/evsignal-internal.h
+++ b/contrib/libs/libevent/evsignal-internal.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVSIGNAL_INTERNAL_H_INCLUDED_
-#define EVSIGNAL_INTERNAL_H_INCLUDED_
+#ifndef EVSIGNAL_INTERNAL_H_INCLUDED_
+#define EVSIGNAL_INTERNAL_H_INCLUDED_
#ifndef evutil_socket_t
#include "event2/util.h"
@@ -48,7 +48,7 @@ struct evsig_info {
/* Array of previous signal handler objects before Libevent started
* messing with them. Used to restore old signal handlers. */
-#ifdef EVENT__HAVE_SIGACTION
+#ifdef EVENT__HAVE_SIGACTION
struct sigaction **sh_old;
#else
ev_sighandler_t **sh_old;
@@ -56,10 +56,10 @@ struct evsig_info {
/* Size of sh_old. */
int sh_old_max;
};
-int evsig_init_(struct event_base *);
-void evsig_dealloc_(struct event_base *);
+int evsig_init_(struct event_base *);
+void evsig_dealloc_(struct event_base *);
-void evsig_set_base_(struct event_base *base);
-void evsig_free_globals_(void);
+void evsig_set_base_(struct event_base *base);
+void evsig_free_globals_(void);
-#endif /* EVSIGNAL_INTERNAL_H_INCLUDED_ */
+#endif /* EVSIGNAL_INTERNAL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/evthread-internal.h b/contrib/libs/libevent/evthread-internal.h
index 83e409f09b..e5c19fa928 100644
--- a/contrib/libs/libevent/evthread-internal.h
+++ b/contrib/libs/libevent/evthread-internal.h
@@ -23,16 +23,16 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVTHREAD_INTERNAL_H_INCLUDED_
-#define EVTHREAD_INTERNAL_H_INCLUDED_
+#ifndef EVTHREAD_INTERNAL_H_INCLUDED_
+#define EVTHREAD_INTERNAL_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
#endif
-#include "event2/event-config.h"
-#include "evconfig-private.h"
-
+#include "event2/event-config.h"
+#include "evconfig-private.h"
+
#include "event2/thread.h"
#include "util-internal.h"
@@ -46,65 +46,65 @@ struct event_base;
#define EVTHREAD_EXPOSE_STRUCTS
#endif
-#if ! defined(EVENT__DISABLE_THREAD_SUPPORT) && defined(EVTHREAD_EXPOSE_STRUCTS)
+#if ! defined(EVENT__DISABLE_THREAD_SUPPORT) && defined(EVTHREAD_EXPOSE_STRUCTS)
/* Global function pointers to lock-related functions. NULL if locking isn't
enabled. */
-EVENT2_EXPORT_SYMBOL
-extern struct evthread_lock_callbacks evthread_lock_fns_;
-EVENT2_EXPORT_SYMBOL
-extern struct evthread_condition_callbacks evthread_cond_fns_;
-extern unsigned long (*evthread_id_fn_)(void);
-EVENT2_EXPORT_SYMBOL
-extern int evthread_lock_debugging_enabled_;
+EVENT2_EXPORT_SYMBOL
+extern struct evthread_lock_callbacks evthread_lock_fns_;
+EVENT2_EXPORT_SYMBOL
+extern struct evthread_condition_callbacks evthread_cond_fns_;
+extern unsigned long (*evthread_id_fn_)(void);
+EVENT2_EXPORT_SYMBOL
+extern int evthread_lock_debugging_enabled_;
/** Return the ID of the current thread, or 1 if threading isn't enabled. */
#define EVTHREAD_GET_ID() \
- (evthread_id_fn_ ? evthread_id_fn_() : 1)
+ (evthread_id_fn_ ? evthread_id_fn_() : 1)
/** Return true iff we're in the thread that is currently (or most recently)
* running a given event_base's loop. Requires lock. */
#define EVBASE_IN_THREAD(base) \
- (evthread_id_fn_ == NULL || \
- (base)->th_owner_id == evthread_id_fn_())
+ (evthread_id_fn_ == NULL || \
+ (base)->th_owner_id == evthread_id_fn_())
/** Return true iff we need to notify the base's main thread about changes to
* its state, because it's currently running the main loop in another
* thread. Requires lock. */
#define EVBASE_NEED_NOTIFY(base) \
- (evthread_id_fn_ != NULL && \
+ (evthread_id_fn_ != NULL && \
(base)->running_loop && \
- (base)->th_owner_id != evthread_id_fn_())
+ (base)->th_owner_id != evthread_id_fn_())
/** Allocate a new lock, and store it in lockvar, a void*. Sets lockvar to
NULL if locking is not enabled. */
#define EVTHREAD_ALLOC_LOCK(lockvar, locktype) \
- ((lockvar) = evthread_lock_fns_.alloc ? \
- evthread_lock_fns_.alloc(locktype) : NULL)
+ ((lockvar) = evthread_lock_fns_.alloc ? \
+ evthread_lock_fns_.alloc(locktype) : NULL)
/** Free a given lock, if it is present and locking is enabled. */
#define EVTHREAD_FREE_LOCK(lockvar, locktype) \
do { \
- void *lock_tmp_ = (lockvar); \
- if (lock_tmp_ && evthread_lock_fns_.free) \
- evthread_lock_fns_.free(lock_tmp_, (locktype)); \
+ void *lock_tmp_ = (lockvar); \
+ if (lock_tmp_ && evthread_lock_fns_.free) \
+ evthread_lock_fns_.free(lock_tmp_, (locktype)); \
} while (0)
/** Acquire a lock. */
#define EVLOCK_LOCK(lockvar,mode) \
do { \
if (lockvar) \
- evthread_lock_fns_.lock(mode, lockvar); \
+ evthread_lock_fns_.lock(mode, lockvar); \
} while (0)
/** Release a lock */
#define EVLOCK_UNLOCK(lockvar,mode) \
do { \
if (lockvar) \
- evthread_lock_fns_.unlock(mode, lockvar); \
+ evthread_lock_fns_.unlock(mode, lockvar); \
} while (0)
/** Helper: put lockvar1 and lockvar2 into pointerwise ascending order. */
-#define EVLOCK_SORTLOCKS_(lockvar1, lockvar2) \
+#define EVLOCK_SORTLOCKS_(lockvar1, lockvar2) \
do { \
if (lockvar1 && lockvar2 && lockvar1 > lockvar2) { \
void *tmp = lockvar1; \
@@ -128,19 +128,19 @@ extern int evthread_lock_debugging_enabled_;
* locked and held by us. */
#define EVLOCK_ASSERT_LOCKED(lock) \
do { \
- if ((lock) && evthread_lock_debugging_enabled_) { \
- EVUTIL_ASSERT(evthread_is_debug_lock_held_(lock)); \
+ if ((lock) && evthread_lock_debugging_enabled_) { \
+ EVUTIL_ASSERT(evthread_is_debug_lock_held_(lock)); \
} \
} while (0)
/** Try to grab the lock for 'lockvar' without blocking, and return 1 if we
* manage to get it. */
-static inline int EVLOCK_TRY_LOCK_(void *lock);
+static inline int EVLOCK_TRY_LOCK_(void *lock);
static inline int
-EVLOCK_TRY_LOCK_(void *lock)
+EVLOCK_TRY_LOCK_(void *lock)
{
- if (lock && evthread_lock_fns_.lock) {
- int r = evthread_lock_fns_.lock(EVTHREAD_TRY, lock);
+ if (lock && evthread_lock_fns_.lock) {
+ int r = evthread_lock_fns_.lock(EVTHREAD_TRY, lock);
return !r;
} else {
/* Locking is disabled either globally or for this thing;
@@ -152,88 +152,88 @@ EVLOCK_TRY_LOCK_(void *lock)
/** Allocate a new condition variable and store it in the void *, condvar */
#define EVTHREAD_ALLOC_COND(condvar) \
do { \
- (condvar) = evthread_cond_fns_.alloc_condition ? \
- evthread_cond_fns_.alloc_condition(0) : NULL; \
+ (condvar) = evthread_cond_fns_.alloc_condition ? \
+ evthread_cond_fns_.alloc_condition(0) : NULL; \
} while (0)
/** Deallocate and free a condition variable in condvar */
#define EVTHREAD_FREE_COND(cond) \
do { \
if (cond) \
- evthread_cond_fns_.free_condition((cond)); \
+ evthread_cond_fns_.free_condition((cond)); \
} while (0)
/** Signal one thread waiting on cond */
#define EVTHREAD_COND_SIGNAL(cond) \
- ( (cond) ? evthread_cond_fns_.signal_condition((cond), 0) : 0 )
+ ( (cond) ? evthread_cond_fns_.signal_condition((cond), 0) : 0 )
/** Signal all threads waiting on cond */
#define EVTHREAD_COND_BROADCAST(cond) \
- ( (cond) ? evthread_cond_fns_.signal_condition((cond), 1) : 0 )
+ ( (cond) ? evthread_cond_fns_.signal_condition((cond), 1) : 0 )
/** Wait until the condition 'cond' is signalled. Must be called while
* holding 'lock'. The lock will be released until the condition is
* signalled, at which point it will be acquired again. Returns 0 for
* success, -1 for failure. */
#define EVTHREAD_COND_WAIT(cond, lock) \
- ( (cond) ? evthread_cond_fns_.wait_condition((cond), (lock), NULL) : 0 )
+ ( (cond) ? evthread_cond_fns_.wait_condition((cond), (lock), NULL) : 0 )
/** As EVTHREAD_COND_WAIT, but gives up after 'tv' has elapsed. Returns 1
* on timeout. */
#define EVTHREAD_COND_WAIT_TIMED(cond, lock, tv) \
- ( (cond) ? evthread_cond_fns_.wait_condition((cond), (lock), (tv)) : 0 )
+ ( (cond) ? evthread_cond_fns_.wait_condition((cond), (lock), (tv)) : 0 )
/** True iff locking functions have been configured. */
#define EVTHREAD_LOCKING_ENABLED() \
- (evthread_lock_fns_.lock != NULL)
-
-#elif ! defined(EVENT__DISABLE_THREAD_SUPPORT)
-
-unsigned long evthreadimpl_get_id_(void);
-EVENT2_EXPORT_SYMBOL
-int evthreadimpl_is_lock_debugging_enabled_(void);
-EVENT2_EXPORT_SYMBOL
-void *evthreadimpl_lock_alloc_(unsigned locktype);
-EVENT2_EXPORT_SYMBOL
-void evthreadimpl_lock_free_(void *lock, unsigned locktype);
-EVENT2_EXPORT_SYMBOL
-int evthreadimpl_lock_lock_(unsigned mode, void *lock);
-EVENT2_EXPORT_SYMBOL
-int evthreadimpl_lock_unlock_(unsigned mode, void *lock);
-EVENT2_EXPORT_SYMBOL
-void *evthreadimpl_cond_alloc_(unsigned condtype);
-EVENT2_EXPORT_SYMBOL
-void evthreadimpl_cond_free_(void *cond);
-EVENT2_EXPORT_SYMBOL
-int evthreadimpl_cond_signal_(void *cond, int broadcast);
-EVENT2_EXPORT_SYMBOL
-int evthreadimpl_cond_wait_(void *cond, void *lock, const struct timeval *tv);
-int evthreadimpl_locking_enabled_(void);
-
-#define EVTHREAD_GET_ID() evthreadimpl_get_id_()
+ (evthread_lock_fns_.lock != NULL)
+
+#elif ! defined(EVENT__DISABLE_THREAD_SUPPORT)
+
+unsigned long evthreadimpl_get_id_(void);
+EVENT2_EXPORT_SYMBOL
+int evthreadimpl_is_lock_debugging_enabled_(void);
+EVENT2_EXPORT_SYMBOL
+void *evthreadimpl_lock_alloc_(unsigned locktype);
+EVENT2_EXPORT_SYMBOL
+void evthreadimpl_lock_free_(void *lock, unsigned locktype);
+EVENT2_EXPORT_SYMBOL
+int evthreadimpl_lock_lock_(unsigned mode, void *lock);
+EVENT2_EXPORT_SYMBOL
+int evthreadimpl_lock_unlock_(unsigned mode, void *lock);
+EVENT2_EXPORT_SYMBOL
+void *evthreadimpl_cond_alloc_(unsigned condtype);
+EVENT2_EXPORT_SYMBOL
+void evthreadimpl_cond_free_(void *cond);
+EVENT2_EXPORT_SYMBOL
+int evthreadimpl_cond_signal_(void *cond, int broadcast);
+EVENT2_EXPORT_SYMBOL
+int evthreadimpl_cond_wait_(void *cond, void *lock, const struct timeval *tv);
+int evthreadimpl_locking_enabled_(void);
+
+#define EVTHREAD_GET_ID() evthreadimpl_get_id_()
#define EVBASE_IN_THREAD(base) \
- ((base)->th_owner_id == evthreadimpl_get_id_())
+ ((base)->th_owner_id == evthreadimpl_get_id_())
#define EVBASE_NEED_NOTIFY(base) \
((base)->running_loop && \
- ((base)->th_owner_id != evthreadimpl_get_id_()))
+ ((base)->th_owner_id != evthreadimpl_get_id_()))
#define EVTHREAD_ALLOC_LOCK(lockvar, locktype) \
- ((lockvar) = evthreadimpl_lock_alloc_(locktype))
+ ((lockvar) = evthreadimpl_lock_alloc_(locktype))
#define EVTHREAD_FREE_LOCK(lockvar, locktype) \
do { \
- void *lock_tmp_ = (lockvar); \
- if (lock_tmp_) \
- evthreadimpl_lock_free_(lock_tmp_, (locktype)); \
+ void *lock_tmp_ = (lockvar); \
+ if (lock_tmp_) \
+ evthreadimpl_lock_free_(lock_tmp_, (locktype)); \
} while (0)
/** Acquire a lock. */
#define EVLOCK_LOCK(lockvar,mode) \
do { \
if (lockvar) \
- evthreadimpl_lock_lock_(mode, lockvar); \
+ evthreadimpl_lock_lock_(mode, lockvar); \
} while (0)
/** Release a lock */
#define EVLOCK_UNLOCK(lockvar,mode) \
do { \
if (lockvar) \
- evthreadimpl_lock_unlock_(mode, lockvar); \
+ evthreadimpl_lock_unlock_(mode, lockvar); \
} while (0)
/** Lock an event_base, if it is set up for locking. Acquires the lock
@@ -251,19 +251,19 @@ int evthreadimpl_locking_enabled_(void);
* locked and held by us. */
#define EVLOCK_ASSERT_LOCKED(lock) \
do { \
- if ((lock) && evthreadimpl_is_lock_debugging_enabled_()) { \
- EVUTIL_ASSERT(evthread_is_debug_lock_held_(lock)); \
+ if ((lock) && evthreadimpl_is_lock_debugging_enabled_()) { \
+ EVUTIL_ASSERT(evthread_is_debug_lock_held_(lock)); \
} \
} while (0)
/** Try to grab the lock for 'lockvar' without blocking, and return 1 if we
* manage to get it. */
-static inline int EVLOCK_TRY_LOCK_(void *lock);
+static inline int EVLOCK_TRY_LOCK_(void *lock);
static inline int
-EVLOCK_TRY_LOCK_(void *lock)
+EVLOCK_TRY_LOCK_(void *lock)
{
if (lock) {
- int r = evthreadimpl_lock_lock_(EVTHREAD_TRY, lock);
+ int r = evthreadimpl_lock_lock_(EVTHREAD_TRY, lock);
return !r;
} else {
/* Locking is disabled either globally or for this thing;
@@ -275,68 +275,68 @@ EVLOCK_TRY_LOCK_(void *lock)
/** Allocate a new condition variable and store it in the void *, condvar */
#define EVTHREAD_ALLOC_COND(condvar) \
do { \
- (condvar) = evthreadimpl_cond_alloc_(0); \
+ (condvar) = evthreadimpl_cond_alloc_(0); \
} while (0)
/** Deallocate and free a condition variable in condvar */
#define EVTHREAD_FREE_COND(cond) \
do { \
if (cond) \
- evthreadimpl_cond_free_((cond)); \
+ evthreadimpl_cond_free_((cond)); \
} while (0)
/** Signal one thread waiting on cond */
#define EVTHREAD_COND_SIGNAL(cond) \
- ( (cond) ? evthreadimpl_cond_signal_((cond), 0) : 0 )
+ ( (cond) ? evthreadimpl_cond_signal_((cond), 0) : 0 )
/** Signal all threads waiting on cond */
#define EVTHREAD_COND_BROADCAST(cond) \
- ( (cond) ? evthreadimpl_cond_signal_((cond), 1) : 0 )
+ ( (cond) ? evthreadimpl_cond_signal_((cond), 1) : 0 )
/** Wait until the condition 'cond' is signalled. Must be called while
* holding 'lock'. The lock will be released until the condition is
* signalled, at which point it will be acquired again. Returns 0 for
* success, -1 for failure. */
#define EVTHREAD_COND_WAIT(cond, lock) \
- ( (cond) ? evthreadimpl_cond_wait_((cond), (lock), NULL) : 0 )
+ ( (cond) ? evthreadimpl_cond_wait_((cond), (lock), NULL) : 0 )
/** As EVTHREAD_COND_WAIT, but gives up after 'tv' has elapsed. Returns 1
* on timeout. */
#define EVTHREAD_COND_WAIT_TIMED(cond, lock, tv) \
- ( (cond) ? evthreadimpl_cond_wait_((cond), (lock), (tv)) : 0 )
+ ( (cond) ? evthreadimpl_cond_wait_((cond), (lock), (tv)) : 0 )
#define EVTHREAD_LOCKING_ENABLED() \
- (evthreadimpl_locking_enabled_())
+ (evthreadimpl_locking_enabled_())
-#else /* EVENT__DISABLE_THREAD_SUPPORT */
+#else /* EVENT__DISABLE_THREAD_SUPPORT */
#define EVTHREAD_GET_ID() 1
-#define EVTHREAD_ALLOC_LOCK(lockvar, locktype) EVUTIL_NIL_STMT_
-#define EVTHREAD_FREE_LOCK(lockvar, locktype) EVUTIL_NIL_STMT_
+#define EVTHREAD_ALLOC_LOCK(lockvar, locktype) EVUTIL_NIL_STMT_
+#define EVTHREAD_FREE_LOCK(lockvar, locktype) EVUTIL_NIL_STMT_
-#define EVLOCK_LOCK(lockvar, mode) EVUTIL_NIL_STMT_
-#define EVLOCK_UNLOCK(lockvar, mode) EVUTIL_NIL_STMT_
-#define EVLOCK_LOCK2(lock1,lock2,mode1,mode2) EVUTIL_NIL_STMT_
-#define EVLOCK_UNLOCK2(lock1,lock2,mode1,mode2) EVUTIL_NIL_STMT_
+#define EVLOCK_LOCK(lockvar, mode) EVUTIL_NIL_STMT_
+#define EVLOCK_UNLOCK(lockvar, mode) EVUTIL_NIL_STMT_
+#define EVLOCK_LOCK2(lock1,lock2,mode1,mode2) EVUTIL_NIL_STMT_
+#define EVLOCK_UNLOCK2(lock1,lock2,mode1,mode2) EVUTIL_NIL_STMT_
#define EVBASE_IN_THREAD(base) 1
#define EVBASE_NEED_NOTIFY(base) 0
-#define EVBASE_ACQUIRE_LOCK(base, lock) EVUTIL_NIL_STMT_
-#define EVBASE_RELEASE_LOCK(base, lock) EVUTIL_NIL_STMT_
-#define EVLOCK_ASSERT_LOCKED(lock) EVUTIL_NIL_STMT_
+#define EVBASE_ACQUIRE_LOCK(base, lock) EVUTIL_NIL_STMT_
+#define EVBASE_RELEASE_LOCK(base, lock) EVUTIL_NIL_STMT_
+#define EVLOCK_ASSERT_LOCKED(lock) EVUTIL_NIL_STMT_
-#define EVLOCK_TRY_LOCK_(lock) 1
+#define EVLOCK_TRY_LOCK_(lock) 1
-#define EVTHREAD_ALLOC_COND(condvar) EVUTIL_NIL_STMT_
-#define EVTHREAD_FREE_COND(cond) EVUTIL_NIL_STMT_
-#define EVTHREAD_COND_SIGNAL(cond) EVUTIL_NIL_STMT_
-#define EVTHREAD_COND_BROADCAST(cond) EVUTIL_NIL_STMT_
-#define EVTHREAD_COND_WAIT(cond, lock) EVUTIL_NIL_STMT_
-#define EVTHREAD_COND_WAIT_TIMED(cond, lock, howlong) EVUTIL_NIL_STMT_
+#define EVTHREAD_ALLOC_COND(condvar) EVUTIL_NIL_STMT_
+#define EVTHREAD_FREE_COND(cond) EVUTIL_NIL_STMT_
+#define EVTHREAD_COND_SIGNAL(cond) EVUTIL_NIL_STMT_
+#define EVTHREAD_COND_BROADCAST(cond) EVUTIL_NIL_STMT_
+#define EVTHREAD_COND_WAIT(cond, lock) EVUTIL_NIL_STMT_
+#define EVTHREAD_COND_WAIT_TIMED(cond, lock, howlong) EVUTIL_NIL_STMT_
#define EVTHREAD_LOCKING_ENABLED() 0
#endif
/* This code is shared between both lock impls */
-#if ! defined(EVENT__DISABLE_THREAD_SUPPORT)
+#if ! defined(EVENT__DISABLE_THREAD_SUPPORT)
/** Helper: put lockvar1 and lockvar2 into pointerwise ascending order. */
-#define EVLOCK_SORTLOCKS_(lockvar1, lockvar2) \
+#define EVLOCK_SORTLOCKS_(lockvar1, lockvar2) \
do { \
if (lockvar1 && lockvar2 && lockvar1 > lockvar2) { \
void *tmp = lockvar1; \
@@ -349,27 +349,27 @@ EVLOCK_TRY_LOCK_(void *lock)
* so that two threads locking two locks with LOCK2 will not deadlock. */
#define EVLOCK_LOCK2(lock1,lock2,mode1,mode2) \
do { \
- void *lock1_tmplock_ = (lock1); \
- void *lock2_tmplock_ = (lock2); \
- EVLOCK_SORTLOCKS_(lock1_tmplock_,lock2_tmplock_); \
- EVLOCK_LOCK(lock1_tmplock_,mode1); \
- if (lock2_tmplock_ != lock1_tmplock_) \
- EVLOCK_LOCK(lock2_tmplock_,mode2); \
+ void *lock1_tmplock_ = (lock1); \
+ void *lock2_tmplock_ = (lock2); \
+ EVLOCK_SORTLOCKS_(lock1_tmplock_,lock2_tmplock_); \
+ EVLOCK_LOCK(lock1_tmplock_,mode1); \
+ if (lock2_tmplock_ != lock1_tmplock_) \
+ EVLOCK_LOCK(lock2_tmplock_,mode2); \
} while (0)
/** Release both lock1 and lock2. */
#define EVLOCK_UNLOCK2(lock1,lock2,mode1,mode2) \
do { \
- void *lock1_tmplock_ = (lock1); \
- void *lock2_tmplock_ = (lock2); \
- EVLOCK_SORTLOCKS_(lock1_tmplock_,lock2_tmplock_); \
- if (lock2_tmplock_ != lock1_tmplock_) \
- EVLOCK_UNLOCK(lock2_tmplock_,mode2); \
- EVLOCK_UNLOCK(lock1_tmplock_,mode1); \
+ void *lock1_tmplock_ = (lock1); \
+ void *lock2_tmplock_ = (lock2); \
+ EVLOCK_SORTLOCKS_(lock1_tmplock_,lock2_tmplock_); \
+ if (lock2_tmplock_ != lock1_tmplock_) \
+ EVLOCK_UNLOCK(lock2_tmplock_,mode2); \
+ EVLOCK_UNLOCK(lock1_tmplock_,mode1); \
} while (0)
-EVENT2_EXPORT_SYMBOL
-int evthread_is_debug_lock_held_(void *lock);
-void *evthread_debug_get_real_lock_(void *lock);
+EVENT2_EXPORT_SYMBOL
+int evthread_is_debug_lock_held_(void *lock);
+void *evthread_debug_get_real_lock_(void *lock);
void *evthread_setup_global_lock_(void *lock_, unsigned locktype,
int enable_locks);
@@ -386,21 +386,21 @@ void *evthread_setup_global_lock_(void *lock_, unsigned locktype,
int event_global_setup_locks_(const int enable_locks);
int evsig_global_setup_locks_(const int enable_locks);
-int evutil_global_setup_locks_(const int enable_locks);
+int evutil_global_setup_locks_(const int enable_locks);
int evutil_secure_rng_global_setup_locks_(const int enable_locks);
-/** Return current evthread_lock_callbacks */
-EVENT2_EXPORT_SYMBOL
-struct evthread_lock_callbacks *evthread_get_lock_callbacks(void);
-/** Return current evthread_condition_callbacks */
-struct evthread_condition_callbacks *evthread_get_condition_callbacks(void);
-/** Disable locking for internal usage (like global shutdown) */
-void evthreadimpl_disable_lock_debugging_(void);
-
+/** Return current evthread_lock_callbacks */
+EVENT2_EXPORT_SYMBOL
+struct evthread_lock_callbacks *evthread_get_lock_callbacks(void);
+/** Return current evthread_condition_callbacks */
+struct evthread_condition_callbacks *evthread_get_condition_callbacks(void);
+/** Disable locking for internal usage (like global shutdown) */
+void evthreadimpl_disable_lock_debugging_(void);
+
#endif
#ifdef __cplusplus
}
#endif
-#endif /* EVTHREAD_INTERNAL_H_INCLUDED_ */
+#endif /* EVTHREAD_INTERNAL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/evthread.c b/contrib/libs/libevent/evthread.c
index 3eac594d64..594cf288d6 100644
--- a/contrib/libs/libevent/evthread.c
+++ b/contrib/libs/libevent/evthread.c
@@ -25,9 +25,9 @@
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
#include "event2/thread.h"
@@ -45,68 +45,68 @@
#define GLOBAL static
#endif
-#ifndef EVENT__DISABLE_DEBUG_MODE
-extern int event_debug_created_threadable_ctx_;
-extern int event_debug_mode_on_;
-#endif
-
+#ifndef EVENT__DISABLE_DEBUG_MODE
+extern int event_debug_created_threadable_ctx_;
+extern int event_debug_mode_on_;
+#endif
+
/* globals */
-GLOBAL int evthread_lock_debugging_enabled_ = 0;
-GLOBAL struct evthread_lock_callbacks evthread_lock_fns_ = {
+GLOBAL int evthread_lock_debugging_enabled_ = 0;
+GLOBAL struct evthread_lock_callbacks evthread_lock_fns_ = {
0, 0, NULL, NULL, NULL, NULL
};
-GLOBAL unsigned long (*evthread_id_fn_)(void) = NULL;
-GLOBAL struct evthread_condition_callbacks evthread_cond_fns_ = {
+GLOBAL unsigned long (*evthread_id_fn_)(void) = NULL;
+GLOBAL struct evthread_condition_callbacks evthread_cond_fns_ = {
0, NULL, NULL, NULL, NULL
};
/* Used for debugging */
-static struct evthread_lock_callbacks original_lock_fns_ = {
+static struct evthread_lock_callbacks original_lock_fns_ = {
0, 0, NULL, NULL, NULL, NULL
};
-static struct evthread_condition_callbacks original_cond_fns_ = {
+static struct evthread_condition_callbacks original_cond_fns_ = {
0, NULL, NULL, NULL, NULL
};
void
evthread_set_id_callback(unsigned long (*id_fn)(void))
{
- evthread_id_fn_ = id_fn;
-}
-
-struct evthread_lock_callbacks *evthread_get_lock_callbacks()
-{
- return evthread_lock_debugging_enabled_
- ? &original_lock_fns_ : &evthread_lock_fns_;
-}
-struct evthread_condition_callbacks *evthread_get_condition_callbacks()
-{
- return evthread_lock_debugging_enabled_
- ? &original_cond_fns_ : &evthread_cond_fns_;
-}
-void evthreadimpl_disable_lock_debugging_(void)
-{
- evthread_lock_debugging_enabled_ = 0;
+ evthread_id_fn_ = id_fn;
}
+struct evthread_lock_callbacks *evthread_get_lock_callbacks()
+{
+ return evthread_lock_debugging_enabled_
+ ? &original_lock_fns_ : &evthread_lock_fns_;
+}
+struct evthread_condition_callbacks *evthread_get_condition_callbacks()
+{
+ return evthread_lock_debugging_enabled_
+ ? &original_cond_fns_ : &evthread_cond_fns_;
+}
+void evthreadimpl_disable_lock_debugging_(void)
+{
+ evthread_lock_debugging_enabled_ = 0;
+}
+
int
evthread_set_lock_callbacks(const struct evthread_lock_callbacks *cbs)
{
- struct evthread_lock_callbacks *target = evthread_get_lock_callbacks();
-
-#ifndef EVENT__DISABLE_DEBUG_MODE
- if (event_debug_mode_on_) {
- if (event_debug_created_threadable_ctx_) {
- event_errx(1, "evthread initialization must be called BEFORE anything else!");
- }
- }
-#endif
-
+ struct evthread_lock_callbacks *target = evthread_get_lock_callbacks();
+
+#ifndef EVENT__DISABLE_DEBUG_MODE
+ if (event_debug_mode_on_) {
+ if (event_debug_created_threadable_ctx_) {
+ event_errx(1, "evthread initialization must be called BEFORE anything else!");
+ }
+ }
+#endif
+
if (!cbs) {
if (target->alloc)
event_warnx("Trying to disable lock functions after "
"they have been set up will probaby not work.");
- memset(target, 0, sizeof(evthread_lock_fns_));
+ memset(target, 0, sizeof(evthread_lock_fns_));
return 0;
}
if (target->alloc) {
@@ -125,7 +125,7 @@ evthread_set_lock_callbacks(const struct evthread_lock_callbacks *cbs)
return -1;
}
if (cbs->alloc && cbs->free && cbs->lock && cbs->unlock) {
- memcpy(target, cbs, sizeof(evthread_lock_fns_));
+ memcpy(target, cbs, sizeof(evthread_lock_fns_));
return event_global_setup_locks_(1);
} else {
return -1;
@@ -135,22 +135,22 @@ evthread_set_lock_callbacks(const struct evthread_lock_callbacks *cbs)
int
evthread_set_condition_callbacks(const struct evthread_condition_callbacks *cbs)
{
- struct evthread_condition_callbacks *target = evthread_get_condition_callbacks();
-
-#ifndef EVENT__DISABLE_DEBUG_MODE
- if (event_debug_mode_on_) {
- if (event_debug_created_threadable_ctx_) {
- event_errx(1, "evthread initialization must be called BEFORE anything else!");
- }
- }
-#endif
-
+ struct evthread_condition_callbacks *target = evthread_get_condition_callbacks();
+
+#ifndef EVENT__DISABLE_DEBUG_MODE
+ if (event_debug_mode_on_) {
+ if (event_debug_created_threadable_ctx_) {
+ event_errx(1, "evthread initialization must be called BEFORE anything else!");
+ }
+ }
+#endif
+
if (!cbs) {
if (target->alloc_condition)
event_warnx("Trying to disable condition functions "
"after they have been set up will probaby not "
"work.");
- memset(target, 0, sizeof(evthread_cond_fns_));
+ memset(target, 0, sizeof(evthread_cond_fns_));
return 0;
}
if (target->alloc_condition) {
@@ -169,20 +169,20 @@ evthread_set_condition_callbacks(const struct evthread_condition_callbacks *cbs)
}
if (cbs->alloc_condition && cbs->free_condition &&
cbs->signal_condition && cbs->wait_condition) {
- memcpy(target, cbs, sizeof(evthread_cond_fns_));
+ memcpy(target, cbs, sizeof(evthread_cond_fns_));
}
- if (evthread_lock_debugging_enabled_) {
- evthread_cond_fns_.alloc_condition = cbs->alloc_condition;
- evthread_cond_fns_.free_condition = cbs->free_condition;
- evthread_cond_fns_.signal_condition = cbs->signal_condition;
+ if (evthread_lock_debugging_enabled_) {
+ evthread_cond_fns_.alloc_condition = cbs->alloc_condition;
+ evthread_cond_fns_.free_condition = cbs->free_condition;
+ evthread_cond_fns_.signal_condition = cbs->signal_condition;
}
return 0;
}
-#define DEBUG_LOCK_SIG 0xdeb0b10c
-
+#define DEBUG_LOCK_SIG 0xdeb0b10c
+
struct debug_lock {
- unsigned signature;
+ unsigned signature;
unsigned locktype;
unsigned long held_by;
/* XXXX if we ever use read-write locks, we will need a separate
@@ -197,8 +197,8 @@ debug_lock_alloc(unsigned locktype)
struct debug_lock *result = mm_malloc(sizeof(struct debug_lock));
if (!result)
return NULL;
- if (original_lock_fns_.alloc) {
- if (!(result->lock = original_lock_fns_.alloc(
+ if (original_lock_fns_.alloc) {
+ if (!(result->lock = original_lock_fns_.alloc(
locktype|EVTHREAD_LOCKTYPE_RECURSIVE))) {
mm_free(result);
return NULL;
@@ -206,7 +206,7 @@ debug_lock_alloc(unsigned locktype)
} else {
result->lock = NULL;
}
- result->signature = DEBUG_LOCK_SIG;
+ result->signature = DEBUG_LOCK_SIG;
result->locktype = locktype;
result->count = 0;
result->held_by = 0;
@@ -219,27 +219,27 @@ debug_lock_free(void *lock_, unsigned locktype)
struct debug_lock *lock = lock_;
EVUTIL_ASSERT(lock->count == 0);
EVUTIL_ASSERT(locktype == lock->locktype);
- EVUTIL_ASSERT(DEBUG_LOCK_SIG == lock->signature);
- if (original_lock_fns_.free) {
- original_lock_fns_.free(lock->lock,
+ EVUTIL_ASSERT(DEBUG_LOCK_SIG == lock->signature);
+ if (original_lock_fns_.free) {
+ original_lock_fns_.free(lock->lock,
lock->locktype|EVTHREAD_LOCKTYPE_RECURSIVE);
}
lock->lock = NULL;
lock->count = -100;
- lock->signature = 0x12300fda;
+ lock->signature = 0x12300fda;
mm_free(lock);
}
static void
evthread_debug_lock_mark_locked(unsigned mode, struct debug_lock *lock)
{
- EVUTIL_ASSERT(DEBUG_LOCK_SIG == lock->signature);
+ EVUTIL_ASSERT(DEBUG_LOCK_SIG == lock->signature);
++lock->count;
if (!(lock->locktype & EVTHREAD_LOCKTYPE_RECURSIVE))
EVUTIL_ASSERT(lock->count == 1);
- if (evthread_id_fn_) {
+ if (evthread_id_fn_) {
unsigned long me;
- me = evthread_id_fn_();
+ me = evthread_id_fn_();
if (lock->count > 1)
EVUTIL_ASSERT(lock->held_by == me);
lock->held_by = me;
@@ -255,8 +255,8 @@ debug_lock_lock(unsigned mode, void *lock_)
EVUTIL_ASSERT(mode & (EVTHREAD_READ|EVTHREAD_WRITE));
else
EVUTIL_ASSERT((mode & (EVTHREAD_READ|EVTHREAD_WRITE)) == 0);
- if (original_lock_fns_.lock)
- res = original_lock_fns_.lock(mode, lock->lock);
+ if (original_lock_fns_.lock)
+ res = original_lock_fns_.lock(mode, lock->lock);
if (!res) {
evthread_debug_lock_mark_locked(mode, lock);
}
@@ -266,15 +266,15 @@ debug_lock_lock(unsigned mode, void *lock_)
static void
evthread_debug_lock_mark_unlocked(unsigned mode, struct debug_lock *lock)
{
- EVUTIL_ASSERT(DEBUG_LOCK_SIG == lock->signature);
+ EVUTIL_ASSERT(DEBUG_LOCK_SIG == lock->signature);
if (lock->locktype & EVTHREAD_LOCKTYPE_READWRITE)
EVUTIL_ASSERT(mode & (EVTHREAD_READ|EVTHREAD_WRITE));
else
EVUTIL_ASSERT((mode & (EVTHREAD_READ|EVTHREAD_WRITE)) == 0);
- if (evthread_id_fn_) {
- unsigned long me;
- me = evthread_id_fn_();
- EVUTIL_ASSERT(lock->held_by == me);
+ if (evthread_id_fn_) {
+ unsigned long me;
+ me = evthread_id_fn_();
+ EVUTIL_ASSERT(lock->held_by == me);
if (lock->count == 1)
lock->held_by = 0;
}
@@ -288,35 +288,35 @@ debug_lock_unlock(unsigned mode, void *lock_)
struct debug_lock *lock = lock_;
int res = 0;
evthread_debug_lock_mark_unlocked(mode, lock);
- if (original_lock_fns_.unlock)
- res = original_lock_fns_.unlock(mode, lock->lock);
+ if (original_lock_fns_.unlock)
+ res = original_lock_fns_.unlock(mode, lock->lock);
return res;
}
static int
-debug_cond_wait(void *cond_, void *lock_, const struct timeval *tv)
+debug_cond_wait(void *cond_, void *lock_, const struct timeval *tv)
{
int r;
- struct debug_lock *lock = lock_;
+ struct debug_lock *lock = lock_;
EVUTIL_ASSERT(lock);
- EVUTIL_ASSERT(DEBUG_LOCK_SIG == lock->signature);
- EVLOCK_ASSERT_LOCKED(lock_);
+ EVUTIL_ASSERT(DEBUG_LOCK_SIG == lock->signature);
+ EVLOCK_ASSERT_LOCKED(lock_);
evthread_debug_lock_mark_unlocked(0, lock);
- r = original_cond_fns_.wait_condition(cond_, lock->lock, tv);
+ r = original_cond_fns_.wait_condition(cond_, lock->lock, tv);
evthread_debug_lock_mark_locked(0, lock);
return r;
}
-/* misspelled version for backward compatibility */
+/* misspelled version for backward compatibility */
void
evthread_enable_lock_debuging(void)
{
- evthread_enable_lock_debugging();
-}
-
-void
-evthread_enable_lock_debugging(void)
-{
+ evthread_enable_lock_debugging();
+}
+
+void
+evthread_enable_lock_debugging(void)
+{
struct evthread_lock_callbacks cbs = {
EVTHREAD_LOCK_API_VERSION,
EVTHREAD_LOCKTYPE_RECURSIVE,
@@ -325,30 +325,30 @@ evthread_enable_lock_debugging(void)
debug_lock_lock,
debug_lock_unlock
};
- if (evthread_lock_debugging_enabled_)
+ if (evthread_lock_debugging_enabled_)
return;
- memcpy(&original_lock_fns_, &evthread_lock_fns_,
+ memcpy(&original_lock_fns_, &evthread_lock_fns_,
sizeof(struct evthread_lock_callbacks));
- memcpy(&evthread_lock_fns_, &cbs,
+ memcpy(&evthread_lock_fns_, &cbs,
sizeof(struct evthread_lock_callbacks));
- memcpy(&original_cond_fns_, &evthread_cond_fns_,
+ memcpy(&original_cond_fns_, &evthread_cond_fns_,
sizeof(struct evthread_condition_callbacks));
- evthread_cond_fns_.wait_condition = debug_cond_wait;
- evthread_lock_debugging_enabled_ = 1;
+ evthread_cond_fns_.wait_condition = debug_cond_wait;
+ evthread_lock_debugging_enabled_ = 1;
/* XXX return value should get checked. */
event_global_setup_locks_(0);
}
int
-evthread_is_debug_lock_held_(void *lock_)
+evthread_is_debug_lock_held_(void *lock_)
{
struct debug_lock *lock = lock_;
if (! lock->count)
return 0;
- if (evthread_id_fn_) {
- unsigned long me = evthread_id_fn_();
+ if (evthread_id_fn_) {
+ unsigned long me = evthread_id_fn_();
if (lock->held_by != me)
return 0;
}
@@ -356,7 +356,7 @@ evthread_is_debug_lock_held_(void *lock_)
}
void *
-evthread_debug_get_real_lock_(void *lock_)
+evthread_debug_get_real_lock_(void *lock_)
{
struct debug_lock *lock = lock_;
return lock->lock;
@@ -371,23 +371,23 @@ evthread_setup_global_lock_(void *lock_, unsigned locktype, int enable_locks)
3) we're turning on locking; debugging is not on.
4) we're turning on locking; debugging is on. */
- if (!enable_locks && original_lock_fns_.alloc == NULL) {
+ if (!enable_locks && original_lock_fns_.alloc == NULL) {
/* Case 1: allocate a debug lock. */
EVUTIL_ASSERT(lock_ == NULL);
return debug_lock_alloc(locktype);
- } else if (!enable_locks && original_lock_fns_.alloc != NULL) {
+ } else if (!enable_locks && original_lock_fns_.alloc != NULL) {
/* Case 2: wrap the lock in a debug lock. */
struct debug_lock *lock;
EVUTIL_ASSERT(lock_ != NULL);
if (!(locktype & EVTHREAD_LOCKTYPE_RECURSIVE)) {
/* We can't wrap it: We need a recursive lock */
- original_lock_fns_.free(lock_, locktype);
+ original_lock_fns_.free(lock_, locktype);
return debug_lock_alloc(locktype);
}
lock = mm_malloc(sizeof(struct debug_lock));
if (!lock) {
- original_lock_fns_.free(lock_, locktype);
+ original_lock_fns_.free(lock_, locktype);
return NULL;
}
lock->lock = lock_;
@@ -395,24 +395,24 @@ evthread_setup_global_lock_(void *lock_, unsigned locktype, int enable_locks)
lock->count = 0;
lock->held_by = 0;
return lock;
- } else if (enable_locks && ! evthread_lock_debugging_enabled_) {
+ } else if (enable_locks && ! evthread_lock_debugging_enabled_) {
/* Case 3: allocate a regular lock */
EVUTIL_ASSERT(lock_ == NULL);
- return evthread_lock_fns_.alloc(locktype);
+ return evthread_lock_fns_.alloc(locktype);
} else {
/* Case 4: Fill in a debug lock with a real lock */
- struct debug_lock *lock = lock_ ? lock_ : debug_lock_alloc(locktype);
+ struct debug_lock *lock = lock_ ? lock_ : debug_lock_alloc(locktype);
EVUTIL_ASSERT(enable_locks &&
- evthread_lock_debugging_enabled_);
+ evthread_lock_debugging_enabled_);
EVUTIL_ASSERT(lock->locktype == locktype);
if (!lock->lock) {
- lock->lock = original_lock_fns_.alloc(
- locktype|EVTHREAD_LOCKTYPE_RECURSIVE);
- if (!lock->lock) {
- lock->count = -200;
- mm_free(lock);
- return NULL;
- }
+ lock->lock = original_lock_fns_.alloc(
+ locktype|EVTHREAD_LOCKTYPE_RECURSIVE);
+ if (!lock->lock) {
+ lock->count = -200;
+ mm_free(lock);
+ return NULL;
+ }
}
return lock;
}
@@ -421,88 +421,88 @@ evthread_setup_global_lock_(void *lock_, unsigned locktype, int enable_locks)
#ifndef EVTHREAD_EXPOSE_STRUCTS
unsigned long
-evthreadimpl_get_id_()
+evthreadimpl_get_id_()
{
- return evthread_id_fn_ ? evthread_id_fn_() : 1;
+ return evthread_id_fn_ ? evthread_id_fn_() : 1;
}
void *
-evthreadimpl_lock_alloc_(unsigned locktype)
+evthreadimpl_lock_alloc_(unsigned locktype)
{
-#ifndef EVENT__DISABLE_DEBUG_MODE
- if (event_debug_mode_on_) {
- event_debug_created_threadable_ctx_ = 1;
- }
-#endif
-
- return evthread_lock_fns_.alloc ?
- evthread_lock_fns_.alloc(locktype) : NULL;
+#ifndef EVENT__DISABLE_DEBUG_MODE
+ if (event_debug_mode_on_) {
+ event_debug_created_threadable_ctx_ = 1;
+ }
+#endif
+
+ return evthread_lock_fns_.alloc ?
+ evthread_lock_fns_.alloc(locktype) : NULL;
}
void
-evthreadimpl_lock_free_(void *lock, unsigned locktype)
+evthreadimpl_lock_free_(void *lock, unsigned locktype)
{
- if (evthread_lock_fns_.free)
- evthread_lock_fns_.free(lock, locktype);
+ if (evthread_lock_fns_.free)
+ evthread_lock_fns_.free(lock, locktype);
}
int
-evthreadimpl_lock_lock_(unsigned mode, void *lock)
+evthreadimpl_lock_lock_(unsigned mode, void *lock)
{
- if (evthread_lock_fns_.lock)
- return evthread_lock_fns_.lock(mode, lock);
+ if (evthread_lock_fns_.lock)
+ return evthread_lock_fns_.lock(mode, lock);
else
return 0;
}
int
-evthreadimpl_lock_unlock_(unsigned mode, void *lock)
+evthreadimpl_lock_unlock_(unsigned mode, void *lock)
{
- if (evthread_lock_fns_.unlock)
- return evthread_lock_fns_.unlock(mode, lock);
+ if (evthread_lock_fns_.unlock)
+ return evthread_lock_fns_.unlock(mode, lock);
else
return 0;
}
void *
-evthreadimpl_cond_alloc_(unsigned condtype)
+evthreadimpl_cond_alloc_(unsigned condtype)
{
-#ifndef EVENT__DISABLE_DEBUG_MODE
- if (event_debug_mode_on_) {
- event_debug_created_threadable_ctx_ = 1;
- }
-#endif
-
- return evthread_cond_fns_.alloc_condition ?
- evthread_cond_fns_.alloc_condition(condtype) : NULL;
+#ifndef EVENT__DISABLE_DEBUG_MODE
+ if (event_debug_mode_on_) {
+ event_debug_created_threadable_ctx_ = 1;
+ }
+#endif
+
+ return evthread_cond_fns_.alloc_condition ?
+ evthread_cond_fns_.alloc_condition(condtype) : NULL;
}
void
-evthreadimpl_cond_free_(void *cond)
+evthreadimpl_cond_free_(void *cond)
{
- if (evthread_cond_fns_.free_condition)
- evthread_cond_fns_.free_condition(cond);
+ if (evthread_cond_fns_.free_condition)
+ evthread_cond_fns_.free_condition(cond);
}
int
-evthreadimpl_cond_signal_(void *cond, int broadcast)
+evthreadimpl_cond_signal_(void *cond, int broadcast)
{
- if (evthread_cond_fns_.signal_condition)
- return evthread_cond_fns_.signal_condition(cond, broadcast);
+ if (evthread_cond_fns_.signal_condition)
+ return evthread_cond_fns_.signal_condition(cond, broadcast);
else
return 0;
}
int
-evthreadimpl_cond_wait_(void *cond, void *lock, const struct timeval *tv)
+evthreadimpl_cond_wait_(void *cond, void *lock, const struct timeval *tv)
{
- if (evthread_cond_fns_.wait_condition)
- return evthread_cond_fns_.wait_condition(cond, lock, tv);
+ if (evthread_cond_fns_.wait_condition)
+ return evthread_cond_fns_.wait_condition(cond, lock, tv);
else
return 0;
}
int
-evthreadimpl_is_lock_debugging_enabled_(void)
+evthreadimpl_is_lock_debugging_enabled_(void)
{
- return evthread_lock_debugging_enabled_;
+ return evthread_lock_debugging_enabled_;
}
int
-evthreadimpl_locking_enabled_(void)
+evthreadimpl_locking_enabled_(void)
{
- return evthread_lock_fns_.lock != NULL;
+ return evthread_lock_fns_.lock != NULL;
}
#endif
diff --git a/contrib/libs/libevent/evthread_pthread.c b/contrib/libs/libevent/evthread_pthread.c
index 4e11f74970..ffab3eb03e 100644
--- a/contrib/libs/libevent/evthread_pthread.c
+++ b/contrib/libs/libevent/evthread_pthread.c
@@ -24,11 +24,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
-/* With glibc we need to define _GNU_SOURCE to get PTHREAD_MUTEX_RECURSIVE.
- * This comes from evconfig-private.h
- */
+/* With glibc we need to define _GNU_SOURCE to get PTHREAD_MUTEX_RECURSIVE.
+ * This comes from evconfig-private.h
+ */
#include <pthread.h>
struct event_base;
@@ -58,17 +58,17 @@ evthread_posix_lock_alloc(unsigned locktype)
}
static void
-evthread_posix_lock_free(void *lock_, unsigned locktype)
+evthread_posix_lock_free(void *lock_, unsigned locktype)
{
- pthread_mutex_t *lock = lock_;
+ pthread_mutex_t *lock = lock_;
pthread_mutex_destroy(lock);
mm_free(lock);
}
static int
-evthread_posix_lock(unsigned mode, void *lock_)
+evthread_posix_lock(unsigned mode, void *lock_)
{
- pthread_mutex_t *lock = lock_;
+ pthread_mutex_t *lock = lock_;
if (mode & EVTHREAD_TRY)
return pthread_mutex_trylock(lock);
else
@@ -76,9 +76,9 @@ evthread_posix_lock(unsigned mode, void *lock_)
}
static int
-evthread_posix_unlock(unsigned mode, void *lock_)
+evthread_posix_unlock(unsigned mode, void *lock_)
{
- pthread_mutex_t *lock = lock_;
+ pthread_mutex_t *lock = lock_;
return pthread_mutex_unlock(lock);
}
@@ -87,13 +87,13 @@ evthread_posix_get_id(void)
{
union {
pthread_t thr;
-#if EVENT__SIZEOF_PTHREAD_T > EVENT__SIZEOF_LONG
+#if EVENT__SIZEOF_PTHREAD_T > EVENT__SIZEOF_LONG
ev_uint64_t id;
#else
unsigned long id;
#endif
} r;
-#if EVENT__SIZEOF_PTHREAD_T < EVENT__SIZEOF_LONG
+#if EVENT__SIZEOF_PTHREAD_T < EVENT__SIZEOF_LONG
memset(&r, 0, sizeof(r));
#endif
r.thr = pthread_self();
@@ -114,17 +114,17 @@ evthread_posix_cond_alloc(unsigned condflags)
}
static void
-evthread_posix_cond_free(void *cond_)
+evthread_posix_cond_free(void *cond_)
{
- pthread_cond_t *cond = cond_;
+ pthread_cond_t *cond = cond_;
pthread_cond_destroy(cond);
mm_free(cond);
}
static int
-evthread_posix_cond_signal(void *cond_, int broadcast)
+evthread_posix_cond_signal(void *cond_, int broadcast)
{
- pthread_cond_t *cond = cond_;
+ pthread_cond_t *cond = cond_;
int r;
if (broadcast)
r = pthread_cond_broadcast(cond);
@@ -134,11 +134,11 @@ evthread_posix_cond_signal(void *cond_, int broadcast)
}
static int
-evthread_posix_cond_wait(void *cond_, void *lock_, const struct timeval *tv)
+evthread_posix_cond_wait(void *cond_, void *lock_, const struct timeval *tv)
{
int r;
- pthread_cond_t *cond = cond_;
- pthread_mutex_t *lock = lock_;
+ pthread_cond_t *cond = cond_;
+ pthread_mutex_t *lock = lock_;
if (tv) {
struct timeval now, abstime;
diff --git a/contrib/libs/libevent/evthread_win32.c b/contrib/libs/libevent/evthread_win32.c
index 2ec80560a5..913eccbd95 100644
--- a/contrib/libs/libevent/evthread_win32.c
+++ b/contrib/libs/libevent/evthread_win32.c
@@ -24,9 +24,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
-#ifdef _WIN32
+#ifdef _WIN32
#ifndef _WIN32_WINNT
/* Minimum required for InitializeCriticalSectionAndSpinCount */
#define _WIN32_WINNT 0x0403
@@ -43,7 +43,7 @@ struct event_base;
#include "mm-internal.h"
#include "evthread-internal.h"
-#include "time-internal.h"
+#include "time-internal.h"
#define SPIN_COUNT 2000
@@ -61,17 +61,17 @@ evthread_win32_lock_create(unsigned locktype)
}
static void
-evthread_win32_lock_free(void *lock_, unsigned locktype)
+evthread_win32_lock_free(void *lock_, unsigned locktype)
{
- CRITICAL_SECTION *lock = lock_;
+ CRITICAL_SECTION *lock = lock_;
DeleteCriticalSection(lock);
mm_free(lock);
}
static int
-evthread_win32_lock(unsigned mode, void *lock_)
+evthread_win32_lock(unsigned mode, void *lock_)
{
- CRITICAL_SECTION *lock = lock_;
+ CRITICAL_SECTION *lock = lock_;
if ((mode & EVTHREAD_TRY)) {
return ! TryEnterCriticalSection(lock);
} else {
@@ -81,9 +81,9 @@ evthread_win32_lock(unsigned mode, void *lock_)
}
static int
-evthread_win32_unlock(unsigned mode, void *lock_)
+evthread_win32_unlock(unsigned mode, void *lock_)
{
- CRITICAL_SECTION *lock = lock_;
+ CRITICAL_SECTION *lock = lock_;
LeaveCriticalSection(lock);
return 0;
}
@@ -135,17 +135,17 @@ evthread_win32_condvar_alloc(unsigned condflags)
}
static void
-evthread_win32_condvar_free(void *cond_)
+evthread_win32_condvar_free(void *cond_)
{
- CONDITION_VARIABLE *cond = cond_;
+ CONDITION_VARIABLE *cond = cond_;
/* There doesn't _seem_ to be a cleaup fn here... */
mm_free(cond);
}
static int
-evthread_win32_condvar_signal(void *cond, int broadcast)
+evthread_win32_condvar_signal(void *cond, int broadcast)
{
- CONDITION_VARIABLE *cond = cond_;
+ CONDITION_VARIABLE *cond = cond_;
if (broadcast)
WakeAllConditionVariable_fn(cond);
else
@@ -154,15 +154,15 @@ evthread_win32_condvar_signal(void *cond, int broadcast)
}
static int
-evthread_win32_condvar_wait(void *cond_, void *lock_, const struct timeval *tv)
+evthread_win32_condvar_wait(void *cond_, void *lock_, const struct timeval *tv)
{
- CONDITION_VARIABLE *cond = cond_;
- CRITICAL_SECTION *lock = lock_;
+ CONDITION_VARIABLE *cond = cond_;
+ CRITICAL_SECTION *lock = lock_;
DWORD ms, err;
BOOL result;
if (tv)
- ms = evutil_tv_to_msec_(tv);
+ ms = evutil_tv_to_msec_(tv);
else
ms = INFINITE;
result = SleepConditionVariableCS_fn(cond, lock, ms);
@@ -206,18 +206,18 @@ evthread_win32_cond_alloc(unsigned flags)
}
static void
-evthread_win32_cond_free(void *cond_)
+evthread_win32_cond_free(void *cond_)
{
- struct evthread_win32_cond *cond = cond_;
+ struct evthread_win32_cond *cond = cond_;
DeleteCriticalSection(&cond->lock);
CloseHandle(cond->event);
mm_free(cond);
}
static int
-evthread_win32_cond_signal(void *cond_, int broadcast)
+evthread_win32_cond_signal(void *cond_, int broadcast)
{
- struct evthread_win32_cond *cond = cond_;
+ struct evthread_win32_cond *cond = cond_;
EnterCriticalSection(&cond->lock);
if (broadcast)
cond->n_to_wake = cond->n_waiting;
@@ -230,16 +230,16 @@ evthread_win32_cond_signal(void *cond_, int broadcast)
}
static int
-evthread_win32_cond_wait(void *cond_, void *lock_, const struct timeval *tv)
+evthread_win32_cond_wait(void *cond_, void *lock_, const struct timeval *tv)
{
- struct evthread_win32_cond *cond = cond_;
- CRITICAL_SECTION *lock = lock_;
+ struct evthread_win32_cond *cond = cond_;
+ CRITICAL_SECTION *lock = lock_;
int generation_at_start;
int waiting = 1;
int result = -1;
DWORD ms = INFINITE, ms_orig = INFINITE, startTime, endTime;
if (tv)
- ms_orig = ms = evutil_tv_to_msec_(tv);
+ ms_orig = ms = evutil_tv_to_msec_(tv);
EnterCriticalSection(&cond->lock);
++cond->n_waiting;
diff --git a/contrib/libs/libevent/evutil.c b/contrib/libs/libevent/evutil.c
index 9976e79beb..598134ec61 100644
--- a/contrib/libs/libevent/evutil.c
+++ b/contrib/libs/libevent/evutil.c
@@ -25,107 +25,107 @@
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
-#include <winerror.h>
+#include <winerror.h>
#include <ws2tcpip.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#include <io.h>
#include <tchar.h>
-#include <process.h>
-#undef _WIN32_WINNT
-/* For structs needed by GetAdaptersAddresses */
-#define _WIN32_WINNT 0x0501
-#include <iphlpapi.h>
+#include <process.h>
+#undef _WIN32_WINNT
+/* For structs needed by GetAdaptersAddresses */
+#define _WIN32_WINNT 0x0501
+#include <iphlpapi.h>
#include <netioapi.h>
#endif
#include <sys/types.h>
-#ifdef EVENT__HAVE_SYS_SOCKET_H
+#ifdef EVENT__HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#ifdef EVENT__HAVE_UNISTD_H
+#ifdef EVENT__HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef EVENT__HAVE_FCNTL_H
+#ifdef EVENT__HAVE_FCNTL_H
#include <fcntl.h>
#endif
-#ifdef EVENT__HAVE_STDLIB_H
+#ifdef EVENT__HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
-#ifdef EVENT__HAVE_NETINET_IN_H
+#ifdef EVENT__HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
-#ifdef EVENT__HAVE_NETINET_IN6_H
-#error #include <netinet/in6.h>
-#endif
-#ifdef EVENT__HAVE_NETINET_TCP_H
-#include <netinet/tcp.h>
-#endif
-#ifdef EVENT__HAVE_ARPA_INET_H
+#ifdef EVENT__HAVE_NETINET_IN6_H
+#error #include <netinet/in6.h>
+#endif
+#ifdef EVENT__HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+#ifdef EVENT__HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#include <time.h>
-#include <sys/stat.h>
+#include <sys/stat.h>
#ifndef _WIN32
#include <net/if.h>
#endif
-#ifdef EVENT__HAVE_IFADDRS_H
-#include <ifaddrs.h>
+#ifdef EVENT__HAVE_IFADDRS_H
+#include <ifaddrs.h>
#endif
#include "event2/util.h"
#include "util-internal.h"
#include "log-internal.h"
#include "mm-internal.h"
-#include "evthread-internal.h"
+#include "evthread-internal.h"
#include "strlcpy-internal.h"
#include "ipv6-internal.h"
-#ifdef _WIN32
-#define HT_NO_CACHE_HASH_VALUES
-#include "ht-internal.h"
+#ifdef _WIN32
+#define HT_NO_CACHE_HASH_VALUES
+#include "ht-internal.h"
#define open _open
#define read _read
#define close _close
-#ifndef fstat
+#ifndef fstat
#define fstat _fstati64
-#endif
-#ifndef stat
+#endif
+#ifndef stat
#define stat _stati64
-#endif
+#endif
#define mode_t int
#endif
int
-evutil_open_closeonexec_(const char *pathname, int flags, unsigned mode)
+evutil_open_closeonexec_(const char *pathname, int flags, unsigned mode)
{
int fd;
#ifdef O_CLOEXEC
- fd = open(pathname, flags|O_CLOEXEC, (mode_t)mode);
- if (fd >= 0 || errno == EINVAL)
- return fd;
- /* If we got an EINVAL, fall through and try without O_CLOEXEC */
+ fd = open(pathname, flags|O_CLOEXEC, (mode_t)mode);
+ if (fd >= 0 || errno == EINVAL)
+ return fd;
+ /* If we got an EINVAL, fall through and try without O_CLOEXEC */
#endif
- fd = open(pathname, flags, (mode_t)mode);
+ fd = open(pathname, flags, (mode_t)mode);
if (fd < 0)
return -1;
-#if defined(FD_CLOEXEC)
- if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) {
- close(fd);
+#if defined(FD_CLOEXEC)
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) {
+ close(fd);
return -1;
- }
+ }
#endif
return fd;
@@ -142,7 +142,7 @@ evutil_open_closeonexec_(const char *pathname, int flags, unsigned mode)
Used internally only; may go away in a future version.
*/
int
-evutil_read_file_(const char *filename, char **content_out, size_t *len_out,
+evutil_read_file_(const char *filename, char **content_out, size_t *len_out,
int is_binary)
{
int fd, r;
@@ -161,7 +161,7 @@ evutil_read_file_(const char *filename, char **content_out, size_t *len_out,
mode |= O_BINARY;
#endif
- fd = evutil_open_closeonexec_(filename, mode, 0);
+ fd = evutil_open_closeonexec_(filename, mode, 0);
if (fd < 0)
return -1;
if (fstat(fd, &st) || st.st_size < 0 ||
@@ -175,7 +175,7 @@ evutil_read_file_(const char *filename, char **content_out, size_t *len_out,
return -2;
}
read_so_far = 0;
-#ifdef _WIN32
+#ifdef _WIN32
#define N_TO_READ(x) ((x) > INT_MAX) ? INT_MAX : ((int)(x))
#else
#define N_TO_READ(x) (x)
@@ -201,15 +201,15 @@ evutil_read_file_(const char *filename, char **content_out, size_t *len_out,
int
evutil_socketpair(int family, int type, int protocol, evutil_socket_t fd[2])
{
-#ifndef _WIN32
+#ifndef _WIN32
return socketpair(family, type, protocol, fd);
#else
- return evutil_ersatz_socketpair_(family, type, protocol, fd);
+ return evutil_ersatz_socketpair_(family, type, protocol, fd);
#endif
}
int
-evutil_ersatz_socketpair_(int family, int type, int protocol,
+evutil_ersatz_socketpair_(int family, int type, int protocol,
evutil_socket_t fd[2])
{
/* This code is originally from Tor. Used with permission. */
@@ -219,7 +219,7 @@ evutil_ersatz_socketpair_(int family, int type, int protocol,
* for now, and really, when localhost is down sometimes, we
* have other problems too.
*/
-#ifdef _WIN32
+#ifdef _WIN32
#define ERR(e) WSA##e
#else
#define ERR(e) e
@@ -231,17 +231,17 @@ evutil_ersatz_socketpair_(int family, int type, int protocol,
struct sockaddr_in connect_addr;
ev_socklen_t size;
int saved_errno = -1;
- int family_test;
-
- family_test = family != AF_INET;
+ int family_test;
+
+ family_test = family != AF_INET;
#ifdef AF_UNIX
- family_test = family_test && (family != AF_UNIX);
+ family_test = family_test && (family != AF_UNIX);
#endif
- if (protocol || family_test) {
+ if (protocol || family_test) {
EVUTIL_SET_SOCKET_ERROR(ERR(EAFNOSUPPORT));
return -1;
}
-
+
if (!fd) {
EVUTIL_SET_SOCKET_ERROR(ERR(EINVAL));
return -1;
@@ -263,9 +263,9 @@ evutil_ersatz_socketpair_(int family, int type, int protocol,
connector = socket(AF_INET, type, 0);
if (connector < 0)
goto tidy_up_and_fail;
-
- memset(&connect_addr, 0, sizeof(connect_addr));
-
+
+ memset(&connect_addr, 0, sizeof(connect_addr));
+
/* We want to find out the port number to connect to. */
size = sizeof(connect_addr);
if (getsockname(listener, (struct sockaddr *) &connect_addr, &size) == -1)
@@ -317,9 +317,9 @@ evutil_ersatz_socketpair_(int family, int type, int protocol,
int
evutil_make_socket_nonblocking(evutil_socket_t fd)
{
-#ifdef _WIN32
+#ifdef _WIN32
{
- unsigned long nonblocking = 1;
+ unsigned long nonblocking = 1;
if (ioctlsocket(fd, FIONBIO, &nonblocking) == SOCKET_ERROR) {
event_sock_warn(fd, "fcntl(%d, F_GETFL)", (int)fd);
return -1;
@@ -332,39 +332,39 @@ evutil_make_socket_nonblocking(evutil_socket_t fd)
event_warn("fcntl(%d, F_GETFL)", fd);
return -1;
}
- if (!(flags & O_NONBLOCK)) {
- if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) {
- event_warn("fcntl(%d, F_SETFL)", fd);
- return -1;
- }
+ if (!(flags & O_NONBLOCK)) {
+ if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) {
+ event_warn("fcntl(%d, F_SETFL)", fd);
+ return -1;
+ }
}
}
#endif
return 0;
}
-/* Faster version of evutil_make_socket_nonblocking for internal use.
- *
- * Requires that no F_SETFL flags were previously set on the fd.
- */
-static int
-evutil_fast_socket_nonblocking(evutil_socket_t fd)
-{
-#ifdef _WIN32
- return evutil_make_socket_nonblocking(fd);
-#else
- if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
- event_warn("fcntl(%d, F_SETFL)", fd);
- return -1;
- }
- return 0;
-#endif
-}
-
+/* Faster version of evutil_make_socket_nonblocking for internal use.
+ *
+ * Requires that no F_SETFL flags were previously set on the fd.
+ */
+static int
+evutil_fast_socket_nonblocking(evutil_socket_t fd)
+{
+#ifdef _WIN32
+ return evutil_make_socket_nonblocking(fd);
+#else
+ if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
+ event_warn("fcntl(%d, F_SETFL)", fd);
+ return -1;
+ }
+ return 0;
+#endif
+}
+
int
evutil_make_listen_socket_reuseable(evutil_socket_t sock)
{
-#if defined(SO_REUSEADDR) && !defined(_WIN32)
+#if defined(SO_REUSEADDR) && !defined(_WIN32)
int one = 1;
/* REUSEADDR on Unix means, "don't hang on to this address after the
* listener is closed." On Windows, though, it means "don't keep other
@@ -377,72 +377,72 @@ evutil_make_listen_socket_reuseable(evutil_socket_t sock)
}
int
-evutil_make_listen_socket_reuseable_port(evutil_socket_t sock)
-{
-#if defined __linux__ && defined(SO_REUSEPORT)
- int one = 1;
- /* REUSEPORT on Linux 3.9+ means, "Multiple servers (processes or
- * threads) can bind to the same port if they each set the option. */
- return setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (void*) &one,
- (ev_socklen_t)sizeof(one));
-#else
- return 0;
-#endif
-}
-
-int
-evutil_make_listen_socket_ipv6only(evutil_socket_t sock)
-{
-#if defined(IPV6_V6ONLY)
- int one = 1;
- return setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (void*) &one,
- (ev_socklen_t)sizeof(one));
-#endif
- return 0;
-}
-
-int
-evutil_make_tcp_listen_socket_deferred(evutil_socket_t sock)
-{
-#if defined(EVENT__HAVE_NETINET_TCP_H) && defined(TCP_DEFER_ACCEPT)
- int one = 1;
-
- /* TCP_DEFER_ACCEPT tells the kernel to call defer accept() only after data
- * has arrived and ready to read */
- return setsockopt(sock, IPPROTO_TCP, TCP_DEFER_ACCEPT, &one,
- (ev_socklen_t)sizeof(one));
-#endif
- return 0;
-}
-
-int
+evutil_make_listen_socket_reuseable_port(evutil_socket_t sock)
+{
+#if defined __linux__ && defined(SO_REUSEPORT)
+ int one = 1;
+ /* REUSEPORT on Linux 3.9+ means, "Multiple servers (processes or
+ * threads) can bind to the same port if they each set the option. */
+ return setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (void*) &one,
+ (ev_socklen_t)sizeof(one));
+#else
+ return 0;
+#endif
+}
+
+int
+evutil_make_listen_socket_ipv6only(evutil_socket_t sock)
+{
+#if defined(IPV6_V6ONLY)
+ int one = 1;
+ return setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (void*) &one,
+ (ev_socklen_t)sizeof(one));
+#endif
+ return 0;
+}
+
+int
+evutil_make_tcp_listen_socket_deferred(evutil_socket_t sock)
+{
+#if defined(EVENT__HAVE_NETINET_TCP_H) && defined(TCP_DEFER_ACCEPT)
+ int one = 1;
+
+ /* TCP_DEFER_ACCEPT tells the kernel to call defer accept() only after data
+ * has arrived and ready to read */
+ return setsockopt(sock, IPPROTO_TCP, TCP_DEFER_ACCEPT, &one,
+ (ev_socklen_t)sizeof(one));
+#endif
+ return 0;
+}
+
+int
evutil_make_socket_closeonexec(evutil_socket_t fd)
{
-#if !defined(_WIN32) && defined(EVENT__HAVE_SETFD)
+#if !defined(_WIN32) && defined(EVENT__HAVE_SETFD)
int flags;
if ((flags = fcntl(fd, F_GETFD, NULL)) < 0) {
event_warn("fcntl(%d, F_GETFD)", fd);
return -1;
}
- if (!(flags & FD_CLOEXEC)) {
- if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) {
- event_warn("fcntl(%d, F_SETFD)", fd);
- return -1;
- }
- }
-#endif
- return 0;
-}
-
-/* Faster version of evutil_make_socket_closeonexec for internal use.
- *
- * Requires that no F_SETFD flags were previously set on the fd.
- */
-static int
-evutil_fast_socket_closeonexec(evutil_socket_t fd)
-{
-#if !defined(_WIN32) && defined(EVENT__HAVE_SETFD)
- if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
+ if (!(flags & FD_CLOEXEC)) {
+ if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) {
+ event_warn("fcntl(%d, F_SETFD)", fd);
+ return -1;
+ }
+ }
+#endif
+ return 0;
+}
+
+/* Faster version of evutil_make_socket_closeonexec for internal use.
+ *
+ * Requires that no F_SETFD flags were previously set on the fd.
+ */
+static int
+evutil_fast_socket_closeonexec(evutil_socket_t fd)
+{
+#if !defined(_WIN32) && defined(EVENT__HAVE_SETFD)
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
event_warn("fcntl(%d, F_SETFD)", fd);
return -1;
}
@@ -453,7 +453,7 @@ evutil_fast_socket_closeonexec(evutil_socket_t fd)
int
evutil_closesocket(evutil_socket_t sock)
{
-#ifndef _WIN32
+#ifndef _WIN32
return close(sock);
#else
return closesocket(sock);
@@ -463,11 +463,11 @@ evutil_closesocket(evutil_socket_t sock)
ev_int64_t
evutil_strtoll(const char *s, char **endptr, int base)
{
-#ifdef EVENT__HAVE_STRTOLL
+#ifdef EVENT__HAVE_STRTOLL
return (ev_int64_t)strtoll(s, endptr, base);
-#elif EVENT__SIZEOF_LONG == 8
+#elif EVENT__SIZEOF_LONG == 8
return (ev_int64_t)strtol(s, endptr, base);
-#elif defined(_WIN32) && defined(_MSC_VER) && _MSC_VER < 1300
+#elif defined(_WIN32) && defined(_MSC_VER) && _MSC_VER < 1300
/* XXXX on old versions of MS APIs, we only support base
* 10. */
ev_int64_t r;
@@ -483,9 +483,9 @@ evutil_strtoll(const char *s, char **endptr, int base)
if (endptr)
*endptr = (char*) s;
return r;
-#elif defined(_WIN32)
+#elif defined(_WIN32)
return (ev_int64_t) _strtoi64(s, endptr, base);
-#elif defined(EVENT__SIZEOF_LONG_LONG) && EVENT__SIZEOF_LONG_LONG == 8
+#elif defined(EVENT__SIZEOF_LONG_LONG) && EVENT__SIZEOF_LONG_LONG == 8
long long r;
int n;
if (base != 10 && base != 16)
@@ -501,15 +501,15 @@ evutil_strtoll(const char *s, char **endptr, int base)
}
if (n != 1)
return 0;
- while (EVUTIL_ISSPACE_(*s))
+ while (EVUTIL_ISSPACE_(*s))
++s;
if (*s == '-')
++s;
if (base == 10) {
- while (EVUTIL_ISDIGIT_(*s))
+ while (EVUTIL_ISDIGIT_(*s))
++s;
} else {
- while (EVUTIL_ISXDIGIT_(*s))
+ while (EVUTIL_ISXDIGIT_(*s))
++s;
}
if (endptr)
@@ -520,7 +520,7 @@ evutil_strtoll(const char *s, char **endptr, int base)
#endif
}
-#ifdef _WIN32
+#ifdef _WIN32
int
evutil_socket_geterror(evutil_socket_t sock)
{
@@ -540,7 +540,7 @@ evutil_socket_geterror(evutil_socket_t sock)
/* XXX we should use an enum here. */
/* 2 for connection refused, 1 for connected, 0 for not yet, -1 for error. */
int
-evutil_socket_connect_(evutil_socket_t *fd_ptr, const struct sockaddr *sa, int socklen)
+evutil_socket_connect_(evutil_socket_t *fd_ptr, const struct sockaddr *sa, int socklen)
{
int made_fd = 0;
@@ -577,7 +577,7 @@ err:
error case, set the current socket errno to the error that happened during
the connect operation. */
int
-evutil_socket_finished_connecting_(evutil_socket_t fd)
+evutil_socket_finished_connecting_(evutil_socket_t fd)
{
int e;
ev_socklen_t elen = sizeof(e);
@@ -611,151 +611,151 @@ evutil_socket_finished_connecting_(evutil_socket_t fd)
set by evutil_check_interfaces. */
static int have_checked_interfaces, had_ipv4_address, had_ipv6_address;
-/* True iff the IPv4 address 'addr', in host order, is in 127.0.0.0/8 */
-static inline int evutil_v4addr_is_localhost(ev_uint32_t addr)
-{ return addr>>24 == 127; }
-
-/* True iff the IPv4 address 'addr', in host order, is link-local
- * 169.254.0.0/16 (RFC3927) */
-static inline int evutil_v4addr_is_linklocal(ev_uint32_t addr)
-{ return ((addr & 0xffff0000U) == 0xa9fe0000U); }
-
-/* True iff the IPv4 address 'addr', in host order, is a class D
- * (multiclass) address. */
-static inline int evutil_v4addr_is_classd(ev_uint32_t addr)
-{ return ((addr>>24) & 0xf0) == 0xe0; }
-
-int
-evutil_v4addr_is_local_(const struct in_addr *in)
-{
- const ev_uint32_t addr = ntohl(in->s_addr);
- return addr == INADDR_ANY ||
- evutil_v4addr_is_localhost(addr) ||
- evutil_v4addr_is_linklocal(addr) ||
- evutil_v4addr_is_classd(addr);
-}
-int
-evutil_v6addr_is_local_(const struct in6_addr *in)
-{
- static const char ZEROES[] =
- "\x00\x00\x00\x00\x00\x00\x00\x00"
- "\x00\x00\x00\x00\x00\x00\x00\x00";
-
- const unsigned char *addr = (const unsigned char *)in->s6_addr;
- return !memcmp(addr, ZEROES, 8) ||
- ((addr[0] & 0xfe) == 0xfc) ||
- (addr[0] == 0xfe && (addr[1] & 0xc0) == 0x80) ||
- (addr[0] == 0xfe && (addr[1] & 0xc0) == 0xc0) ||
- (addr[0] == 0xff);
-}
-
-static void
-evutil_found_ifaddr(const struct sockaddr *sa)
-{
- if (sa->sa_family == AF_INET) {
- const struct sockaddr_in *sin = (struct sockaddr_in *)sa;
- if (!evutil_v4addr_is_local_(&sin->sin_addr)) {
- event_debug(("Detected an IPv4 interface"));
- had_ipv4_address = 1;
- }
- } else if (sa->sa_family == AF_INET6) {
- const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
- if (!evutil_v6addr_is_local_(&sin6->sin6_addr)) {
- event_debug(("Detected an IPv6 interface"));
- had_ipv6_address = 1;
- }
- }
-}
-
-#ifdef _WIN32
-typedef ULONG (WINAPI *GetAdaptersAddresses_fn_t)(
- ULONG, ULONG, PVOID, PIP_ADAPTER_ADDRESSES, PULONG);
-#endif
-
-static int
-evutil_check_ifaddrs(void)
-{
-#if defined(EVENT__HAVE_GETIFADDRS)
- /* Most free Unixy systems provide getifaddrs, which gives us a linked list
- * of struct ifaddrs. */
- struct ifaddrs *ifa = NULL;
- const struct ifaddrs *i;
- if (getifaddrs(&ifa) < 0) {
- event_warn("Unable to call getifaddrs()");
- return -1;
- }
-
- for (i = ifa; i; i = i->ifa_next) {
- if (!i->ifa_addr)
- continue;
- evutil_found_ifaddr(i->ifa_addr);
- }
-
- freeifaddrs(ifa);
- return 0;
-#elif defined(_WIN32)
- /* Windows XP began to provide GetAdaptersAddresses. Windows 2000 had a
- "GetAdaptersInfo", but that's deprecated; let's just try
- GetAdaptersAddresses and fall back to connect+getsockname.
- */
+/* True iff the IPv4 address 'addr', in host order, is in 127.0.0.0/8 */
+static inline int evutil_v4addr_is_localhost(ev_uint32_t addr)
+{ return addr>>24 == 127; }
+
+/* True iff the IPv4 address 'addr', in host order, is link-local
+ * 169.254.0.0/16 (RFC3927) */
+static inline int evutil_v4addr_is_linklocal(ev_uint32_t addr)
+{ return ((addr & 0xffff0000U) == 0xa9fe0000U); }
+
+/* True iff the IPv4 address 'addr', in host order, is a class D
+ * (multiclass) address. */
+static inline int evutil_v4addr_is_classd(ev_uint32_t addr)
+{ return ((addr>>24) & 0xf0) == 0xe0; }
+
+int
+evutil_v4addr_is_local_(const struct in_addr *in)
+{
+ const ev_uint32_t addr = ntohl(in->s_addr);
+ return addr == INADDR_ANY ||
+ evutil_v4addr_is_localhost(addr) ||
+ evutil_v4addr_is_linklocal(addr) ||
+ evutil_v4addr_is_classd(addr);
+}
+int
+evutil_v6addr_is_local_(const struct in6_addr *in)
+{
+ static const char ZEROES[] =
+ "\x00\x00\x00\x00\x00\x00\x00\x00"
+ "\x00\x00\x00\x00\x00\x00\x00\x00";
+
+ const unsigned char *addr = (const unsigned char *)in->s6_addr;
+ return !memcmp(addr, ZEROES, 8) ||
+ ((addr[0] & 0xfe) == 0xfc) ||
+ (addr[0] == 0xfe && (addr[1] & 0xc0) == 0x80) ||
+ (addr[0] == 0xfe && (addr[1] & 0xc0) == 0xc0) ||
+ (addr[0] == 0xff);
+}
+
+static void
+evutil_found_ifaddr(const struct sockaddr *sa)
+{
+ if (sa->sa_family == AF_INET) {
+ const struct sockaddr_in *sin = (struct sockaddr_in *)sa;
+ if (!evutil_v4addr_is_local_(&sin->sin_addr)) {
+ event_debug(("Detected an IPv4 interface"));
+ had_ipv4_address = 1;
+ }
+ } else if (sa->sa_family == AF_INET6) {
+ const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
+ if (!evutil_v6addr_is_local_(&sin6->sin6_addr)) {
+ event_debug(("Detected an IPv6 interface"));
+ had_ipv6_address = 1;
+ }
+ }
+}
+
+#ifdef _WIN32
+typedef ULONG (WINAPI *GetAdaptersAddresses_fn_t)(
+ ULONG, ULONG, PVOID, PIP_ADAPTER_ADDRESSES, PULONG);
+#endif
+
+static int
+evutil_check_ifaddrs(void)
+{
+#if defined(EVENT__HAVE_GETIFADDRS)
+ /* Most free Unixy systems provide getifaddrs, which gives us a linked list
+ * of struct ifaddrs. */
+ struct ifaddrs *ifa = NULL;
+ const struct ifaddrs *i;
+ if (getifaddrs(&ifa) < 0) {
+ event_warn("Unable to call getifaddrs()");
+ return -1;
+ }
+
+ for (i = ifa; i; i = i->ifa_next) {
+ if (!i->ifa_addr)
+ continue;
+ evutil_found_ifaddr(i->ifa_addr);
+ }
+
+ freeifaddrs(ifa);
+ return 0;
+#elif defined(_WIN32)
+ /* Windows XP began to provide GetAdaptersAddresses. Windows 2000 had a
+ "GetAdaptersInfo", but that's deprecated; let's just try
+ GetAdaptersAddresses and fall back to connect+getsockname.
+ */
HMODULE lib = evutil_load_windows_system_library_(TEXT("iphlpapi.dll"));
- GetAdaptersAddresses_fn_t fn;
- ULONG size, res;
- IP_ADAPTER_ADDRESSES *addresses = NULL, *address;
- int result = -1;
-
-#define FLAGS (GAA_FLAG_SKIP_ANYCAST | \
- GAA_FLAG_SKIP_MULTICAST | \
- GAA_FLAG_SKIP_DNS_SERVER)
-
- if (!lib)
- goto done;
-
- if (!(fn = (GetAdaptersAddresses_fn_t) GetProcAddress(lib, "GetAdaptersAddresses")))
- goto done;
-
- /* Guess how much space we need. */
- size = 15*1024;
- addresses = mm_malloc(size);
- if (!addresses)
- goto done;
- res = fn(AF_UNSPEC, FLAGS, NULL, addresses, &size);
- if (res == ERROR_BUFFER_OVERFLOW) {
- /* we didn't guess that we needed enough space; try again */
- mm_free(addresses);
- addresses = mm_malloc(size);
- if (!addresses)
- goto done;
- res = fn(AF_UNSPEC, FLAGS, NULL, addresses, &size);
- }
- if (res != NO_ERROR)
- goto done;
-
- for (address = addresses; address; address = address->Next) {
- IP_ADAPTER_UNICAST_ADDRESS *a;
- for (a = address->FirstUnicastAddress; a; a = a->Next) {
- /* Yes, it's a linked list inside a linked list */
- struct sockaddr *sa = a->Address.lpSockaddr;
- evutil_found_ifaddr(sa);
- }
- }
-
- result = 0;
-done:
- if (lib)
- FreeLibrary(lib);
- if (addresses)
- mm_free(addresses);
- return result;
-#else
- return -1;
-#endif
-}
-
+ GetAdaptersAddresses_fn_t fn;
+ ULONG size, res;
+ IP_ADAPTER_ADDRESSES *addresses = NULL, *address;
+ int result = -1;
+
+#define FLAGS (GAA_FLAG_SKIP_ANYCAST | \
+ GAA_FLAG_SKIP_MULTICAST | \
+ GAA_FLAG_SKIP_DNS_SERVER)
+
+ if (!lib)
+ goto done;
+
+ if (!(fn = (GetAdaptersAddresses_fn_t) GetProcAddress(lib, "GetAdaptersAddresses")))
+ goto done;
+
+ /* Guess how much space we need. */
+ size = 15*1024;
+ addresses = mm_malloc(size);
+ if (!addresses)
+ goto done;
+ res = fn(AF_UNSPEC, FLAGS, NULL, addresses, &size);
+ if (res == ERROR_BUFFER_OVERFLOW) {
+ /* we didn't guess that we needed enough space; try again */
+ mm_free(addresses);
+ addresses = mm_malloc(size);
+ if (!addresses)
+ goto done;
+ res = fn(AF_UNSPEC, FLAGS, NULL, addresses, &size);
+ }
+ if (res != NO_ERROR)
+ goto done;
+
+ for (address = addresses; address; address = address->Next) {
+ IP_ADAPTER_UNICAST_ADDRESS *a;
+ for (a = address->FirstUnicastAddress; a; a = a->Next) {
+ /* Yes, it's a linked list inside a linked list */
+ struct sockaddr *sa = a->Address.lpSockaddr;
+ evutil_found_ifaddr(sa);
+ }
+ }
+
+ result = 0;
+done:
+ if (lib)
+ FreeLibrary(lib);
+ if (addresses)
+ mm_free(addresses);
+ return result;
+#else
+ return -1;
+#endif
+}
+
/* Test whether we have an ipv4 interface and an ipv6 interface. Return 0 if
* the test seemed successful. */
static int
-evutil_check_interfaces(void)
+evutil_check_interfaces(void)
{
evutil_socket_t fd = -1;
struct sockaddr_in sin, sin_out;
@@ -763,22 +763,22 @@ evutil_check_interfaces(void)
ev_socklen_t sin_out_len = sizeof(sin_out);
ev_socklen_t sin6_out_len = sizeof(sin6_out);
int r;
- if (have_checked_interfaces)
- return 0;
-
- /* From this point on we have done the ipv4/ipv6 interface check */
- have_checked_interfaces = 1;
-
- if (evutil_check_ifaddrs() == 0) {
- /* Use a nice sane interface, if this system has one. */
+ if (have_checked_interfaces)
return 0;
- }
- /* Ugh. There was no nice sane interface. So to check whether we have
- * an interface open for a given protocol, will try to make a UDP
- * 'connection' to a remote host on the internet. We don't actually
- * use it, so the address doesn't matter, but we want to pick one that
- * keep us from using a host- or link-local interface. */
+ /* From this point on we have done the ipv4/ipv6 interface check */
+ have_checked_interfaces = 1;
+
+ if (evutil_check_ifaddrs() == 0) {
+ /* Use a nice sane interface, if this system has one. */
+ return 0;
+ }
+
+ /* Ugh. There was no nice sane interface. So to check whether we have
+ * an interface open for a given protocol, will try to make a UDP
+ * 'connection' to a remote host on the internet. We don't actually
+ * use it, so the address doesn't matter, but we want to pick one that
+ * keep us from using a host- or link-local interface. */
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = htons(53);
@@ -799,7 +799,7 @@ evutil_check_interfaces(void)
connect(fd, (struct sockaddr*)&sin, sizeof(sin)) == 0 &&
getsockname(fd, (struct sockaddr*)&sin_out, &sin_out_len) == 0) {
/* We might have an IPv4 interface. */
- evutil_found_ifaddr((struct sockaddr*) &sin_out);
+ evutil_found_ifaddr((struct sockaddr*) &sin_out);
}
if (fd >= 0)
evutil_closesocket(fd);
@@ -808,7 +808,7 @@ evutil_check_interfaces(void)
connect(fd, (struct sockaddr*)&sin6, sizeof(sin6)) == 0 &&
getsockname(fd, (struct sockaddr*)&sin6_out, &sin6_out_len) == 0) {
/* We might have an IPv6 interface. */
- evutil_found_ifaddr((struct sockaddr*) &sin6_out);
+ evutil_found_ifaddr((struct sockaddr*) &sin6_out);
}
if (fd >= 0)
@@ -829,7 +829,7 @@ evutil_check_interfaces(void)
* allocate both a TCP and a UDP addrinfo.
*/
struct evutil_addrinfo *
-evutil_new_addrinfo_(struct sockaddr *sa, ev_socklen_t socklen,
+evutil_new_addrinfo_(struct sockaddr *sa, ev_socklen_t socklen,
const struct evutil_addrinfo *hints)
{
struct evutil_addrinfo *res;
@@ -841,11 +841,11 @@ evutil_new_addrinfo_(struct sockaddr *sa, ev_socklen_t socklen,
struct evutil_addrinfo tmp;
memcpy(&tmp, hints, sizeof(tmp));
tmp.ai_socktype = SOCK_STREAM; tmp.ai_protocol = IPPROTO_TCP;
- r1 = evutil_new_addrinfo_(sa, socklen, &tmp);
+ r1 = evutil_new_addrinfo_(sa, socklen, &tmp);
if (!r1)
return NULL;
tmp.ai_socktype = SOCK_DGRAM; tmp.ai_protocol = IPPROTO_UDP;
- r2 = evutil_new_addrinfo_(sa, socklen, &tmp);
+ r2 = evutil_new_addrinfo_(sa, socklen, &tmp);
if (!r2) {
evutil_freeaddrinfo(r1);
return NULL;
@@ -874,7 +874,7 @@ evutil_new_addrinfo_(struct sockaddr *sa, ev_socklen_t socklen,
* the list. Either element can be NULL, in which case we return the element
* that is not NULL. */
struct evutil_addrinfo *
-evutil_addrinfo_append_(struct evutil_addrinfo *first,
+evutil_addrinfo_append_(struct evutil_addrinfo *first,
struct evutil_addrinfo *append)
{
struct evutil_addrinfo *ai = first;
@@ -909,7 +909,7 @@ evutil_parse_servname(const char *servname, const char *protocol,
int n = parse_numeric_servname(servname);
if (n>=0)
return n;
-#if defined(EVENT__HAVE_GETSERVBYNAME) || defined(_WIN32)
+#if defined(EVENT__HAVE_GETSERVBYNAME) || defined(_WIN32)
if (!(hints->ai_flags & EVUTIL_AI_NUMERICSERV)) {
struct servent *ent = getservbyname(servname, protocol);
if (ent) {
@@ -937,7 +937,7 @@ evutil_unparse_protoname(int proto)
return "sctp";
#endif
default:
-#ifdef EVENT__HAVE_GETPROTOBYNUMBER
+#ifdef EVENT__HAVE_GETPROTOBYNUMBER
{
struct protoent *ent = getprotobynumber(proto);
if (ent)
@@ -990,7 +990,7 @@ evutil_getaddrinfo_infer_protocols(struct evutil_addrinfo *hints)
* set *res as getaddrinfo would.
*/
int
-evutil_getaddrinfo_common_(const char *nodename, const char *servname,
+evutil_getaddrinfo_common_(const char *nodename, const char *servname,
struct evutil_addrinfo *hints, struct evutil_addrinfo **res, int *portnum)
{
int port = 0;
@@ -1033,7 +1033,7 @@ evutil_getaddrinfo_common_(const char *nodename, const char *servname,
/* connect to ::1 */
sin6.sin6_addr.s6_addr[15] = 1;
}
- res6 = evutil_new_addrinfo_((struct sockaddr*)&sin6,
+ res6 = evutil_new_addrinfo_((struct sockaddr*)&sin6,
sizeof(sin6), hints);
if (!res6)
return EVUTIL_EAI_MEMORY;
@@ -1050,7 +1050,7 @@ evutil_getaddrinfo_common_(const char *nodename, const char *servname,
/* connect to 127.0.0.1 */
sin.sin_addr.s_addr = htonl(0x7f000001);
}
- res4 = evutil_new_addrinfo_((struct sockaddr*)&sin,
+ res4 = evutil_new_addrinfo_((struct sockaddr*)&sin,
sizeof(sin), hints);
if (!res4) {
if (res6)
@@ -1058,7 +1058,7 @@ evutil_getaddrinfo_common_(const char *nodename, const char *servname,
return EVUTIL_EAI_MEMORY;
}
}
- *res = evutil_addrinfo_append_(res4, res6);
+ *res = evutil_addrinfo_append_(res4, res6);
return 0;
}
@@ -1074,7 +1074,7 @@ evutil_getaddrinfo_common_(const char *nodename, const char *servname,
sin6.sin6_family = AF_INET6;
sin6.sin6_port = htons(port);
sin6.sin6_scope_id = if_index;
- *res = evutil_new_addrinfo_((struct sockaddr*)&sin6,
+ *res = evutil_new_addrinfo_((struct sockaddr*)&sin6,
sizeof(sin6), hints);
if (!*res)
return EVUTIL_EAI_MEMORY;
@@ -1087,10 +1087,10 @@ evutil_getaddrinfo_common_(const char *nodename, const char *servname,
struct sockaddr_in sin;
memset(&sin, 0, sizeof(sin));
if (1==evutil_inet_pton(AF_INET, nodename, &sin.sin_addr)) {
- /* Got an ipv4 address. */
+ /* Got an ipv4 address. */
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
- *res = evutil_new_addrinfo_((struct sockaddr*)&sin,
+ *res = evutil_new_addrinfo_((struct sockaddr*)&sin,
sizeof(sin), hints);
if (!*res)
return EVUTIL_EAI_MEMORY;
@@ -1109,7 +1109,7 @@ evutil_getaddrinfo_common_(const char *nodename, const char *servname,
return EVUTIL_EAI_NEED_RESOLVE;
}
-#ifdef EVENT__HAVE_GETADDRINFO
+#ifdef EVENT__HAVE_GETADDRINFO
#define USE_NATIVE_GETADDRINFO
#endif
@@ -1197,7 +1197,7 @@ addrinfo_from_hostent(const struct hostent *ent,
sin6.sin6_family = AF_INET6;
sin6.sin6_port = htons(port);
sa = (struct sockaddr *)&sin6;
- socklen = sizeof(struct sockaddr_in6);
+ socklen = sizeof(struct sockaddr_in6);
addrp = &sin6.sin6_addr;
if (ent->h_length != sizeof(sin6.sin6_addr)) {
event_warnx("Weird h_length from gethostbyname");
@@ -1208,12 +1208,12 @@ addrinfo_from_hostent(const struct hostent *ent,
for (i = 0; ent->h_addr_list[i]; ++i) {
memcpy(addrp, ent->h_addr_list[i], ent->h_length);
- ai = evutil_new_addrinfo_(sa, socklen, hints);
+ ai = evutil_new_addrinfo_(sa, socklen, hints);
if (!ai) {
evutil_freeaddrinfo(res);
return NULL;
}
- res = evutil_addrinfo_append_(res, ai);
+ res = evutil_addrinfo_append_(res, ai);
}
if (res && ((hints->ai_flags & EVUTIL_AI_CANONNAME) && ent->h_name)) {
@@ -1233,13 +1233,13 @@ addrinfo_from_hostent(const struct hostent *ent,
* that we'll only get addresses we could maybe connect to.
*/
void
-evutil_adjust_hints_for_addrconfig_(struct evutil_addrinfo *hints)
+evutil_adjust_hints_for_addrconfig_(struct evutil_addrinfo *hints)
{
if (!(hints->ai_flags & EVUTIL_AI_ADDRCONFIG))
return;
if (hints->ai_family != PF_UNSPEC)
return;
- evutil_check_interfaces();
+ evutil_check_interfaces();
if (had_ipv4_address && !had_ipv6_address) {
hints->ai_family = PF_INET;
} else if (!had_ipv4_address && had_ipv6_address) {
@@ -1261,7 +1261,7 @@ static int tested_for_getaddrinfo_hacks=0;
turns out that the bug is present, then:
- If nodename==NULL and servname is numeric, we build an answer
- ourselves using evutil_getaddrinfo_common_().
+ ourselves using evutil_getaddrinfo_common_().
- If nodename!=NULL and servname is numeric, then we set
servname=NULL when calling getaddrinfo, and post-process the
@@ -1274,20 +1274,20 @@ static int tested_for_getaddrinfo_hacks=0;
field set to 0. We test for this so we can apply an appropriate
workaround.
*/
-static struct evutil_addrinfo *ai_find_protocol(struct evutil_addrinfo *ai)
-{
- while (ai) {
- if (ai->ai_protocol)
- return ai;
- ai = ai->ai_next;
- }
- return NULL;
-}
+static struct evutil_addrinfo *ai_find_protocol(struct evutil_addrinfo *ai)
+{
+ while (ai) {
+ if (ai->ai_protocol)
+ return ai;
+ ai = ai->ai_next;
+ }
+ return NULL;
+}
static void
test_for_getaddrinfo_hacks(void)
{
int r, r2;
- struct evutil_addrinfo *ai=NULL, *ai2=NULL, *ai3=NULL;
+ struct evutil_addrinfo *ai=NULL, *ai2=NULL, *ai3=NULL;
struct evutil_addrinfo hints;
memset(&hints,0,sizeof(hints));
@@ -1301,13 +1301,13 @@ test_for_getaddrinfo_hacks(void)
#endif
0;
r = getaddrinfo("1.2.3.4", "80", &hints, &ai);
- getaddrinfo("1.2.3.4", NULL, &hints, &ai3);
+ getaddrinfo("1.2.3.4", NULL, &hints, &ai3);
hints.ai_socktype = SOCK_STREAM;
r2 = getaddrinfo("1.2.3.4", "80", &hints, &ai2);
if (r2 == 0 && r != 0) {
need_numeric_port_hack_=1;
}
- if (!ai_find_protocol(ai2) || !ai_find_protocol(ai3)) {
+ if (!ai_find_protocol(ai2) || !ai_find_protocol(ai3)) {
need_socktype_protocol_hack_=1;
}
@@ -1315,8 +1315,8 @@ test_for_getaddrinfo_hacks(void)
freeaddrinfo(ai);
if (ai2)
freeaddrinfo(ai2);
- if (ai3)
- freeaddrinfo(ai3);
+ if (ai3)
+ freeaddrinfo(ai3);
tested_for_getaddrinfo_hacks=1;
}
@@ -1403,7 +1403,7 @@ evutil_getaddrinfo(const char *nodename, const char *servname,
/* Not every system has AI_ADDRCONFIG, so fake it. */
if (hints.ai_family == PF_UNSPEC &&
(hints.ai_flags & EVUTIL_AI_ADDRCONFIG)) {
- evutil_adjust_hints_for_addrconfig_(&hints);
+ evutil_adjust_hints_for_addrconfig_(&hints);
}
#endif
@@ -1426,10 +1426,10 @@ evutil_getaddrinfo(const char *nodename, const char *servname,
* ever resolving even a literal IPv6 address when
* ai_addrtype is PF_UNSPEC.
*/
-#ifdef _WIN32
+#ifdef _WIN32
{
int tmp_port;
- err = evutil_getaddrinfo_common_(nodename,servname,&hints,
+ err = evutil_getaddrinfo_common_(nodename,servname,&hints,
res, &tmp_port);
if (err == 0 ||
err == EVUTIL_EAI_MEMORY ||
@@ -1445,7 +1445,7 @@ evutil_getaddrinfo(const char *nodename, const char *servname,
&& ((portnum=parse_numeric_servname(servname)) >= 0);
if (need_np_hack) {
if (!nodename)
- return evutil_getaddrinfo_common_(
+ return evutil_getaddrinfo_common_(
NULL,servname,&hints, res, &portnum);
servname = NULL;
}
@@ -1490,9 +1490,9 @@ evutil_getaddrinfo(const char *nodename, const char *servname,
hints.ai_family = PF_UNSPEC;
}
- evutil_adjust_hints_for_addrconfig_(&hints);
+ evutil_adjust_hints_for_addrconfig_(&hints);
- err = evutil_getaddrinfo_common_(nodename, servname, &hints, res, &port);
+ err = evutil_getaddrinfo_common_(nodename, servname, &hints, res, &port);
if (err != EVUTIL_EAI_NEED_RESOLVE) {
/* We either succeeded or failed. No need to continue */
return err;
@@ -1501,19 +1501,19 @@ evutil_getaddrinfo(const char *nodename, const char *servname,
err = 0;
/* Use any of the various gethostbyname_r variants as available. */
{
-#ifdef EVENT__HAVE_GETHOSTBYNAME_R_6_ARG
+#ifdef EVENT__HAVE_GETHOSTBYNAME_R_6_ARG
/* This one is what glibc provides. */
char buf[2048];
struct hostent hostent;
int r;
r = gethostbyname_r(nodename, &hostent, buf, sizeof(buf), &ent,
&err);
-#elif defined(EVENT__HAVE_GETHOSTBYNAME_R_5_ARG)
+#elif defined(EVENT__HAVE_GETHOSTBYNAME_R_5_ARG)
char buf[2048];
struct hostent hostent;
ent = gethostbyname_r(nodename, &hostent, buf, sizeof(buf),
&err);
-#elif defined(EVENT__HAVE_GETHOSTBYNAME_R_3_ARG)
+#elif defined(EVENT__HAVE_GETHOSTBYNAME_R_3_ARG)
struct hostent_data data;
struct hostent hostent;
memset(&data, 0, sizeof(data));
@@ -1523,7 +1523,7 @@ evutil_getaddrinfo(const char *nodename, const char *servname,
/* fall back to gethostbyname. */
/* XXXX This needs a lock everywhere but Windows. */
ent = gethostbyname(nodename);
-#ifdef _WIN32
+#ifdef _WIN32
err = WSAGetLastError();
#else
err = h_errno;
@@ -1578,7 +1578,7 @@ evutil_getaddrinfo(const char *nodename, const char *servname,
void
evutil_freeaddrinfo(struct evutil_addrinfo *ai)
{
-#ifdef EVENT__HAVE_GETADDRINFO
+#ifdef EVENT__HAVE_GETADDRINFO
if (!(ai->ai_flags & EVUTIL_AI_LIBEVENT_ALLOCATED)) {
freeaddrinfo(ai);
return;
@@ -1594,50 +1594,50 @@ evutil_freeaddrinfo(struct evutil_addrinfo *ai)
}
static evdns_getaddrinfo_fn evdns_getaddrinfo_impl = NULL;
-static evdns_getaddrinfo_cancel_fn evdns_getaddrinfo_cancel_impl = NULL;
+static evdns_getaddrinfo_cancel_fn evdns_getaddrinfo_cancel_impl = NULL;
void
-evutil_set_evdns_getaddrinfo_fn_(evdns_getaddrinfo_fn fn)
+evutil_set_evdns_getaddrinfo_fn_(evdns_getaddrinfo_fn fn)
{
if (!evdns_getaddrinfo_impl)
evdns_getaddrinfo_impl = fn;
}
-void
-evutil_set_evdns_getaddrinfo_cancel_fn_(evdns_getaddrinfo_cancel_fn fn)
-{
- if (!evdns_getaddrinfo_cancel_impl)
- evdns_getaddrinfo_cancel_impl = fn;
-}
+void
+evutil_set_evdns_getaddrinfo_cancel_fn_(evdns_getaddrinfo_cancel_fn fn)
+{
+ if (!evdns_getaddrinfo_cancel_impl)
+ evdns_getaddrinfo_cancel_impl = fn;
+}
/* Internal helper function: act like evdns_getaddrinfo if dns_base is set;
* otherwise do a blocking resolve and pass the result to the callback in the
* way that evdns_getaddrinfo would.
*/
-struct evdns_getaddrinfo_request *evutil_getaddrinfo_async_(
- struct evdns_base *dns_base,
+struct evdns_getaddrinfo_request *evutil_getaddrinfo_async_(
+ struct evdns_base *dns_base,
const char *nodename, const char *servname,
const struct evutil_addrinfo *hints_in,
void (*cb)(int, struct evutil_addrinfo *, void *), void *arg)
{
if (dns_base && evdns_getaddrinfo_impl) {
- return evdns_getaddrinfo_impl(
+ return evdns_getaddrinfo_impl(
dns_base, nodename, servname, hints_in, cb, arg);
} else {
struct evutil_addrinfo *ai=NULL;
int err;
err = evutil_getaddrinfo(nodename, servname, hints_in, &ai);
cb(err, ai, arg);
- return NULL;
- }
-}
-
-void evutil_getaddrinfo_cancel_async_(struct evdns_getaddrinfo_request *data)
-{
- if (evdns_getaddrinfo_cancel_impl && data) {
- evdns_getaddrinfo_cancel_impl(data);
+ return NULL;
}
}
+void evutil_getaddrinfo_cancel_async_(struct evdns_getaddrinfo_request *data)
+{
+ if (evdns_getaddrinfo_cancel_impl && data) {
+ evdns_getaddrinfo_cancel_impl(data);
+ }
+}
+
const char *
evutil_gai_strerror(int err)
{
@@ -1673,7 +1673,7 @@ evutil_gai_strerror(int err)
case EVUTIL_EAI_SYSTEM:
return "system error";
default:
-#if defined(USE_NATIVE_GETADDRINFO) && defined(_WIN32)
+#if defined(USE_NATIVE_GETADDRINFO) && defined(_WIN32)
return gai_strerrorA(err);
#elif defined(USE_NATIVE_GETADDRINFO)
return gai_strerror(err);
@@ -1683,181 +1683,181 @@ evutil_gai_strerror(int err)
}
}
-#ifdef _WIN32
-/* destructively remove a trailing line terminator from s */
-static void
-chomp (char *s)
-{
- size_t len;
- if (s && (len = strlen (s)) > 0 && s[len - 1] == '\n') {
- s[--len] = 0;
- if (len > 0 && s[len - 1] == '\r')
- s[--len] = 0;
- }
-}
-
-/* FormatMessage returns allocated strings, but evutil_socket_error_to_string
- * is supposed to return a string which is good indefinitely without having
- * to be freed. To make this work without leaking memory, we cache the
- * string the first time FormatMessage is called on a particular error
- * code, and then return the cached string on subsequent calls with the
- * same code. The strings aren't freed until libevent_global_shutdown
- * (or never). We use a linked list to cache the errors, because we
- * only expect there to be a few dozen, and that should be fast enough.
- */
-
-struct cached_sock_errs_entry {
- HT_ENTRY(cached_sock_errs_entry) node;
- DWORD code;
- char *msg; /* allocated with LocalAlloc; free with LocalFree */
-};
-
-static inline unsigned
-hash_cached_sock_errs(const struct cached_sock_errs_entry *e)
-{
- /* Use Murmur3's 32-bit finalizer as an integer hash function */
- DWORD h = e->code;
- h ^= h >> 16;
- h *= 0x85ebca6b;
- h ^= h >> 13;
- h *= 0xc2b2ae35;
- h ^= h >> 16;
- return h;
-}
-
-static inline int
-eq_cached_sock_errs(const struct cached_sock_errs_entry *a,
- const struct cached_sock_errs_entry *b)
-{
- return a->code == b->code;
-}
-
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
-static void *windows_socket_errors_lock_ = NULL;
-#endif
-
-static HT_HEAD(cached_sock_errs_map, cached_sock_errs_entry)
- windows_socket_errors = HT_INITIALIZER();
-
-HT_PROTOTYPE(cached_sock_errs_map,
- cached_sock_errs_entry,
- node,
- hash_cached_sock_errs,
- eq_cached_sock_errs);
-
-HT_GENERATE(cached_sock_errs_map,
- cached_sock_errs_entry,
- node,
- hash_cached_sock_errs,
- eq_cached_sock_errs,
- 0.5,
- mm_malloc,
- mm_realloc,
- mm_free);
-
+#ifdef _WIN32
+/* destructively remove a trailing line terminator from s */
+static void
+chomp (char *s)
+{
+ size_t len;
+ if (s && (len = strlen (s)) > 0 && s[len - 1] == '\n') {
+ s[--len] = 0;
+ if (len > 0 && s[len - 1] == '\r')
+ s[--len] = 0;
+ }
+}
+
+/* FormatMessage returns allocated strings, but evutil_socket_error_to_string
+ * is supposed to return a string which is good indefinitely without having
+ * to be freed. To make this work without leaking memory, we cache the
+ * string the first time FormatMessage is called on a particular error
+ * code, and then return the cached string on subsequent calls with the
+ * same code. The strings aren't freed until libevent_global_shutdown
+ * (or never). We use a linked list to cache the errors, because we
+ * only expect there to be a few dozen, and that should be fast enough.
+ */
+
+struct cached_sock_errs_entry {
+ HT_ENTRY(cached_sock_errs_entry) node;
+ DWORD code;
+ char *msg; /* allocated with LocalAlloc; free with LocalFree */
+};
+
+static inline unsigned
+hash_cached_sock_errs(const struct cached_sock_errs_entry *e)
+{
+ /* Use Murmur3's 32-bit finalizer as an integer hash function */
+ DWORD h = e->code;
+ h ^= h >> 16;
+ h *= 0x85ebca6b;
+ h ^= h >> 13;
+ h *= 0xc2b2ae35;
+ h ^= h >> 16;
+ return h;
+}
+
+static inline int
+eq_cached_sock_errs(const struct cached_sock_errs_entry *a,
+ const struct cached_sock_errs_entry *b)
+{
+ return a->code == b->code;
+}
+
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
+static void *windows_socket_errors_lock_ = NULL;
+#endif
+
+static HT_HEAD(cached_sock_errs_map, cached_sock_errs_entry)
+ windows_socket_errors = HT_INITIALIZER();
+
+HT_PROTOTYPE(cached_sock_errs_map,
+ cached_sock_errs_entry,
+ node,
+ hash_cached_sock_errs,
+ eq_cached_sock_errs);
+
+HT_GENERATE(cached_sock_errs_map,
+ cached_sock_errs_entry,
+ node,
+ hash_cached_sock_errs,
+ eq_cached_sock_errs,
+ 0.5,
+ mm_malloc,
+ mm_realloc,
+ mm_free);
+
/** Equivalent to strerror, but for windows socket errors. */
const char *
evutil_socket_error_to_string(int errcode)
{
- struct cached_sock_errs_entry *errs, *newerr, find;
- char *msg = NULL;
-
- EVLOCK_LOCK(windows_socket_errors_lock_, 0);
-
- find.code = errcode;
- errs = HT_FIND(cached_sock_errs_map, &windows_socket_errors, &find);
- if (errs) {
- msg = errs->msg;
- goto done;
- }
-
- if (0 != FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS |
- FORMAT_MESSAGE_ALLOCATE_BUFFER,
- NULL, errcode, 0, (char *)&msg, 0, NULL))
- chomp (msg); /* because message has trailing newline */
- else {
- size_t len = 50;
- /* use LocalAlloc because FormatMessage does */
- msg = LocalAlloc(LMEM_FIXED, len);
- if (!msg) {
- msg = (char *)"LocalAlloc failed during Winsock error";
- goto done;
- }
- evutil_snprintf(msg, len, "winsock error 0x%08x", errcode);
- }
-
- newerr = (struct cached_sock_errs_entry *)
- mm_malloc(sizeof (struct cached_sock_errs_entry));
-
- if (!newerr) {
- LocalFree(msg);
- msg = (char *)"malloc failed during Winsock error";
- goto done;
- }
-
- newerr->code = errcode;
- newerr->msg = msg;
- HT_INSERT(cached_sock_errs_map, &windows_socket_errors, newerr);
-
- done:
- EVLOCK_UNLOCK(windows_socket_errors_lock_, 0);
-
- return msg;
-}
-
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
-int
-evutil_global_setup_locks_(const int enable_locks)
-{
- EVTHREAD_SETUP_GLOBAL_LOCK(windows_socket_errors_lock_, 0);
- return 0;
-}
-#endif
-
-static void
-evutil_free_sock_err_globals(void)
-{
- struct cached_sock_errs_entry **errs, *tofree;
-
- for (errs = HT_START(cached_sock_errs_map, &windows_socket_errors)
- ; errs; ) {
- tofree = *errs;
- errs = HT_NEXT_RMV(cached_sock_errs_map,
- &windows_socket_errors,
- errs);
- LocalFree(tofree->msg);
- mm_free(tofree);
- }
-
- HT_CLEAR(cached_sock_errs_map, &windows_socket_errors);
-
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
- if (windows_socket_errors_lock_ != NULL) {
- EVTHREAD_FREE_LOCK(windows_socket_errors_lock_, 0);
- windows_socket_errors_lock_ = NULL;
- }
-#endif
-}
-
-#else
-
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
-int
-evutil_global_setup_locks_(const int enable_locks)
-{
- return 0;
-}
-#endif
-
-static void
-evutil_free_sock_err_globals(void)
-{
-}
-
-#endif
-
+ struct cached_sock_errs_entry *errs, *newerr, find;
+ char *msg = NULL;
+
+ EVLOCK_LOCK(windows_socket_errors_lock_, 0);
+
+ find.code = errcode;
+ errs = HT_FIND(cached_sock_errs_map, &windows_socket_errors, &find);
+ if (errs) {
+ msg = errs->msg;
+ goto done;
+ }
+
+ if (0 != FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS |
+ FORMAT_MESSAGE_ALLOCATE_BUFFER,
+ NULL, errcode, 0, (char *)&msg, 0, NULL))
+ chomp (msg); /* because message has trailing newline */
+ else {
+ size_t len = 50;
+ /* use LocalAlloc because FormatMessage does */
+ msg = LocalAlloc(LMEM_FIXED, len);
+ if (!msg) {
+ msg = (char *)"LocalAlloc failed during Winsock error";
+ goto done;
+ }
+ evutil_snprintf(msg, len, "winsock error 0x%08x", errcode);
+ }
+
+ newerr = (struct cached_sock_errs_entry *)
+ mm_malloc(sizeof (struct cached_sock_errs_entry));
+
+ if (!newerr) {
+ LocalFree(msg);
+ msg = (char *)"malloc failed during Winsock error";
+ goto done;
+ }
+
+ newerr->code = errcode;
+ newerr->msg = msg;
+ HT_INSERT(cached_sock_errs_map, &windows_socket_errors, newerr);
+
+ done:
+ EVLOCK_UNLOCK(windows_socket_errors_lock_, 0);
+
+ return msg;
+}
+
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
+int
+evutil_global_setup_locks_(const int enable_locks)
+{
+ EVTHREAD_SETUP_GLOBAL_LOCK(windows_socket_errors_lock_, 0);
+ return 0;
+}
+#endif
+
+static void
+evutil_free_sock_err_globals(void)
+{
+ struct cached_sock_errs_entry **errs, *tofree;
+
+ for (errs = HT_START(cached_sock_errs_map, &windows_socket_errors)
+ ; errs; ) {
+ tofree = *errs;
+ errs = HT_NEXT_RMV(cached_sock_errs_map,
+ &windows_socket_errors,
+ errs);
+ LocalFree(tofree->msg);
+ mm_free(tofree);
+ }
+
+ HT_CLEAR(cached_sock_errs_map, &windows_socket_errors);
+
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
+ if (windows_socket_errors_lock_ != NULL) {
+ EVTHREAD_FREE_LOCK(windows_socket_errors_lock_, 0);
+ windows_socket_errors_lock_ = NULL;
+ }
+#endif
+}
+
+#else
+
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
int
+evutil_global_setup_locks_(const int enable_locks)
+{
+ return 0;
+}
+#endif
+
+static void
+evutil_free_sock_err_globals(void)
+{
+}
+
+#endif
+
+int
evutil_snprintf(char *buf, size_t buflen, const char *format, ...)
{
int r;
@@ -1874,7 +1874,7 @@ evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap)
int r;
if (!buflen)
return 0;
-#if defined(_MSC_VER) || defined(_WIN32)
+#if defined(_MSC_VER) || defined(_WIN32)
r = _vsnprintf(buf, buflen, format, ap);
if (r < 0)
r = _vscprintf(format, ap);
@@ -1898,7 +1898,7 @@ evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap)
const char *
evutil_inet_ntop(int af, const void *src, char *dst, size_t len)
{
-#if defined(EVENT__HAVE_INET_NTOP) && !defined(USE_INTERNAL_NTOP)
+#if defined(EVENT__HAVE_INET_NTOP) && !defined(USE_INTERNAL_NTOP)
return inet_ntop(af, src, dst, len);
#else
if (af == AF_INET) {
@@ -2029,19 +2029,19 @@ evutil_inet_pton_scope(int af, const char *src, void *dst, unsigned *indexp)
int
evutil_inet_pton(int af, const char *src, void *dst)
{
-#if defined(EVENT__HAVE_INET_PTON) && !defined(USE_INTERNAL_PTON)
+#if defined(EVENT__HAVE_INET_PTON) && !defined(USE_INTERNAL_PTON)
return inet_pton(af, src, dst);
#else
if (af == AF_INET) {
- unsigned a,b,c,d;
+ unsigned a,b,c,d;
char more;
struct in_addr *addr = dst;
- if (sscanf(src, "%u.%u.%u.%u%c", &a,&b,&c,&d,&more) != 4)
+ if (sscanf(src, "%u.%u.%u.%u%c", &a,&b,&c,&d,&more) != 4)
return 0;
- if (a > 255) return 0;
- if (b > 255) return 0;
- if (c > 255) return 0;
- if (d > 255) return 0;
+ if (a > 255) return 0;
+ if (b > 255) return 0;
+ if (c > 255) return 0;
+ if (d > 255) return 0;
addr->s_addr = htonl((a<<24) | (b<<16) | (c<<8) | d);
return 1;
#ifdef AF_INET6
@@ -2056,22 +2056,22 @@ evutil_inet_pton(int af, const char *src, void *dst)
else if (!dot)
eow = src+strlen(src);
else {
- unsigned byte1,byte2,byte3,byte4;
+ unsigned byte1,byte2,byte3,byte4;
char more;
- for (eow = dot-1; eow >= src && EVUTIL_ISDIGIT_(*eow); --eow)
+ for (eow = dot-1; eow >= src && EVUTIL_ISDIGIT_(*eow); --eow)
;
++eow;
/* We use "scanf" because some platform inet_aton()s are too lax
* about IPv4 addresses of the form "1.2.3" */
- if (sscanf(eow, "%u.%u.%u.%u%c",
+ if (sscanf(eow, "%u.%u.%u.%u%c",
&byte1,&byte2,&byte3,&byte4,&more) != 4)
return 0;
- if (byte1 > 255 ||
- byte2 > 255 ||
- byte3 > 255 ||
- byte4 > 255)
+ if (byte1 > 255 ||
+ byte2 > 255 ||
+ byte3 > 255 ||
+ byte4 > 255)
return 0;
words[6] = (byte1<<8) | byte2;
@@ -2083,7 +2083,7 @@ evutil_inet_pton(int af, const char *src, void *dst)
while (src < eow) {
if (i > 7)
return 0;
- if (EVUTIL_ISXDIGIT_(*src)) {
+ if (EVUTIL_ISXDIGIT_(*src)) {
char *next;
long r = strtol(src, &next, 16);
if (next > 4+src)
@@ -2156,12 +2156,12 @@ evutil_parse_sockaddr_port(const char *ip_as_string, struct sockaddr *out, int *
cp = strchr(ip_as_string, ':');
if (*ip_as_string == '[') {
- size_t len;
+ size_t len;
if (!(cp = strchr(ip_as_string, ']'))) {
return -1;
}
- len = ( cp-(ip_as_string + 1) );
- if (len > sizeof(buf)-1) {
+ len = ( cp-(ip_as_string + 1) );
+ if (len > sizeof(buf)-1) {
return -1;
}
memcpy(buf, ip_as_string+1, len);
@@ -2207,7 +2207,7 @@ evutil_parse_sockaddr_port(const char *ip_as_string, struct sockaddr *out, int *
{
struct sockaddr_in6 sin6;
memset(&sin6, 0, sizeof(sin6));
-#ifdef EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
+#ifdef EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
sin6.sin6_len = sizeof(sin6);
#endif
sin6.sin6_family = AF_INET6;
@@ -2229,7 +2229,7 @@ evutil_parse_sockaddr_port(const char *ip_as_string, struct sockaddr *out, int *
{
struct sockaddr_in sin;
memset(&sin, 0, sizeof(sin));
-#ifdef EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
+#ifdef EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
sin.sin_len = sizeof(sin);
#endif
sin.sin_family = AF_INET;
@@ -2246,7 +2246,7 @@ evutil_parse_sockaddr_port(const char *ip_as_string, struct sockaddr *out, int *
}
const char *
-evutil_format_sockaddr_port_(const struct sockaddr *sa, char *out, size_t outlen)
+evutil_format_sockaddr_port_(const struct sockaddr *sa, char *out, size_t outlen)
{
char b[128];
const char *res=NULL;
@@ -2370,7 +2370,7 @@ static const unsigned char EVUTIL_TOLOWER_TABLE[256] = {
};
#define IMPL_CTYPE_FN(name) \
- int EVUTIL_##name##_(char c) { \
+ int EVUTIL_##name##_(char c) { \
ev_uint8_t u = c; \
return !!(EVUTIL_##name##_TABLE[(u >> 5) & 7] & (1U << (u & 31))); \
}
@@ -2383,11 +2383,11 @@ IMPL_CTYPE_FN(ISPRINT)
IMPL_CTYPE_FN(ISLOWER)
IMPL_CTYPE_FN(ISUPPER)
-char EVUTIL_TOLOWER_(char c)
+char EVUTIL_TOLOWER_(char c)
{
return ((char)EVUTIL_TOLOWER_TABLE[(ev_uint8_t)c]);
}
-char EVUTIL_TOUPPER_(char c)
+char EVUTIL_TOUPPER_(char c)
{
return ((char)EVUTIL_TOUPPER_TABLE[(ev_uint8_t)c]);
}
@@ -2396,8 +2396,8 @@ evutil_ascii_strcasecmp(const char *s1, const char *s2)
{
char c1, c2;
while (1) {
- c1 = EVUTIL_TOLOWER_(*s1++);
- c2 = EVUTIL_TOLOWER_(*s2++);
+ c1 = EVUTIL_TOLOWER_(*s1++);
+ c2 = EVUTIL_TOLOWER_(*s2++);
if (c1 < c2)
return -1;
else if (c1 > c2)
@@ -2410,8 +2410,8 @@ int evutil_ascii_strncasecmp(const char *s1, const char *s2, size_t n)
{
char c1, c2;
while (n--) {
- c1 = EVUTIL_TOLOWER_(*s1++);
- c2 = EVUTIL_TOLOWER_(*s2++);
+ c1 = EVUTIL_TOLOWER_(*s1++);
+ c2 = EVUTIL_TOLOWER_(*s2++);
if (c1 < c2)
return -1;
else if (c1 > c2)
@@ -2422,39 +2422,39 @@ int evutil_ascii_strncasecmp(const char *s1, const char *s2, size_t n)
return 0;
}
-void
-evutil_rtrim_lws_(char *str)
-{
- char *cp;
-
- if (str == NULL)
- return;
-
- if ((cp = strchr(str, '\0')) == NULL || (cp == str))
- return;
-
- --cp;
-
- while (*cp == ' ' || *cp == '\t') {
- *cp = '\0';
- if (cp == str)
- break;
- --cp;
- }
-}
-
+void
+evutil_rtrim_lws_(char *str)
+{
+ char *cp;
+
+ if (str == NULL)
+ return;
+
+ if ((cp = strchr(str, '\0')) == NULL || (cp == str))
+ return;
+
+ --cp;
+
+ while (*cp == ' ' || *cp == '\t') {
+ *cp = '\0';
+ if (cp == str)
+ break;
+ --cp;
+ }
+}
+
static int
evutil_issetugid(void)
{
-#ifdef EVENT__HAVE_ISSETUGID
+#ifdef EVENT__HAVE_ISSETUGID
return issetugid();
#else
-#ifdef EVENT__HAVE_GETEUID
+#ifdef EVENT__HAVE_GETEUID
if (getuid() != geteuid())
return 1;
#endif
-#ifdef EVENT__HAVE_GETEGID
+#ifdef EVENT__HAVE_GETEGID
if (getgid() != getegid())
return 1;
#endif
@@ -2463,7 +2463,7 @@ evutil_issetugid(void)
}
const char *
-evutil_getenv_(const char *varname)
+evutil_getenv_(const char *varname)
{
if (evutil_issetugid())
return NULL;
@@ -2471,54 +2471,54 @@ evutil_getenv_(const char *varname)
return getenv(varname);
}
-ev_uint32_t
-evutil_weakrand_seed_(struct evutil_weakrand_state *state, ev_uint32_t seed)
+ev_uint32_t
+evutil_weakrand_seed_(struct evutil_weakrand_state *state, ev_uint32_t seed)
{
- if (seed == 0) {
- struct timeval tv;
- evutil_gettimeofday(&tv, NULL);
- seed = (ev_uint32_t)tv.tv_sec + (ev_uint32_t)tv.tv_usec;
-#ifdef _WIN32
- seed += (ev_uint32_t) _getpid();
+ if (seed == 0) {
+ struct timeval tv;
+ evutil_gettimeofday(&tv, NULL);
+ seed = (ev_uint32_t)tv.tv_sec + (ev_uint32_t)tv.tv_usec;
+#ifdef _WIN32
+ seed += (ev_uint32_t) _getpid();
#else
- seed += (ev_uint32_t) getpid();
-#endif
- }
- state->seed = seed;
- return seed;
-}
-
-ev_int32_t
-evutil_weakrand_(struct evutil_weakrand_state *state)
-{
- /* This RNG implementation is a linear congruential generator, with
- * modulus 2^31, multiplier 1103515245, and addend 12345. It's also
- * used by OpenBSD, and by Glibc's TYPE_0 RNG.
- *
- * The linear congruential generator is not an industrial-strength
- * RNG! It's fast, but it can have higher-order patterns. Notably,
- * the low bits tend to have periodicity.
- */
- state->seed = ((state->seed) * 1103515245 + 12345) & 0x7fffffff;
- return (ev_int32_t)(state->seed);
-}
-
-ev_int32_t
-evutil_weakrand_range_(struct evutil_weakrand_state *state, ev_int32_t top)
-{
- ev_int32_t divisor, result;
-
- /* We can't just do weakrand() % top, since the low bits of the LCG
- * are less random than the high ones. (Specifically, since the LCG
- * modulus is 2^N, every 2^m for m<N will divide the modulus, and so
- * therefore the low m bits of the LCG will have period 2^m.) */
- divisor = EVUTIL_WEAKRAND_MAX / top;
- do {
- result = evutil_weakrand_(state) / divisor;
- } while (result >= top);
- return result;
-}
-
+ seed += (ev_uint32_t) getpid();
+#endif
+ }
+ state->seed = seed;
+ return seed;
+}
+
+ev_int32_t
+evutil_weakrand_(struct evutil_weakrand_state *state)
+{
+ /* This RNG implementation is a linear congruential generator, with
+ * modulus 2^31, multiplier 1103515245, and addend 12345. It's also
+ * used by OpenBSD, and by Glibc's TYPE_0 RNG.
+ *
+ * The linear congruential generator is not an industrial-strength
+ * RNG! It's fast, but it can have higher-order patterns. Notably,
+ * the low bits tend to have periodicity.
+ */
+ state->seed = ((state->seed) * 1103515245 + 12345) & 0x7fffffff;
+ return (ev_int32_t)(state->seed);
+}
+
+ev_int32_t
+evutil_weakrand_range_(struct evutil_weakrand_state *state, ev_int32_t top)
+{
+ ev_int32_t divisor, result;
+
+ /* We can't just do weakrand() % top, since the low bits of the LCG
+ * are less random than the high ones. (Specifically, since the LCG
+ * modulus is 2^N, every 2^m for m<N will divide the modulus, and so
+ * therefore the low m bits of the LCG will have period 2^m.) */
+ divisor = EVUTIL_WEAKRAND_MAX / top;
+ do {
+ result = evutil_weakrand_(state) / divisor;
+ } while (result >= top);
+ return result;
+}
+
/**
* Volatile pointer to memset: we use this to keep the compiler from
* eliminating our call to memset.
@@ -2532,7 +2532,7 @@ evutil_memclear_(void *mem, size_t len)
}
int
-evutil_sockaddr_is_loopback_(const struct sockaddr *addr)
+evutil_sockaddr_is_loopback_(const struct sockaddr *addr)
{
static const char LOOPBACK_S6[16] =
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1";
@@ -2547,7 +2547,7 @@ evutil_sockaddr_is_loopback_(const struct sockaddr *addr)
}
int
-evutil_hex_char_to_int_(char c)
+evutil_hex_char_to_int_(char c)
{
switch(c)
{
@@ -2571,9 +2571,9 @@ evutil_hex_char_to_int_(char c)
return -1;
}
-#ifdef _WIN32
-HMODULE
-evutil_load_windows_system_library_(const TCHAR *library_name)
+#ifdef _WIN32
+HMODULE
+evutil_load_windows_system_library_(const TCHAR *library_name)
{
TCHAR path[MAX_PATH];
unsigned n;
@@ -2586,183 +2586,183 @@ evutil_load_windows_system_library_(const TCHAR *library_name)
}
#endif
-/* Internal wrapper around 'socket' to provide Linux-style support for
- * syscall-saving methods where available.
- *
- * In addition to regular socket behavior, you can use a bitwise or to set the
- * flags EVUTIL_SOCK_NONBLOCK and EVUTIL_SOCK_CLOEXEC in the 'type' argument,
- * to make the socket nonblocking or close-on-exec with as few syscalls as
- * possible.
- */
-evutil_socket_t
-evutil_socket_(int domain, int type, int protocol)
-{
- evutil_socket_t r;
-#if defined(SOCK_NONBLOCK) && defined(SOCK_CLOEXEC)
- r = socket(domain, type, protocol);
- if (r >= 0)
- return r;
- else if ((type & (SOCK_NONBLOCK|SOCK_CLOEXEC)) == 0)
- return -1;
-#endif
-#define SOCKET_TYPE_MASK (~(EVUTIL_SOCK_NONBLOCK|EVUTIL_SOCK_CLOEXEC))
- r = socket(domain, type & SOCKET_TYPE_MASK, protocol);
- if (r < 0)
- return -1;
- if (type & EVUTIL_SOCK_NONBLOCK) {
- if (evutil_fast_socket_nonblocking(r) < 0) {
- evutil_closesocket(r);
- return -1;
- }
- }
- if (type & EVUTIL_SOCK_CLOEXEC) {
- if (evutil_fast_socket_closeonexec(r) < 0) {
- evutil_closesocket(r);
- return -1;
- }
- }
- return r;
-}
-
-/* Internal wrapper around 'accept' or 'accept4' to provide Linux-style
- * support for syscall-saving methods where available.
- *
- * In addition to regular accept behavior, you can set one or more of flags
- * EVUTIL_SOCK_NONBLOCK and EVUTIL_SOCK_CLOEXEC in the 'flags' argument, to
- * make the socket nonblocking or close-on-exec with as few syscalls as
- * possible.
- */
-evutil_socket_t
-evutil_accept4_(evutil_socket_t sockfd, struct sockaddr *addr,
- ev_socklen_t *addrlen, int flags)
-{
- evutil_socket_t result;
-#if defined(EVENT__HAVE_ACCEPT4) && defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
- result = accept4(sockfd, addr, addrlen, flags);
- if (result >= 0 || (errno != EINVAL && errno != ENOSYS)) {
- /* A nonnegative result means that we succeeded, so return.
- * Failing with EINVAL means that an option wasn't supported,
- * and failing with ENOSYS means that the syscall wasn't
- * there: in those cases we want to fall back. Otherwise, we
- * got a real error, and we should return. */
- return result;
- }
-#endif
- result = accept(sockfd, addr, addrlen);
- if (result < 0)
- return result;
-
- if (flags & EVUTIL_SOCK_CLOEXEC) {
- if (evutil_fast_socket_closeonexec(result) < 0) {
- evutil_closesocket(result);
- return -1;
- }
- }
- if (flags & EVUTIL_SOCK_NONBLOCK) {
- if (evutil_fast_socket_nonblocking(result) < 0) {
- evutil_closesocket(result);
- return -1;
- }
- }
- return result;
-}
-
-/* Internal function: Set fd[0] and fd[1] to a pair of fds such that writes on
- * fd[1] get read from fd[0]. Make both fds nonblocking and close-on-exec.
- * Return 0 on success, -1 on failure.
- */
-int
-evutil_make_internal_pipe_(evutil_socket_t fd[2])
-{
- /*
- Making the second socket nonblocking is a bit subtle, given that we
- ignore any EAGAIN returns when writing to it, and you don't usally
- do that for a nonblocking socket. But if the kernel gives us EAGAIN,
- then there's no need to add any more data to the buffer, since
- the main thread is already either about to wake up and drain it,
- or woken up and in the process of draining it.
- */
-
-#if defined(EVENT__HAVE_PIPE2)
- if (pipe2(fd, O_NONBLOCK|O_CLOEXEC) == 0)
- return 0;
-#endif
-#if defined(EVENT__HAVE_PIPE)
- if (pipe(fd) == 0) {
- if (evutil_fast_socket_nonblocking(fd[0]) < 0 ||
- evutil_fast_socket_nonblocking(fd[1]) < 0 ||
- evutil_fast_socket_closeonexec(fd[0]) < 0 ||
- evutil_fast_socket_closeonexec(fd[1]) < 0) {
- close(fd[0]);
- close(fd[1]);
- fd[0] = fd[1] = -1;
- return -1;
- }
- return 0;
- } else {
- event_warn("%s: pipe", __func__);
- }
-#endif
-
-#ifdef _WIN32
-#define LOCAL_SOCKETPAIR_AF AF_INET
-#else
-#define LOCAL_SOCKETPAIR_AF AF_UNIX
-#endif
- if (evutil_socketpair(LOCAL_SOCKETPAIR_AF, SOCK_STREAM, 0, fd) == 0) {
- if (evutil_fast_socket_nonblocking(fd[0]) < 0 ||
- evutil_fast_socket_nonblocking(fd[1]) < 0 ||
- evutil_fast_socket_closeonexec(fd[0]) < 0 ||
- evutil_fast_socket_closeonexec(fd[1]) < 0) {
- evutil_closesocket(fd[0]);
- evutil_closesocket(fd[1]);
- fd[0] = fd[1] = -1;
- return -1;
- }
- return 0;
- }
- fd[0] = fd[1] = -1;
- return -1;
-}
-
-/* Wrapper around eventfd on systems that provide it. Unlike the system
- * eventfd, it always supports EVUTIL_EFD_CLOEXEC and EVUTIL_EFD_NONBLOCK as
- * flags. Returns -1 on error or if eventfd is not supported.
- */
-evutil_socket_t
-evutil_eventfd_(unsigned initval, int flags)
-{
-#if defined(EVENT__HAVE_EVENTFD) && defined(EVENT__HAVE_SYS_EVENTFD_H)
- int r;
-#if defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK)
- r = eventfd(initval, flags);
- if (r >= 0 || flags == 0)
- return r;
-#endif
- r = eventfd(initval, 0);
- if (r < 0)
- return r;
- if (flags & EVUTIL_EFD_CLOEXEC) {
- if (evutil_fast_socket_closeonexec(r) < 0) {
- evutil_closesocket(r);
- return -1;
- }
- }
- if (flags & EVUTIL_EFD_NONBLOCK) {
- if (evutil_fast_socket_nonblocking(r) < 0) {
- evutil_closesocket(r);
- return -1;
- }
- }
- return r;
-#else
- return -1;
-#endif
-}
-
-void
-evutil_free_globals_(void)
-{
- evutil_free_secure_rng_globals_();
- evutil_free_sock_err_globals();
-}
+/* Internal wrapper around 'socket' to provide Linux-style support for
+ * syscall-saving methods where available.
+ *
+ * In addition to regular socket behavior, you can use a bitwise or to set the
+ * flags EVUTIL_SOCK_NONBLOCK and EVUTIL_SOCK_CLOEXEC in the 'type' argument,
+ * to make the socket nonblocking or close-on-exec with as few syscalls as
+ * possible.
+ */
+evutil_socket_t
+evutil_socket_(int domain, int type, int protocol)
+{
+ evutil_socket_t r;
+#if defined(SOCK_NONBLOCK) && defined(SOCK_CLOEXEC)
+ r = socket(domain, type, protocol);
+ if (r >= 0)
+ return r;
+ else if ((type & (SOCK_NONBLOCK|SOCK_CLOEXEC)) == 0)
+ return -1;
+#endif
+#define SOCKET_TYPE_MASK (~(EVUTIL_SOCK_NONBLOCK|EVUTIL_SOCK_CLOEXEC))
+ r = socket(domain, type & SOCKET_TYPE_MASK, protocol);
+ if (r < 0)
+ return -1;
+ if (type & EVUTIL_SOCK_NONBLOCK) {
+ if (evutil_fast_socket_nonblocking(r) < 0) {
+ evutil_closesocket(r);
+ return -1;
+ }
+ }
+ if (type & EVUTIL_SOCK_CLOEXEC) {
+ if (evutil_fast_socket_closeonexec(r) < 0) {
+ evutil_closesocket(r);
+ return -1;
+ }
+ }
+ return r;
+}
+
+/* Internal wrapper around 'accept' or 'accept4' to provide Linux-style
+ * support for syscall-saving methods where available.
+ *
+ * In addition to regular accept behavior, you can set one or more of flags
+ * EVUTIL_SOCK_NONBLOCK and EVUTIL_SOCK_CLOEXEC in the 'flags' argument, to
+ * make the socket nonblocking or close-on-exec with as few syscalls as
+ * possible.
+ */
+evutil_socket_t
+evutil_accept4_(evutil_socket_t sockfd, struct sockaddr *addr,
+ ev_socklen_t *addrlen, int flags)
+{
+ evutil_socket_t result;
+#if defined(EVENT__HAVE_ACCEPT4) && defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
+ result = accept4(sockfd, addr, addrlen, flags);
+ if (result >= 0 || (errno != EINVAL && errno != ENOSYS)) {
+ /* A nonnegative result means that we succeeded, so return.
+ * Failing with EINVAL means that an option wasn't supported,
+ * and failing with ENOSYS means that the syscall wasn't
+ * there: in those cases we want to fall back. Otherwise, we
+ * got a real error, and we should return. */
+ return result;
+ }
+#endif
+ result = accept(sockfd, addr, addrlen);
+ if (result < 0)
+ return result;
+
+ if (flags & EVUTIL_SOCK_CLOEXEC) {
+ if (evutil_fast_socket_closeonexec(result) < 0) {
+ evutil_closesocket(result);
+ return -1;
+ }
+ }
+ if (flags & EVUTIL_SOCK_NONBLOCK) {
+ if (evutil_fast_socket_nonblocking(result) < 0) {
+ evutil_closesocket(result);
+ return -1;
+ }
+ }
+ return result;
+}
+
+/* Internal function: Set fd[0] and fd[1] to a pair of fds such that writes on
+ * fd[1] get read from fd[0]. Make both fds nonblocking and close-on-exec.
+ * Return 0 on success, -1 on failure.
+ */
+int
+evutil_make_internal_pipe_(evutil_socket_t fd[2])
+{
+ /*
+ Making the second socket nonblocking is a bit subtle, given that we
+ ignore any EAGAIN returns when writing to it, and you don't usally
+ do that for a nonblocking socket. But if the kernel gives us EAGAIN,
+ then there's no need to add any more data to the buffer, since
+ the main thread is already either about to wake up and drain it,
+ or woken up and in the process of draining it.
+ */
+
+#if defined(EVENT__HAVE_PIPE2)
+ if (pipe2(fd, O_NONBLOCK|O_CLOEXEC) == 0)
+ return 0;
+#endif
+#if defined(EVENT__HAVE_PIPE)
+ if (pipe(fd) == 0) {
+ if (evutil_fast_socket_nonblocking(fd[0]) < 0 ||
+ evutil_fast_socket_nonblocking(fd[1]) < 0 ||
+ evutil_fast_socket_closeonexec(fd[0]) < 0 ||
+ evutil_fast_socket_closeonexec(fd[1]) < 0) {
+ close(fd[0]);
+ close(fd[1]);
+ fd[0] = fd[1] = -1;
+ return -1;
+ }
+ return 0;
+ } else {
+ event_warn("%s: pipe", __func__);
+ }
+#endif
+
+#ifdef _WIN32
+#define LOCAL_SOCKETPAIR_AF AF_INET
+#else
+#define LOCAL_SOCKETPAIR_AF AF_UNIX
+#endif
+ if (evutil_socketpair(LOCAL_SOCKETPAIR_AF, SOCK_STREAM, 0, fd) == 0) {
+ if (evutil_fast_socket_nonblocking(fd[0]) < 0 ||
+ evutil_fast_socket_nonblocking(fd[1]) < 0 ||
+ evutil_fast_socket_closeonexec(fd[0]) < 0 ||
+ evutil_fast_socket_closeonexec(fd[1]) < 0) {
+ evutil_closesocket(fd[0]);
+ evutil_closesocket(fd[1]);
+ fd[0] = fd[1] = -1;
+ return -1;
+ }
+ return 0;
+ }
+ fd[0] = fd[1] = -1;
+ return -1;
+}
+
+/* Wrapper around eventfd on systems that provide it. Unlike the system
+ * eventfd, it always supports EVUTIL_EFD_CLOEXEC and EVUTIL_EFD_NONBLOCK as
+ * flags. Returns -1 on error or if eventfd is not supported.
+ */
+evutil_socket_t
+evutil_eventfd_(unsigned initval, int flags)
+{
+#if defined(EVENT__HAVE_EVENTFD) && defined(EVENT__HAVE_SYS_EVENTFD_H)
+ int r;
+#if defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK)
+ r = eventfd(initval, flags);
+ if (r >= 0 || flags == 0)
+ return r;
+#endif
+ r = eventfd(initval, 0);
+ if (r < 0)
+ return r;
+ if (flags & EVUTIL_EFD_CLOEXEC) {
+ if (evutil_fast_socket_closeonexec(r) < 0) {
+ evutil_closesocket(r);
+ return -1;
+ }
+ }
+ if (flags & EVUTIL_EFD_NONBLOCK) {
+ if (evutil_fast_socket_nonblocking(r) < 0) {
+ evutil_closesocket(r);
+ return -1;
+ }
+ }
+ return r;
+#else
+ return -1;
+#endif
+}
+
+void
+evutil_free_globals_(void)
+{
+ evutil_free_secure_rng_globals_();
+ evutil_free_sock_err_globals();
+}
diff --git a/contrib/libs/libevent/evutil_rand.c b/contrib/libs/libevent/evutil_rand.c
index 8e9afdaa67..974e569362 100644
--- a/contrib/libs/libevent/evutil_rand.c
+++ b/contrib/libs/libevent/evutil_rand.c
@@ -33,14 +33,14 @@
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
#include <limits.h>
#include "util-internal.h"
#include "evthread-internal.h"
-#ifdef EVENT__HAVE_ARC4RANDOM
+#ifdef EVENT__HAVE_ARC4RANDOM
#include <stdlib.h>
#include <string.h>
int
@@ -56,28 +56,28 @@ evutil_secure_rng_init(void)
(void) arc4random();
return 0;
}
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
int
evutil_secure_rng_global_setup_locks_(const int enable_locks)
{
return 0;
}
-#endif
-static void
-evutil_free_secure_rng_globals_locks(void)
-{
-}
+#endif
+static void
+evutil_free_secure_rng_globals_locks(void)
+{
+}
static void
ev_arc4random_buf(void *buf, size_t n)
{
-#if defined(EVENT__HAVE_ARC4RANDOM_BUF) && !defined(__APPLE__)
- arc4random_buf(buf, n);
- return;
+#if defined(EVENT__HAVE_ARC4RANDOM_BUF) && !defined(__APPLE__)
+ arc4random_buf(buf, n);
+ return;
#else
unsigned char *b = buf;
-#if defined(EVENT__HAVE_ARC4RANDOM_BUF)
+#if defined(EVENT__HAVE_ARC4RANDOM_BUF)
/* OSX 10.7 introducd arc4random_buf, so if you build your program
* there, you'll get surprised when older versions of OSX fail to run.
* To solve this, we can check whether the function pointer is set,
@@ -88,8 +88,8 @@ ev_arc4random_buf(void *buf, size_t n)
void (*tptr)(void *,size_t) =
(void (*)(void*,size_t))arc4random_buf;
if (tptr != NULL) {
- arc4random_buf(buf, n);
- return;
+ arc4random_buf(buf, n);
+ return;
}
}
#endif
@@ -114,15 +114,15 @@ ev_arc4random_buf(void *buf, size_t n)
#endif
}
-#else /* !EVENT__HAVE_ARC4RANDOM { */
+#else /* !EVENT__HAVE_ARC4RANDOM { */
-#ifdef EVENT__ssize_t
-#define ssize_t EVENT__ssize_t
+#ifdef EVENT__ssize_t
+#define ssize_t EVENT__ssize_t
#endif
#define ARC4RANDOM_EXPORT static
-#define ARC4_LOCK_() EVLOCK_LOCK(arc4rand_lock, 0)
-#define ARC4_UNLOCK_() EVLOCK_UNLOCK(arc4rand_lock, 0)
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#define ARC4_LOCK_() EVLOCK_LOCK(arc4rand_lock, 0)
+#define ARC4_UNLOCK_() EVLOCK_UNLOCK(arc4rand_lock, 0)
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
static void *arc4rand_lock;
#endif
@@ -133,7 +133,7 @@ static void *arc4rand_lock;
#include "./arc4random.c"
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
int
evutil_secure_rng_global_setup_locks_(const int enable_locks)
{
@@ -142,25 +142,25 @@ evutil_secure_rng_global_setup_locks_(const int enable_locks)
}
#endif
-static void
-evutil_free_secure_rng_globals_locks(void)
-{
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
- if (arc4rand_lock != NULL) {
- EVTHREAD_FREE_LOCK(arc4rand_lock, 0);
- arc4rand_lock = NULL;
- }
-#endif
- return;
-}
-
+static void
+evutil_free_secure_rng_globals_locks(void)
+{
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
+ if (arc4rand_lock != NULL) {
+ EVTHREAD_FREE_LOCK(arc4rand_lock, 0);
+ arc4rand_lock = NULL;
+ }
+#endif
+ return;
+}
+
int
evutil_secure_rng_set_urandom_device_file(char *fname)
{
#ifdef TRY_SEED_URANDOM
- ARC4_LOCK_();
+ ARC4_LOCK_();
arc4random_urandom_filename = fname;
- ARC4_UNLOCK_();
+ ARC4_UNLOCK_();
#endif
return 0;
}
@@ -170,9 +170,9 @@ evutil_secure_rng_init(void)
{
int val;
- ARC4_LOCK_();
- val = (!arc4_stir()) ? 0 : -1;
- ARC4_UNLOCK_();
+ ARC4_LOCK_();
+ val = (!arc4_stir()) ? 0 : -1;
+ ARC4_UNLOCK_();
return val;
}
@@ -182,7 +182,7 @@ ev_arc4random_buf(void *buf, size_t n)
arc4random_buf(buf, n);
}
-#endif /* } !EVENT__HAVE_ARC4RANDOM */
+#endif /* } !EVENT__HAVE_ARC4RANDOM */
void
evutil_secure_rng_get_bytes(void *buf, size_t n)
@@ -190,17 +190,17 @@ evutil_secure_rng_get_bytes(void *buf, size_t n)
ev_arc4random_buf(buf, n);
}
-#if !defined(EVENT__HAVE_ARC4RANDOM) || defined(EVENT__HAVE_ARC4RANDOM_ADDRANDOM)
+#if !defined(EVENT__HAVE_ARC4RANDOM) || defined(EVENT__HAVE_ARC4RANDOM_ADDRANDOM)
void
evutil_secure_rng_add_bytes(const char *buf, size_t n)
{
arc4random_addrandom((unsigned char*)buf,
n>(size_t)INT_MAX ? INT_MAX : (int)n);
}
-#endif
+#endif
-void
-evutil_free_secure_rng_globals_(void)
-{
- evutil_free_secure_rng_globals_locks();
-}
+void
+evutil_free_secure_rng_globals_(void)
+{
+ evutil_free_secure_rng_globals_locks();
+}
diff --git a/contrib/libs/libevent/evutil_time.c b/contrib/libs/libevent/evutil_time.c
index c327218227..90ac35e2d9 100644
--- a/contrib/libs/libevent/evutil_time.c
+++ b/contrib/libs/libevent/evutil_time.c
@@ -1,101 +1,101 @@
-/*
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "event2/event-config.h"
-#include "evconfig-private.h"
-
-#ifdef _WIN32
-#include <winsock2.h>
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-#endif
-
-#include <sys/types.h>
-#ifdef EVENT__HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include <errno.h>
-#include <limits.h>
-#ifndef EVENT__HAVE_GETTIMEOFDAY
-#include <sys/timeb.h>
-#endif
-#if !defined(EVENT__HAVE_NANOSLEEP) && !defined(EVENT__HAVE_USLEEP) && \
- !defined(_WIN32)
-#include <sys/select.h>
-#endif
-#include <time.h>
-#include <sys/stat.h>
-#include <string.h>
-
-/** evutil_usleep_() */
-#if defined(_WIN32)
-#elif defined(EVENT__HAVE_NANOSLEEP)
-#elif defined(EVENT__HAVE_USLEEP)
-#include <unistd.h>
-#endif
-
-#include "event2/util.h"
-#include "util-internal.h"
-#include "log-internal.h"
-#include "mm-internal.h"
-
-#ifndef EVENT__HAVE_GETTIMEOFDAY
-/* No gettimeofday; this must be windows. */
+/*
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "event2/event-config.h"
+#include "evconfig-private.h"
+
+#ifdef _WIN32
+#include <winsock2.h>
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+#endif
+
+#include <sys/types.h>
+#ifdef EVENT__HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <errno.h>
+#include <limits.h>
+#ifndef EVENT__HAVE_GETTIMEOFDAY
+#include <sys/timeb.h>
+#endif
+#if !defined(EVENT__HAVE_NANOSLEEP) && !defined(EVENT__HAVE_USLEEP) && \
+ !defined(_WIN32)
+#include <sys/select.h>
+#endif
+#include <time.h>
+#include <sys/stat.h>
+#include <string.h>
+
+/** evutil_usleep_() */
+#if defined(_WIN32)
+#elif defined(EVENT__HAVE_NANOSLEEP)
+#elif defined(EVENT__HAVE_USLEEP)
+#include <unistd.h>
+#endif
+
+#include "event2/util.h"
+#include "util-internal.h"
+#include "log-internal.h"
+#include "mm-internal.h"
+
+#ifndef EVENT__HAVE_GETTIMEOFDAY
+/* No gettimeofday; this must be windows. */
typedef void (WINAPI *GetSystemTimePreciseAsFileTime_fn_t) (LPFILETIME);
-int
-evutil_gettimeofday(struct timeval *tv, struct timezone *tz)
-{
-#ifdef _MSC_VER
-#define U64_LITERAL(n) n##ui64
-#else
-#define U64_LITERAL(n) n##llu
-#endif
-
- /* Conversion logic taken from Tor, which in turn took it
- * from Perl. GetSystemTimeAsFileTime returns its value as
- * an unaligned (!) 64-bit value containing the number of
- * 100-nanosecond intervals since 1 January 1601 UTC. */
-#define EPOCH_BIAS U64_LITERAL(116444736000000000)
-#define UNITS_PER_SEC U64_LITERAL(10000000)
-#define USEC_PER_SEC U64_LITERAL(1000000)
-#define UNITS_PER_USEC U64_LITERAL(10)
- union {
- FILETIME ft_ft;
- ev_uint64_t ft_64;
- } ft;
-
- if (tv == NULL)
- return -1;
-
+int
+evutil_gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+#ifdef _MSC_VER
+#define U64_LITERAL(n) n##ui64
+#else
+#define U64_LITERAL(n) n##llu
+#endif
+
+ /* Conversion logic taken from Tor, which in turn took it
+ * from Perl. GetSystemTimeAsFileTime returns its value as
+ * an unaligned (!) 64-bit value containing the number of
+ * 100-nanosecond intervals since 1 January 1601 UTC. */
+#define EPOCH_BIAS U64_LITERAL(116444736000000000)
+#define UNITS_PER_SEC U64_LITERAL(10000000)
+#define USEC_PER_SEC U64_LITERAL(1000000)
+#define UNITS_PER_USEC U64_LITERAL(10)
+ union {
+ FILETIME ft_ft;
+ ev_uint64_t ft_64;
+ } ft;
+
+ if (tv == NULL)
+ return -1;
+
static GetSystemTimePreciseAsFileTime_fn_t GetSystemTimePreciseAsFileTime_fn = NULL;
static int check_precise = 1;
-
+
if (EVUTIL_UNLIKELY(check_precise)) {
HMODULE h = evutil_load_windows_system_library_(TEXT("kernel32.dll"));
if (h != NULL)
@@ -110,40 +110,40 @@ evutil_gettimeofday(struct timeval *tv, struct timezone *tz)
else
GetSystemTimeAsFileTime(&ft.ft_ft);
- if (EVUTIL_UNLIKELY(ft.ft_64 < EPOCH_BIAS)) {
- /* Time before the unix epoch. */
- return -1;
- }
- ft.ft_64 -= EPOCH_BIAS;
- tv->tv_sec = (long) (ft.ft_64 / UNITS_PER_SEC);
- tv->tv_usec = (long) ((ft.ft_64 / UNITS_PER_USEC) % USEC_PER_SEC);
- return 0;
-}
-#endif
-
-#define MAX_SECONDS_IN_MSEC_LONG \
- (((LONG_MAX) - 999) / 1000)
-
-long
-evutil_tv_to_msec_(const struct timeval *tv)
-{
- if (tv->tv_usec > 1000000 || tv->tv_sec > MAX_SECONDS_IN_MSEC_LONG)
- return -1;
-
- return (tv->tv_sec * 1000) + ((tv->tv_usec + 999) / 1000);
-}
-
-/*
- Replacement for usleep on platforms that don't have one. Not guaranteed to
- be any more finegrained than 1 msec.
- */
-void
-evutil_usleep_(const struct timeval *tv)
-{
- if (!tv)
- return;
-#if defined(_WIN32)
- {
+ if (EVUTIL_UNLIKELY(ft.ft_64 < EPOCH_BIAS)) {
+ /* Time before the unix epoch. */
+ return -1;
+ }
+ ft.ft_64 -= EPOCH_BIAS;
+ tv->tv_sec = (long) (ft.ft_64 / UNITS_PER_SEC);
+ tv->tv_usec = (long) ((ft.ft_64 / UNITS_PER_USEC) % USEC_PER_SEC);
+ return 0;
+}
+#endif
+
+#define MAX_SECONDS_IN_MSEC_LONG \
+ (((LONG_MAX) - 999) / 1000)
+
+long
+evutil_tv_to_msec_(const struct timeval *tv)
+{
+ if (tv->tv_usec > 1000000 || tv->tv_sec > MAX_SECONDS_IN_MSEC_LONG)
+ return -1;
+
+ return (tv->tv_sec * 1000) + ((tv->tv_usec + 999) / 1000);
+}
+
+/*
+ Replacement for usleep on platforms that don't have one. Not guaranteed to
+ be any more finegrained than 1 msec.
+ */
+void
+evutil_usleep_(const struct timeval *tv)
+{
+ if (!tv)
+ return;
+#if defined(_WIN32)
+ {
__int64 usec;
LARGE_INTEGER li;
HANDLE timer;
@@ -160,45 +160,45 @@ evutil_usleep_(const struct timeval *tv)
SetWaitableTimer(timer, &li, 0, NULL, NULL, 0);
WaitForSingleObject(timer, INFINITE);
CloseHandle(timer);
- }
-#elif defined(EVENT__HAVE_NANOSLEEP)
- {
- struct timespec ts;
- ts.tv_sec = tv->tv_sec;
- ts.tv_nsec = tv->tv_usec*1000;
- nanosleep(&ts, NULL);
- }
-#elif defined(EVENT__HAVE_USLEEP)
- /* Some systems don't like to usleep more than 999999 usec */
- sleep(tv->tv_sec);
- usleep(tv->tv_usec);
-#else
- {
- struct timeval tv2 = *tv;
- select(0, NULL, NULL, NULL, &tv2);
- }
-#endif
-}
-
-int
-evutil_date_rfc1123(char *date, const size_t datelen, const struct tm *tm)
-{
- static const char *DAYS[] =
- { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
- static const char *MONTHS[] =
- { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
-
- time_t t = time(NULL);
-
+ }
+#elif defined(EVENT__HAVE_NANOSLEEP)
+ {
+ struct timespec ts;
+ ts.tv_sec = tv->tv_sec;
+ ts.tv_nsec = tv->tv_usec*1000;
+ nanosleep(&ts, NULL);
+ }
+#elif defined(EVENT__HAVE_USLEEP)
+ /* Some systems don't like to usleep more than 999999 usec */
+ sleep(tv->tv_sec);
+ usleep(tv->tv_usec);
+#else
+ {
+ struct timeval tv2 = *tv;
+ select(0, NULL, NULL, NULL, &tv2);
+ }
+#endif
+}
+
+int
+evutil_date_rfc1123(char *date, const size_t datelen, const struct tm *tm)
+{
+ static const char *DAYS[] =
+ { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
+ static const char *MONTHS[] =
+ { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+ time_t t = time(NULL);
+
#if defined(EVENT__HAVE__GMTIME64_S) || !defined(_WIN32)
- struct tm sys;
-#endif
-
- /* If `tm` is null, set system's current time. */
- if (tm == NULL) {
+ struct tm sys;
+#endif
+
+ /* If `tm` is null, set system's current time. */
+ if (tm == NULL) {
#if !defined(_WIN32)
- gmtime_r(&t, &sys);
- tm = &sys;
+ gmtime_r(&t, &sys);
+ tm = &sys;
/** detect _gmtime64()/_gmtime64_s() */
#elif defined(EVENT__HAVE__GMTIME64_S)
errno_t err;
@@ -212,410 +212,410 @@ evutil_date_rfc1123(char *date, const size_t datelen, const struct tm *tm)
tm = _gmtime64(&t);
#else
tm = gmtime(&t);
-#endif
- }
-
- return evutil_snprintf(
- date, datelen, "%s, %02d %s %4d %02d:%02d:%02d GMT",
- DAYS[tm->tm_wday], tm->tm_mday, MONTHS[tm->tm_mon],
- 1900 + tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec);
-}
-
-/*
- This function assumes it's called repeatedly with a
- not-actually-so-monotonic time source whose outputs are in 'tv'. It
- implements a trivial ratcheting mechanism so that the values never go
- backwards.
- */
-static void
-adjust_monotonic_time(struct evutil_monotonic_timer *base,
- struct timeval *tv)
-{
- evutil_timeradd(tv, &base->adjust_monotonic_clock, tv);
-
- if (evutil_timercmp(tv, &base->last_time, <)) {
- /* Guess it wasn't monotonic after all. */
- struct timeval adjust;
- evutil_timersub(&base->last_time, tv, &adjust);
- evutil_timeradd(&adjust, &base->adjust_monotonic_clock,
- &base->adjust_monotonic_clock);
- *tv = base->last_time;
- }
- base->last_time = *tv;
-}
-
-/*
- Allocate a new struct evutil_monotonic_timer
- */
-struct evutil_monotonic_timer *
-evutil_monotonic_timer_new(void)
-{
- struct evutil_monotonic_timer *p = NULL;
-
- p = mm_malloc(sizeof(*p));
- if (!p) goto done;
-
- memset(p, 0, sizeof(*p));
-
- done:
- return p;
-}
-
-/*
- Free a struct evutil_monotonic_timer
- */
-void
-evutil_monotonic_timer_free(struct evutil_monotonic_timer *timer)
-{
- if (timer) {
- mm_free(timer);
- }
-}
-
-/*
- Set up a struct evutil_monotonic_timer for initial use
- */
-int
-evutil_configure_monotonic_time(struct evutil_monotonic_timer *timer,
- int flags)
-{
- return evutil_configure_monotonic_time_(timer, flags);
-}
-
-/*
- Query the current monotonic time
- */
-int
-evutil_gettime_monotonic(struct evutil_monotonic_timer *timer,
- struct timeval *tp)
-{
- return evutil_gettime_monotonic_(timer, tp);
-}
-
-
-#if defined(HAVE_POSIX_MONOTONIC)
-/* =====
- The POSIX clock_gettime() interface provides a few ways to get at a
- monotonic clock. CLOCK_MONOTONIC is most widely supported. Linux also
- provides a CLOCK_MONOTONIC_COARSE with accuracy of about 1-4 msec.
-
- On all platforms I'm aware of, CLOCK_MONOTONIC really is monotonic.
- Platforms don't agree about whether it should jump on a sleep/resume.
- */
-
-int
-evutil_configure_monotonic_time_(struct evutil_monotonic_timer *base,
- int flags)
-{
- /* CLOCK_MONOTONIC exists on FreeBSD, Linux, and Solaris. You need to
- * check for it at runtime, because some older kernel versions won't
- * have it working. */
-#ifdef CLOCK_MONOTONIC_COARSE
- const int precise = flags & EV_MONOT_PRECISE;
-#endif
- const int fallback = flags & EV_MONOT_FALLBACK;
- struct timespec ts;
-
-#ifdef CLOCK_MONOTONIC_COARSE
- if (CLOCK_MONOTONIC_COARSE < 0) {
- /* Technically speaking, nothing keeps CLOCK_* from being
- * negative (as far as I know). This check and the one below
- * make sure that it's safe for us to use -1 as an "unset"
- * value. */
- event_errx(1,"I didn't expect CLOCK_MONOTONIC_COARSE to be < 0");
- }
- if (! precise && ! fallback) {
- if (clock_gettime(CLOCK_MONOTONIC_COARSE, &ts) == 0) {
- base->monotonic_clock = CLOCK_MONOTONIC_COARSE;
- return 0;
- }
- }
-#endif
- if (!fallback && clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
- base->monotonic_clock = CLOCK_MONOTONIC;
- return 0;
- }
-
- if (CLOCK_MONOTONIC < 0) {
- event_errx(1,"I didn't expect CLOCK_MONOTONIC to be < 0");
- }
-
- base->monotonic_clock = -1;
- return 0;
-}
-
-int
-evutil_gettime_monotonic_(struct evutil_monotonic_timer *base,
- struct timeval *tp)
-{
- struct timespec ts;
-
- if (base->monotonic_clock < 0) {
- if (evutil_gettimeofday(tp, NULL) < 0)
- return -1;
- adjust_monotonic_time(base, tp);
- return 0;
- }
-
- if (clock_gettime(base->monotonic_clock, &ts) == -1)
- return -1;
- tp->tv_sec = ts.tv_sec;
- tp->tv_usec = ts.tv_nsec / 1000;
-
- return 0;
-}
-#endif
-
-#if defined(HAVE_MACH_MONOTONIC)
-/* ======
- Apple is a little late to the POSIX party. And why not? Instead of
- clock_gettime(), they provide mach_absolute_time(). Its units are not
- fixed; we need to use mach_timebase_info() to get the right functions to
- convert its units into nanoseconds.
-
- To all appearances, mach_absolute_time() seems to be honest-to-goodness
- monotonic. Whether it stops during sleep or not is unspecified in
- principle, and dependent on CPU architecture in practice.
- */
-
-int
-evutil_configure_monotonic_time_(struct evutil_monotonic_timer *base,
- int flags)
-{
- const int fallback = flags & EV_MONOT_FALLBACK;
- struct mach_timebase_info mi;
- memset(base, 0, sizeof(*base));
- /* OSX has mach_absolute_time() */
- if (!fallback &&
- mach_timebase_info(&mi) == 0 &&
- mach_absolute_time() != 0) {
- /* mach_timebase_info tells us how to convert
- * mach_absolute_time() into nanoseconds, but we
- * want to use microseconds instead. */
- mi.denom *= 1000;
- memcpy(&base->mach_timebase_units, &mi, sizeof(mi));
- } else {
- base->mach_timebase_units.numer = 0;
- }
- return 0;
-}
-
-int
-evutil_gettime_monotonic_(struct evutil_monotonic_timer *base,
- struct timeval *tp)
-{
- ev_uint64_t abstime, usec;
- if (base->mach_timebase_units.numer == 0) {
- if (evutil_gettimeofday(tp, NULL) < 0)
- return -1;
- adjust_monotonic_time(base, tp);
- return 0;
- }
-
- abstime = mach_absolute_time();
- usec = (abstime * base->mach_timebase_units.numer)
- / (base->mach_timebase_units.denom);
- tp->tv_sec = usec / 1000000;
- tp->tv_usec = usec % 1000000;
-
- return 0;
-}
-#endif
-
-#if defined(HAVE_WIN32_MONOTONIC)
-/* =====
- Turn we now to Windows. Want monontonic time on Windows?
-
- Windows has QueryPerformanceCounter(), which gives time most high-
- resolution time. It's a pity it's not so monotonic in practice; it's
- also got some fun bugs, especially: with older Windowses, under
- virtualizations, with funny hardware, on multiprocessor systems, and so
- on. PEP418 [1] has a nice roundup of the issues here.
-
- There's GetTickCount64() on Vista and later, which gives a number of 1-msec
- ticks since startup. The accuracy here might be as bad as 10-20 msec, I
- hear. There's an undocumented function (NtSetTimerResolution) that
- allegedly increases the accuracy. Good luck!
-
- There's also GetTickCount(), which is only 32 bits, but seems to be
- supported on pre-Vista versions of Windows. Apparently, you can coax
- another 14 bits out of it, giving you 2231 years before rollover.
-
- The less said about timeGetTime() the better.
-
- "We don't care. We don't have to. We're the Phone Company."
- -- Lily Tomlin, SNL
-
- Our strategy, if precise timers are turned off, is to just use the best
- GetTickCount equivalent available. If we've been asked for precise timing,
- then we mostly[2] assume that GetTickCount is monotonic, and correct
- GetPerformanceCounter to approximate it.
-
- [1] http://www.python.org/dev/peps/pep-0418
- [2] Of course, we feed the Windows stuff into adjust_monotonic_time()
- anyway, just in case it isn't.
-
- */
-/*
- Parts of our logic in the win32 timer code here are closely based on
- BitTorrent's libUTP library. That code is subject to the following
- license:
-
- Copyright (c) 2010 BitTorrent, Inc.
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-static ev_uint64_t
-evutil_GetTickCount_(struct evutil_monotonic_timer *base)
-{
- if (base->GetTickCount64_fn) {
- /* Let's just use GetTickCount64 if we can. */
- return base->GetTickCount64_fn();
- } else if (base->GetTickCount_fn) {
- /* Greg Hazel assures me that this works, that BitTorrent has
- * done it for years, and this it won't turn around and
- * bite us. He says they found it on some game programmers'
- * forum some time around 2007.
- */
- ev_uint64_t v = base->GetTickCount_fn();
- return (DWORD)v | ((v >> 18) & 0xFFFFFFFF00000000);
- } else {
- /* Here's the fallback implementation. We have to use
- * GetTickCount() with its given signature, so we only get
- * 32 bits worth of milliseconds, which will roll ove every
- * 49 days or so. */
- DWORD ticks = GetTickCount();
- if (ticks < base->last_tick_count) {
- base->adjust_tick_count += ((ev_uint64_t)1) << 32;
- }
- base->last_tick_count = ticks;
- return ticks + base->adjust_tick_count;
- }
-}
-
-int
-evutil_configure_monotonic_time_(struct evutil_monotonic_timer *base,
- int flags)
-{
- const int precise = flags & EV_MONOT_PRECISE;
- const int fallback = flags & EV_MONOT_FALLBACK;
- HANDLE h;
- memset(base, 0, sizeof(*base));
-
- h = evutil_load_windows_system_library_(TEXT("kernel32.dll"));
- if (h != NULL && !fallback) {
- base->GetTickCount64_fn = (ev_GetTickCount_func)GetProcAddress(h, "GetTickCount64");
- base->GetTickCount_fn = (ev_GetTickCount_func)GetProcAddress(h, "GetTickCount");
- }
-
- base->first_tick = base->last_tick_count = evutil_GetTickCount_(base);
- if (precise && !fallback) {
- LARGE_INTEGER freq;
- if (QueryPerformanceFrequency(&freq)) {
- LARGE_INTEGER counter;
- QueryPerformanceCounter(&counter);
- base->first_counter = counter.QuadPart;
- base->usec_per_count = 1.0e6 / freq.QuadPart;
- base->use_performance_counter = 1;
- }
- }
-
- return 0;
-}
-
-static inline ev_int64_t
-abs64(ev_int64_t i)
-{
- return i < 0 ? -i : i;
-}
-
-
-int
-evutil_gettime_monotonic_(struct evutil_monotonic_timer *base,
- struct timeval *tp)
-{
- ev_uint64_t ticks = evutil_GetTickCount_(base);
- if (base->use_performance_counter) {
- /* Here's a trick we took from BitTorrent's libutp, at Greg
- * Hazel's recommendation. We use QueryPerformanceCounter for
- * our high-resolution timer, but use GetTickCount*() to keep
- * it sane, and adjust_monotonic_time() to keep it monotonic.
- */
- LARGE_INTEGER counter;
- ev_int64_t counter_elapsed, counter_usec_elapsed, ticks_elapsed;
- QueryPerformanceCounter(&counter);
- counter_elapsed = (ev_int64_t)
- (counter.QuadPart - base->first_counter);
- ticks_elapsed = ticks - base->first_tick;
- /* TODO: This may upset VC6. If you need this to work with
- * VC6, please supply an appropriate patch. */
- counter_usec_elapsed = (ev_int64_t)
- (counter_elapsed * base->usec_per_count);
-
- if (abs64(ticks_elapsed*1000 - counter_usec_elapsed) > 1000000) {
- /* It appears that the QueryPerformanceCounter()
- * result is more than 1 second away from
- * GetTickCount() result. Let's adjust it to be as
- * accurate as we can; adjust_monotnonic_time() below
- * will keep it monotonic. */
- counter_usec_elapsed = ticks_elapsed * 1000;
- base->first_counter = (ev_uint64_t) (counter.QuadPart - counter_usec_elapsed / base->usec_per_count);
- }
- tp->tv_sec = (time_t) (counter_usec_elapsed / 1000000);
- tp->tv_usec = counter_usec_elapsed % 1000000;
-
- } else {
- /* We're just using GetTickCount(). */
- tp->tv_sec = (time_t) (ticks / 1000);
- tp->tv_usec = (ticks % 1000) * 1000;
- }
- adjust_monotonic_time(base, tp);
-
- return 0;
-}
-#endif
-
-#if defined(HAVE_FALLBACK_MONOTONIC)
-/* =====
- And if none of the other options work, let's just use gettimeofday(), and
- ratchet it forward so that it acts like a monotonic timer, whether it
- wants to or not.
- */
-
-int
-evutil_configure_monotonic_time_(struct evutil_monotonic_timer *base,
- int precise)
-{
- memset(base, 0, sizeof(*base));
- return 0;
-}
-
-int
-evutil_gettime_monotonic_(struct evutil_monotonic_timer *base,
- struct timeval *tp)
-{
- if (evutil_gettimeofday(tp, NULL) < 0)
- return -1;
- adjust_monotonic_time(base, tp);
- return 0;
-
-}
-#endif
+#endif
+ }
+
+ return evutil_snprintf(
+ date, datelen, "%s, %02d %s %4d %02d:%02d:%02d GMT",
+ DAYS[tm->tm_wday], tm->tm_mday, MONTHS[tm->tm_mon],
+ 1900 + tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec);
+}
+
+/*
+ This function assumes it's called repeatedly with a
+ not-actually-so-monotonic time source whose outputs are in 'tv'. It
+ implements a trivial ratcheting mechanism so that the values never go
+ backwards.
+ */
+static void
+adjust_monotonic_time(struct evutil_monotonic_timer *base,
+ struct timeval *tv)
+{
+ evutil_timeradd(tv, &base->adjust_monotonic_clock, tv);
+
+ if (evutil_timercmp(tv, &base->last_time, <)) {
+ /* Guess it wasn't monotonic after all. */
+ struct timeval adjust;
+ evutil_timersub(&base->last_time, tv, &adjust);
+ evutil_timeradd(&adjust, &base->adjust_monotonic_clock,
+ &base->adjust_monotonic_clock);
+ *tv = base->last_time;
+ }
+ base->last_time = *tv;
+}
+
+/*
+ Allocate a new struct evutil_monotonic_timer
+ */
+struct evutil_monotonic_timer *
+evutil_monotonic_timer_new(void)
+{
+ struct evutil_monotonic_timer *p = NULL;
+
+ p = mm_malloc(sizeof(*p));
+ if (!p) goto done;
+
+ memset(p, 0, sizeof(*p));
+
+ done:
+ return p;
+}
+
+/*
+ Free a struct evutil_monotonic_timer
+ */
+void
+evutil_monotonic_timer_free(struct evutil_monotonic_timer *timer)
+{
+ if (timer) {
+ mm_free(timer);
+ }
+}
+
+/*
+ Set up a struct evutil_monotonic_timer for initial use
+ */
+int
+evutil_configure_monotonic_time(struct evutil_monotonic_timer *timer,
+ int flags)
+{
+ return evutil_configure_monotonic_time_(timer, flags);
+}
+
+/*
+ Query the current monotonic time
+ */
+int
+evutil_gettime_monotonic(struct evutil_monotonic_timer *timer,
+ struct timeval *tp)
+{
+ return evutil_gettime_monotonic_(timer, tp);
+}
+
+
+#if defined(HAVE_POSIX_MONOTONIC)
+/* =====
+ The POSIX clock_gettime() interface provides a few ways to get at a
+ monotonic clock. CLOCK_MONOTONIC is most widely supported. Linux also
+ provides a CLOCK_MONOTONIC_COARSE with accuracy of about 1-4 msec.
+
+ On all platforms I'm aware of, CLOCK_MONOTONIC really is monotonic.
+ Platforms don't agree about whether it should jump on a sleep/resume.
+ */
+
+int
+evutil_configure_monotonic_time_(struct evutil_monotonic_timer *base,
+ int flags)
+{
+ /* CLOCK_MONOTONIC exists on FreeBSD, Linux, and Solaris. You need to
+ * check for it at runtime, because some older kernel versions won't
+ * have it working. */
+#ifdef CLOCK_MONOTONIC_COARSE
+ const int precise = flags & EV_MONOT_PRECISE;
+#endif
+ const int fallback = flags & EV_MONOT_FALLBACK;
+ struct timespec ts;
+
+#ifdef CLOCK_MONOTONIC_COARSE
+ if (CLOCK_MONOTONIC_COARSE < 0) {
+ /* Technically speaking, nothing keeps CLOCK_* from being
+ * negative (as far as I know). This check and the one below
+ * make sure that it's safe for us to use -1 as an "unset"
+ * value. */
+ event_errx(1,"I didn't expect CLOCK_MONOTONIC_COARSE to be < 0");
+ }
+ if (! precise && ! fallback) {
+ if (clock_gettime(CLOCK_MONOTONIC_COARSE, &ts) == 0) {
+ base->monotonic_clock = CLOCK_MONOTONIC_COARSE;
+ return 0;
+ }
+ }
+#endif
+ if (!fallback && clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
+ base->monotonic_clock = CLOCK_MONOTONIC;
+ return 0;
+ }
+
+ if (CLOCK_MONOTONIC < 0) {
+ event_errx(1,"I didn't expect CLOCK_MONOTONIC to be < 0");
+ }
+
+ base->monotonic_clock = -1;
+ return 0;
+}
+
+int
+evutil_gettime_monotonic_(struct evutil_monotonic_timer *base,
+ struct timeval *tp)
+{
+ struct timespec ts;
+
+ if (base->monotonic_clock < 0) {
+ if (evutil_gettimeofday(tp, NULL) < 0)
+ return -1;
+ adjust_monotonic_time(base, tp);
+ return 0;
+ }
+
+ if (clock_gettime(base->monotonic_clock, &ts) == -1)
+ return -1;
+ tp->tv_sec = ts.tv_sec;
+ tp->tv_usec = ts.tv_nsec / 1000;
+
+ return 0;
+}
+#endif
+
+#if defined(HAVE_MACH_MONOTONIC)
+/* ======
+ Apple is a little late to the POSIX party. And why not? Instead of
+ clock_gettime(), they provide mach_absolute_time(). Its units are not
+ fixed; we need to use mach_timebase_info() to get the right functions to
+ convert its units into nanoseconds.
+
+ To all appearances, mach_absolute_time() seems to be honest-to-goodness
+ monotonic. Whether it stops during sleep or not is unspecified in
+ principle, and dependent on CPU architecture in practice.
+ */
+
+int
+evutil_configure_monotonic_time_(struct evutil_monotonic_timer *base,
+ int flags)
+{
+ const int fallback = flags & EV_MONOT_FALLBACK;
+ struct mach_timebase_info mi;
+ memset(base, 0, sizeof(*base));
+ /* OSX has mach_absolute_time() */
+ if (!fallback &&
+ mach_timebase_info(&mi) == 0 &&
+ mach_absolute_time() != 0) {
+ /* mach_timebase_info tells us how to convert
+ * mach_absolute_time() into nanoseconds, but we
+ * want to use microseconds instead. */
+ mi.denom *= 1000;
+ memcpy(&base->mach_timebase_units, &mi, sizeof(mi));
+ } else {
+ base->mach_timebase_units.numer = 0;
+ }
+ return 0;
+}
+
+int
+evutil_gettime_monotonic_(struct evutil_monotonic_timer *base,
+ struct timeval *tp)
+{
+ ev_uint64_t abstime, usec;
+ if (base->mach_timebase_units.numer == 0) {
+ if (evutil_gettimeofday(tp, NULL) < 0)
+ return -1;
+ adjust_monotonic_time(base, tp);
+ return 0;
+ }
+
+ abstime = mach_absolute_time();
+ usec = (abstime * base->mach_timebase_units.numer)
+ / (base->mach_timebase_units.denom);
+ tp->tv_sec = usec / 1000000;
+ tp->tv_usec = usec % 1000000;
+
+ return 0;
+}
+#endif
+
+#if defined(HAVE_WIN32_MONOTONIC)
+/* =====
+ Turn we now to Windows. Want monontonic time on Windows?
+
+ Windows has QueryPerformanceCounter(), which gives time most high-
+ resolution time. It's a pity it's not so monotonic in practice; it's
+ also got some fun bugs, especially: with older Windowses, under
+ virtualizations, with funny hardware, on multiprocessor systems, and so
+ on. PEP418 [1] has a nice roundup of the issues here.
+
+ There's GetTickCount64() on Vista and later, which gives a number of 1-msec
+ ticks since startup. The accuracy here might be as bad as 10-20 msec, I
+ hear. There's an undocumented function (NtSetTimerResolution) that
+ allegedly increases the accuracy. Good luck!
+
+ There's also GetTickCount(), which is only 32 bits, but seems to be
+ supported on pre-Vista versions of Windows. Apparently, you can coax
+ another 14 bits out of it, giving you 2231 years before rollover.
+
+ The less said about timeGetTime() the better.
+
+ "We don't care. We don't have to. We're the Phone Company."
+ -- Lily Tomlin, SNL
+
+ Our strategy, if precise timers are turned off, is to just use the best
+ GetTickCount equivalent available. If we've been asked for precise timing,
+ then we mostly[2] assume that GetTickCount is monotonic, and correct
+ GetPerformanceCounter to approximate it.
+
+ [1] http://www.python.org/dev/peps/pep-0418
+ [2] Of course, we feed the Windows stuff into adjust_monotonic_time()
+ anyway, just in case it isn't.
+
+ */
+/*
+ Parts of our logic in the win32 timer code here are closely based on
+ BitTorrent's libUTP library. That code is subject to the following
+ license:
+
+ Copyright (c) 2010 BitTorrent, Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+static ev_uint64_t
+evutil_GetTickCount_(struct evutil_monotonic_timer *base)
+{
+ if (base->GetTickCount64_fn) {
+ /* Let's just use GetTickCount64 if we can. */
+ return base->GetTickCount64_fn();
+ } else if (base->GetTickCount_fn) {
+ /* Greg Hazel assures me that this works, that BitTorrent has
+ * done it for years, and this it won't turn around and
+ * bite us. He says they found it on some game programmers'
+ * forum some time around 2007.
+ */
+ ev_uint64_t v = base->GetTickCount_fn();
+ return (DWORD)v | ((v >> 18) & 0xFFFFFFFF00000000);
+ } else {
+ /* Here's the fallback implementation. We have to use
+ * GetTickCount() with its given signature, so we only get
+ * 32 bits worth of milliseconds, which will roll ove every
+ * 49 days or so. */
+ DWORD ticks = GetTickCount();
+ if (ticks < base->last_tick_count) {
+ base->adjust_tick_count += ((ev_uint64_t)1) << 32;
+ }
+ base->last_tick_count = ticks;
+ return ticks + base->adjust_tick_count;
+ }
+}
+
+int
+evutil_configure_monotonic_time_(struct evutil_monotonic_timer *base,
+ int flags)
+{
+ const int precise = flags & EV_MONOT_PRECISE;
+ const int fallback = flags & EV_MONOT_FALLBACK;
+ HANDLE h;
+ memset(base, 0, sizeof(*base));
+
+ h = evutil_load_windows_system_library_(TEXT("kernel32.dll"));
+ if (h != NULL && !fallback) {
+ base->GetTickCount64_fn = (ev_GetTickCount_func)GetProcAddress(h, "GetTickCount64");
+ base->GetTickCount_fn = (ev_GetTickCount_func)GetProcAddress(h, "GetTickCount");
+ }
+
+ base->first_tick = base->last_tick_count = evutil_GetTickCount_(base);
+ if (precise && !fallback) {
+ LARGE_INTEGER freq;
+ if (QueryPerformanceFrequency(&freq)) {
+ LARGE_INTEGER counter;
+ QueryPerformanceCounter(&counter);
+ base->first_counter = counter.QuadPart;
+ base->usec_per_count = 1.0e6 / freq.QuadPart;
+ base->use_performance_counter = 1;
+ }
+ }
+
+ return 0;
+}
+
+static inline ev_int64_t
+abs64(ev_int64_t i)
+{
+ return i < 0 ? -i : i;
+}
+
+
+int
+evutil_gettime_monotonic_(struct evutil_monotonic_timer *base,
+ struct timeval *tp)
+{
+ ev_uint64_t ticks = evutil_GetTickCount_(base);
+ if (base->use_performance_counter) {
+ /* Here's a trick we took from BitTorrent's libutp, at Greg
+ * Hazel's recommendation. We use QueryPerformanceCounter for
+ * our high-resolution timer, but use GetTickCount*() to keep
+ * it sane, and adjust_monotonic_time() to keep it monotonic.
+ */
+ LARGE_INTEGER counter;
+ ev_int64_t counter_elapsed, counter_usec_elapsed, ticks_elapsed;
+ QueryPerformanceCounter(&counter);
+ counter_elapsed = (ev_int64_t)
+ (counter.QuadPart - base->first_counter);
+ ticks_elapsed = ticks - base->first_tick;
+ /* TODO: This may upset VC6. If you need this to work with
+ * VC6, please supply an appropriate patch. */
+ counter_usec_elapsed = (ev_int64_t)
+ (counter_elapsed * base->usec_per_count);
+
+ if (abs64(ticks_elapsed*1000 - counter_usec_elapsed) > 1000000) {
+ /* It appears that the QueryPerformanceCounter()
+ * result is more than 1 second away from
+ * GetTickCount() result. Let's adjust it to be as
+ * accurate as we can; adjust_monotnonic_time() below
+ * will keep it monotonic. */
+ counter_usec_elapsed = ticks_elapsed * 1000;
+ base->first_counter = (ev_uint64_t) (counter.QuadPart - counter_usec_elapsed / base->usec_per_count);
+ }
+ tp->tv_sec = (time_t) (counter_usec_elapsed / 1000000);
+ tp->tv_usec = counter_usec_elapsed % 1000000;
+
+ } else {
+ /* We're just using GetTickCount(). */
+ tp->tv_sec = (time_t) (ticks / 1000);
+ tp->tv_usec = (ticks % 1000) * 1000;
+ }
+ adjust_monotonic_time(base, tp);
+
+ return 0;
+}
+#endif
+
+#if defined(HAVE_FALLBACK_MONOTONIC)
+/* =====
+ And if none of the other options work, let's just use gettimeofday(), and
+ ratchet it forward so that it acts like a monotonic timer, whether it
+ wants to or not.
+ */
+
+int
+evutil_configure_monotonic_time_(struct evutil_monotonic_timer *base,
+ int precise)
+{
+ memset(base, 0, sizeof(*base));
+ return 0;
+}
+
+int
+evutil_gettime_monotonic_(struct evutil_monotonic_timer *base,
+ struct timeval *tp)
+{
+ if (evutil_gettimeofday(tp, NULL) < 0)
+ return -1;
+ adjust_monotonic_time(base, tp);
+ return 0;
+
+}
+#endif
diff --git a/contrib/libs/libevent/ht-internal.h b/contrib/libs/libevent/ht-internal.h
index 50375bbaa9..b96d857600 100644
--- a/contrib/libs/libevent/ht-internal.h
+++ b/contrib/libs/libevent/ht-internal.h
@@ -1,12 +1,12 @@
-/* Copyright 2002 Christopher Clark */
+/* Copyright 2002 Christopher Clark */
/* Copyright 2005-2012 Nick Mathewson */
/* Copyright 2009-2012 Niels Provos and Nick Mathewson */
/* See license at end. */
/* Based on ideas by Christopher Clark and interfaces from Niels Provos. */
-#ifndef HT_INTERNAL_H_INCLUDED_
-#define HT_INTERNAL_H_INCLUDED_
+#ifndef HT_INTERNAL_H_INCLUDED_
+#define HT_INTERNAL_H_INCLUDED_
#define HT_HEAD(name, type) \
struct name { \
@@ -25,7 +25,7 @@
#define HT_INITIALIZER() \
{ NULL, 0, 0, 0, -1 }
-#ifdef HT_NO_CACHE_HASH_VALUES
+#ifdef HT_NO_CACHE_HASH_VALUES
#define HT_ENTRY(type) \
struct { \
struct type *hte_next; \
@@ -34,7 +34,7 @@
#define HT_ENTRY(type) \
struct { \
struct type *hte_next; \
- unsigned hte_hash; \
+ unsigned hte_hash; \
}
#endif
@@ -45,10 +45,10 @@
#define HT_SIZE(head) \
((head)->hth_n_entries)
-/* Return memory usage for a hashtable (not counting the entries themselves) */
-#define HT_MEM_USAGE(head) \
- (sizeof(*head) + (head)->hth_table_length * sizeof(void*))
-
+/* Return memory usage for a hashtable (not counting the entries themselves) */
+#define HT_MEM_USAGE(head) \
+ (sizeof(*head) + (head)->hth_table_length * sizeof(void*))
+
#define HT_FIND(name, head, elm) name##_HT_FIND((head), (elm))
#define HT_INSERT(name, head, elm) name##_HT_INSERT((head), (elm))
#define HT_REPLACE(name, head, elm) name##_HT_REPLACE((head), (elm))
@@ -60,7 +60,7 @@
#define HT_INIT(name, head) name##_HT_INIT(head)
/* Helper: */
static inline unsigned
-ht_improve_hash_(unsigned h)
+ht_improve_hash_(unsigned h)
{
/* Aim to protect against poor hash functions by adding logic here
* - logic taken from java 1.4 hashtable source */
@@ -74,7 +74,7 @@ ht_improve_hash_(unsigned h)
#if 0
/** Basic string hash function, from Java standard String.hashCode(). */
static inline unsigned
-ht_string_hash_(const char *s)
+ht_string_hash_(const char *s)
{
unsigned h = 0;
int m = 1;
@@ -88,7 +88,7 @@ ht_string_hash_(const char *s)
/** Basic string hash function, from Python's str.__hash__() */
static inline unsigned
-ht_string_hash_(const char *s)
+ht_string_hash_(const char *s)
{
unsigned h;
const unsigned char *cp = (const unsigned char *)s;
@@ -101,25 +101,25 @@ ht_string_hash_(const char *s)
return h;
}
-#ifndef HT_NO_CACHE_HASH_VALUES
-#define HT_SET_HASH_(elm, field, hashfn) \
+#ifndef HT_NO_CACHE_HASH_VALUES
+#define HT_SET_HASH_(elm, field, hashfn) \
do { (elm)->field.hte_hash = hashfn(elm); } while (0)
-#define HT_SET_HASHVAL_(elm, field, val) \
+#define HT_SET_HASHVAL_(elm, field, val) \
do { (elm)->field.hte_hash = (val); } while (0)
-#define HT_ELT_HASH_(elm, field, hashfn) \
+#define HT_ELT_HASH_(elm, field, hashfn) \
((elm)->field.hte_hash)
#else
-#define HT_SET_HASH_(elm, field, hashfn) \
+#define HT_SET_HASH_(elm, field, hashfn) \
((void)0)
-#define HT_ELT_HASH_(elm, field, hashfn) \
+#define HT_ELT_HASH_(elm, field, hashfn) \
(hashfn(elm))
-#define HT_SET_HASHVAL_(elm, field, val) \
+#define HT_SET_HASHVAL_(elm, field, val) \
((void)0)
#endif
/* Helper: alias for the bucket containing 'elm'. */
-#define HT_BUCKET_(head, field, elm, hashfn) \
- ((head)->hth_table[HT_ELT_HASH_(elm,field,hashfn) % head->hth_table_length])
+#define HT_BUCKET_(head, field, elm, hashfn) \
+ ((head)->hth_table[HT_ELT_HASH_(elm,field,hashfn) % head->hth_table_length])
#define HT_FOREACH(x, name, head) \
for ((x) = HT_START(name, head); \
@@ -129,7 +129,7 @@ ht_string_hash_(const char *s)
#define HT_PROTOTYPE(name, type, field, hashfn, eqfn) \
int name##_HT_GROW(struct name *ht, unsigned min_capacity); \
void name##_HT_CLEAR(struct name *ht); \
- int name##_HT_REP_IS_BAD_(const struct name *ht); \
+ int name##_HT_REP_IS_BAD_(const struct name *ht); \
static inline void \
name##_HT_INIT(struct name *head) { \
head->hth_table_length = 0; \
@@ -141,12 +141,12 @@ ht_string_hash_(const char *s)
/* Helper: returns a pointer to the right location in the table \
* 'head' to find or insert the element 'elm'. */ \
static inline struct type ** \
- name##_HT_FIND_P_(struct name *head, struct type *elm) \
+ name##_HT_FIND_P_(struct name *head, struct type *elm) \
{ \
struct type **p; \
if (!head->hth_table) \
return NULL; \
- p = &HT_BUCKET_(head, field, elm, hashfn); \
+ p = &HT_BUCKET_(head, field, elm, hashfn); \
while (*p) { \
if (eqfn(*p, elm)) \
return p; \
@@ -161,8 +161,8 @@ ht_string_hash_(const char *s)
{ \
struct type **p; \
struct name *h = (struct name *) head; \
- HT_SET_HASH_(elm, field, hashfn); \
- p = name##_HT_FIND_P_(h, elm); \
+ HT_SET_HASH_(elm, field, hashfn); \
+ p = name##_HT_FIND_P_(h, elm); \
return p ? *p : NULL; \
} \
/* Insert the element 'elm' into the table 'head'. Do not call this \
@@ -174,8 +174,8 @@ ht_string_hash_(const char *s)
if (!head->hth_table || head->hth_n_entries >= head->hth_load_limit) \
name##_HT_GROW(head, head->hth_n_entries+1); \
++head->hth_n_entries; \
- HT_SET_HASH_(elm, field, hashfn); \
- p = &HT_BUCKET_(head, field, elm, hashfn); \
+ HT_SET_HASH_(elm, field, hashfn); \
+ p = &HT_BUCKET_(head, field, elm, hashfn); \
elm->field.hte_next = *p; \
*p = elm; \
} \
@@ -188,8 +188,8 @@ ht_string_hash_(const char *s)
struct type **p, *r; \
if (!head->hth_table || head->hth_n_entries >= head->hth_load_limit) \
name##_HT_GROW(head, head->hth_n_entries+1); \
- HT_SET_HASH_(elm, field, hashfn); \
- p = name##_HT_FIND_P_(head, elm); \
+ HT_SET_HASH_(elm, field, hashfn); \
+ p = name##_HT_FIND_P_(head, elm); \
r = *p; \
*p = elm; \
if (r && (r!=elm)) { \
@@ -207,8 +207,8 @@ ht_string_hash_(const char *s)
name##_HT_REMOVE(struct name *head, struct type *elm) \
{ \
struct type **p, *r; \
- HT_SET_HASH_(elm, field, hashfn); \
- p = name##_HT_FIND_P_(head,elm); \
+ HT_SET_HASH_(elm, field, hashfn); \
+ p = name##_HT_FIND_P_(head,elm); \
if (!p || !*p) \
return NULL; \
r = *p; \
@@ -269,7 +269,7 @@ ht_string_hash_(const char *s)
if ((*elm)->field.hte_next) { \
return &(*elm)->field.hte_next; \
} else { \
- unsigned b = (HT_ELT_HASH_(*elm, field, hashfn) % head->hth_table_length)+1; \
+ unsigned b = (HT_ELT_HASH_(*elm, field, hashfn) % head->hth_table_length)+1; \
while (b < head->hth_table_length) { \
if (head->hth_table[b]) \
return &head->hth_table[b]; \
@@ -281,7 +281,7 @@ ht_string_hash_(const char *s)
static inline struct type ** \
name##_HT_NEXT_RMV(struct name *head, struct type **elm) \
{ \
- unsigned h = HT_ELT_HASH_(*elm, field, hashfn); \
+ unsigned h = HT_ELT_HASH_(*elm, field, hashfn); \
*elm = (*elm)->field.hte_next; \
--head->hth_n_entries; \
if (*elm) { \
@@ -338,7 +338,7 @@ ht_string_hash_(const char *s)
elm = head->hth_table[b]; \
while (elm) { \
next = elm->field.hte_next; \
- b2 = HT_ELT_HASH_(elm, field, hashfn) % new_len; \
+ b2 = HT_ELT_HASH_(elm, field, hashfn) % new_len; \
elm->field.hte_next = new_table[b2]; \
new_table[b2] = elm; \
elm = next; \
@@ -356,7 +356,7 @@ ht_string_hash_(const char *s)
for (b=0; b < head->hth_table_length; ++b) { \
struct type *e, **pE; \
for (pE = &new_table[b], e = *pE; e != NULL; e = *pE) { \
- b2 = HT_ELT_HASH_(e, field, hashfn) % new_len; \
+ b2 = HT_ELT_HASH_(e, field, hashfn) % new_len; \
if (b2 == b) { \
pE = &e->field.hte_next; \
} else { \
@@ -385,7 +385,7 @@ ht_string_hash_(const char *s)
/* Debugging helper: return false iff the representation of 'head' is \
* internally consistent. */ \
int \
- name##_HT_REP_IS_BAD_(const struct name *head) \
+ name##_HT_REP_IS_BAD_(const struct name *head) \
{ \
unsigned n, i; \
struct type *elm; \
@@ -407,9 +407,9 @@ ht_string_hash_(const char *s)
return 5; \
for (n = i = 0; i < head->hth_table_length; ++i) { \
for (elm = head->hth_table[i]; elm; elm = elm->field.hte_next) { \
- if (HT_ELT_HASH_(elm, field, hashfn) != hashfn(elm)) \
+ if (HT_ELT_HASH_(elm, field, hashfn) != hashfn(elm)) \
return 1000 + i; \
- if ((HT_ELT_HASH_(elm, field, hashfn) % head->hth_table_length) != i) \
+ if ((HT_ELT_HASH_(elm, field, hashfn) % head->hth_table_length) != i) \
return 10000 + i; \
++n; \
} \
@@ -422,24 +422,24 @@ ht_string_hash_(const char *s)
/** Implements an over-optimized "find and insert if absent" block;
* not meant for direct usage by typical code, or usage outside the critical
* path.*/
-#define HT_FIND_OR_INSERT_(name, field, hashfn, head, eltype, elm, var, y, n) \
+#define HT_FIND_OR_INSERT_(name, field, hashfn, head, eltype, elm, var, y, n) \
{ \
- struct name *var##_head_ = head; \
- struct eltype **var; \
- if (!var##_head_->hth_table || \
- var##_head_->hth_n_entries >= var##_head_->hth_load_limit) \
- name##_HT_GROW(var##_head_, var##_head_->hth_n_entries+1); \
- HT_SET_HASH_((elm), field, hashfn); \
- var = name##_HT_FIND_P_(var##_head_, (elm)); \
+ struct name *var##_head_ = head; \
+ struct eltype **var; \
+ if (!var##_head_->hth_table || \
+ var##_head_->hth_n_entries >= var##_head_->hth_load_limit) \
+ name##_HT_GROW(var##_head_, var##_head_->hth_n_entries+1); \
+ HT_SET_HASH_((elm), field, hashfn); \
+ var = name##_HT_FIND_P_(var##_head_, (elm)); \
if (*var) { \
y; \
} else { \
n; \
} \
}
-#define HT_FOI_INSERT_(field, head, elm, newent, var) \
+#define HT_FOI_INSERT_(field, head, elm, newent, var) \
{ \
- HT_SET_HASHVAL_(newent, field, (elm)->field.hte_hash); \
+ HT_SET_HASHVAL_(newent, field, (elm)->field.hte_hash); \
newent->field.hte_next = NULL; \
*var = newent; \
++((head)->hth_n_entries); \
@@ -447,7 +447,7 @@ ht_string_hash_(const char *s)
/*
* Copyright 2005, Nick Mathewson. Implementation logic is adapted from code
- * by Christopher Clark, retrofit to allow drop-in memory management, and to
+ * by Christopher Clark, retrofit to allow drop-in memory management, and to
* use the same interface as Niels Provos's tree.h. This is probably still
* a derived work, so the original license below still applies.
*
diff --git a/contrib/libs/libevent/http-internal.h b/contrib/libs/libevent/http-internal.h
index 85760eafc2..9f199eced7 100644
--- a/contrib/libs/libevent/http-internal.h
+++ b/contrib/libs/libevent/http-internal.h
@@ -7,8 +7,8 @@
* need to know about these.
*/
-#ifndef HTTP_INTERNAL_H_INCLUDED_
-#define HTTP_INTERNAL_H_INCLUDED_
+#ifndef HTTP_INTERNAL_H_INCLUDED_
+#define HTTP_INTERNAL_H_INCLUDED_
#include "event2/event_struct.h"
#include "util-internal.h"
@@ -32,7 +32,7 @@ struct addrinfo;
struct evhttp_request;
/* Indicates an unknown request method. */
-#define EVHTTP_REQ_UNKNOWN_ (1<<15)
+#define EVHTTP_REQ_UNKNOWN_ (1<<15)
enum evhttp_connection_state {
EVCON_DISCONNECTED, /**< not currently connected not trying either*/
@@ -62,30 +62,30 @@ struct evhttp_connection {
struct event retry_ev; /* for retrying connects */
char *bind_address; /* address to use for binding the src */
- ev_uint16_t bind_port; /* local port for binding the src */
+ ev_uint16_t bind_port; /* local port for binding the src */
char *address; /* address to connect to */
- ev_uint16_t port;
+ ev_uint16_t port;
size_t max_headers_size;
ev_uint64_t max_body_size;
int flags;
-#define EVHTTP_CON_INCOMING 0x0001 /* only one request on it ever */
-#define EVHTTP_CON_OUTGOING 0x0002 /* multiple requests possible */
-#define EVHTTP_CON_CLOSEDETECT 0x0004 /* detecting if persistent close */
-/* set when we want to auto free the connection */
-#define EVHTTP_CON_AUTOFREE EVHTTP_CON_PUBLIC_FLAGS_END
-/* Installed when attempt to read HTTP error after write failed, see
- * EVHTTP_CON_READ_ON_WRITE_ERROR */
-#define EVHTTP_CON_READING_ERROR (EVHTTP_CON_AUTOFREE << 1)
-
- struct timeval timeout; /* timeout for events */
+#define EVHTTP_CON_INCOMING 0x0001 /* only one request on it ever */
+#define EVHTTP_CON_OUTGOING 0x0002 /* multiple requests possible */
+#define EVHTTP_CON_CLOSEDETECT 0x0004 /* detecting if persistent close */
+/* set when we want to auto free the connection */
+#define EVHTTP_CON_AUTOFREE EVHTTP_CON_PUBLIC_FLAGS_END
+/* Installed when attempt to read HTTP error after write failed, see
+ * EVHTTP_CON_READ_ON_WRITE_ERROR */
+#define EVHTTP_CON_READING_ERROR (EVHTTP_CON_AUTOFREE << 1)
+
+ struct timeval timeout; /* timeout for events */
int retry_cnt; /* retry count */
int retry_max; /* maximum number of retries */
- struct timeval initial_retry_timeout; /* Timeout for low long to wait
- * after first failing attempt
- * before retry */
+ struct timeval initial_retry_timeout; /* Timeout for low long to wait
+ * after first failing attempt
+ * before retry */
enum evhttp_connection_state state;
@@ -100,11 +100,11 @@ struct evhttp_connection {
void (*closecb)(struct evhttp_connection *, void *);
void *closecb_arg;
- struct event_callback read_more_deferred_cb;
+ struct event_callback read_more_deferred_cb;
struct event_base *base;
struct evdns_base *dns_base;
- int ai_family;
+ int ai_family;
};
/* A callback for an http server */
@@ -142,7 +142,7 @@ struct evhttp {
/* All listeners for this host */
TAILQ_HEAD(boundq, evhttp_bound_socket) sockets;
- TAILQ_HEAD(httpcbq, evhttp_cb) callbacks;
+ TAILQ_HEAD(httpcbq, evhttp_cb) callbacks;
/* All live connections on this host. */
struct evconq connections;
@@ -154,12 +154,12 @@ struct evhttp {
/* NULL if this server is not a vhost */
char *vhost_pattern;
- struct timeval timeout;
+ struct timeval timeout;
size_t default_max_headers_size;
ev_uint64_t default_max_body_size;
- int flags;
- const char *default_content_type;
+ int flags;
+ const char *default_content_type;
/* Bitmask of all HTTP methods that we accept and pass to user
* callbacks. */
@@ -178,33 +178,33 @@ struct evhttp {
/* XXX most of these functions could be static. */
/* resets the connection; can be reused for more requests */
-void evhttp_connection_reset_(struct evhttp_connection *);
+void evhttp_connection_reset_(struct evhttp_connection *);
/* connects if necessary */
-int evhttp_connection_connect_(struct evhttp_connection *);
+int evhttp_connection_connect_(struct evhttp_connection *);
-enum evhttp_request_error;
+enum evhttp_request_error;
/* notifies the current request that it failed; resets connection */
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_fail_(struct evhttp_connection *,
- enum evhttp_request_error error);
+EVENT2_EXPORT_SYMBOL
+void evhttp_connection_fail_(struct evhttp_connection *,
+ enum evhttp_request_error error);
enum message_read_status;
-EVENT2_EXPORT_SYMBOL
-enum message_read_status evhttp_parse_firstline_(struct evhttp_request *, struct evbuffer*);
-EVENT2_EXPORT_SYMBOL
-enum message_read_status evhttp_parse_headers_(struct evhttp_request *, struct evbuffer*);
+EVENT2_EXPORT_SYMBOL
+enum message_read_status evhttp_parse_firstline_(struct evhttp_request *, struct evbuffer*);
+EVENT2_EXPORT_SYMBOL
+enum message_read_status evhttp_parse_headers_(struct evhttp_request *, struct evbuffer*);
-void evhttp_start_read_(struct evhttp_connection *);
-void evhttp_start_write_(struct evhttp_connection *);
+void evhttp_start_read_(struct evhttp_connection *);
+void evhttp_start_write_(struct evhttp_connection *);
/* response sending HTML the data in the buffer */
-void evhttp_response_code_(struct evhttp_request *, int, const char *);
-void evhttp_send_page_(struct evhttp_request *, struct evbuffer *);
-
-EVENT2_EXPORT_SYMBOL
-int evhttp_decode_uri_internal(const char *uri, size_t length,
- char *ret, int decode_plus);
-
-#endif /* HTTP_INTERNAL_H_INCLUDED_ */
+void evhttp_response_code_(struct evhttp_request *, int, const char *);
+void evhttp_send_page_(struct evhttp_request *, struct evbuffer *);
+
+EVENT2_EXPORT_SYMBOL
+int evhttp_decode_uri_internal(const char *uri, size_t length,
+ char *ret, int decode_plus);
+
+#endif /* HTTP_INTERNAL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/http.c b/contrib/libs/libevent/http.c
index b750d491c9..63dd84e5e9 100644
--- a/contrib/libs/libevent/http.c
+++ b/contrib/libs/libevent/http.c
@@ -26,56 +26,56 @@
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
-#ifdef EVENT__HAVE_SYS_PARAM_H
+#ifdef EVENT__HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
-#ifdef EVENT__HAVE_SYS_TYPES_H
+#ifdef EVENT__HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_IOCCOM_H
#include <sys/ioccom.h>
#endif
-#ifdef EVENT__HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef EVENT__HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#ifndef _WIN32
+#ifdef EVENT__HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#ifdef EVENT__HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef EVENT__HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifndef _WIN32
#include <sys/socket.h>
#include <sys/stat.h>
-#else /* _WIN32 */
+#else /* _WIN32 */
#include <winsock2.h>
#include <ws2tcpip.h>
-#endif /* _WIN32 */
-
-#ifdef EVENT__HAVE_SYS_UN_H
-#include <sys/un.h>
-#endif
-#ifdef EVENT__HAVE_AFUNIX_H
-#error #include <afunix.h>
+#endif /* _WIN32 */
+
+#ifdef EVENT__HAVE_SYS_UN_H
+#include <sys/un.h>
#endif
+#ifdef EVENT__HAVE_AFUNIX_H
+#error #include <afunix.h>
+#endif
#include <sys/queue.h>
-#ifdef EVENT__HAVE_NETINET_IN_H
+#ifdef EVENT__HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
-#ifdef EVENT__HAVE_ARPA_INET_H
+#ifdef EVENT__HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
-#ifdef EVENT__HAVE_NETDB_H
+#ifdef EVENT__HAVE_NETDB_H
#include <netdb.h>
#endif
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
@@ -83,14 +83,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifndef _WIN32
+#ifndef _WIN32
#include <syslog.h>
-#endif /* !_WIN32 */
+#endif /* !_WIN32 */
#include <signal.h>
-#ifdef EVENT__HAVE_UNISTD_H
+#ifdef EVENT__HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef EVENT__HAVE_FCNTL_H
+#ifdef EVENT__HAVE_FCNTL_H
#include <fcntl.h>
#endif
@@ -112,7 +112,7 @@
#include "mm-internal.h"
#include "bufferevent-internal.h"
-#ifndef EVENT__HAVE_GETNAMEINFO
+#ifndef EVENT__HAVE_GETNAMEINFO
#define NI_MAXSERV 32
#define NI_MAXHOST 1025
@@ -180,7 +180,7 @@ extern int debug;
static evutil_socket_t create_bind_socket_nonblock(struct evutil_addrinfo *, int reuse);
static evutil_socket_t bind_socket(const char *, ev_uint16_t, int reuse);
static void name_from_addr(struct sockaddr *, ev_socklen_t, char **, char **);
-static struct evhttp_uri *evhttp_uri_parse_authority(char *source_uri);
+static struct evhttp_uri *evhttp_uri_parse_authority(char *source_uri);
static int evhttp_associate_new_request_with_connection(
struct evhttp_connection *evcon);
static void evhttp_connection_start_detectclose(
@@ -210,7 +210,7 @@ static void evhttp_error_cb(struct bufferevent *bufev, short what, void *arg);
static int evhttp_find_vhost(struct evhttp *http, struct evhttp **outhttp,
const char *hostname);
-#ifndef EVENT__HAVE_STRSEP
+#ifndef EVENT__HAVE_STRSEP
/* strsep replacement for platforms that lack it. Only works if
* del is one character long. */
static char *
@@ -380,15 +380,15 @@ evhttp_write_buffer(struct evhttp_connection *evcon,
evcon->cb_arg = arg;
/* Disable the read callback: we don't actually care about data;
- * we only care about close detection. (We don't disable reading --
- * EV_READ, since we *do* want to learn about any close events.) */
+ * we only care about close detection. (We don't disable reading --
+ * EV_READ, since we *do* want to learn about any close events.) */
bufferevent_setcb(evcon->bufev,
NULL, /*read*/
evhttp_write_cb,
evhttp_error_cb,
evcon);
- bufferevent_enable(evcon->bufev, EV_READ|EV_WRITE);
+ bufferevent_enable(evcon->bufev, EV_READ|EV_WRITE);
}
static void
@@ -446,10 +446,10 @@ evhttp_make_header_request(struct evhttp_connection *evcon,
evhttp_remove_header(req->output_headers, "Proxy-Connection");
/* Generate request line */
- if (!(method = evhttp_method(req->type))) {
- method = "NULL";
- }
-
+ if (!(method = evhttp_method(req->type))) {
+ method = "NULL";
+ }
+
evbuffer_add_printf(bufferevent_get_output(evcon->bufev),
"%s %s HTTP/%d.%d\r\n",
method, req->uri, req->major, req->minor);
@@ -479,16 +479,16 @@ evhttp_is_connection_close(int flags, struct evkeyvalq* headers)
return (connection != NULL && evutil_ascii_strcasecmp(connection, "close") == 0);
}
}
-static int
-evhttp_is_request_connection_close(struct evhttp_request *req)
-{
+static int
+evhttp_is_request_connection_close(struct evhttp_request *req)
+{
if (req->type == EVHTTP_REQ_CONNECT)
return 0;
- return
- evhttp_is_connection_close(req->flags, req->input_headers) ||
- evhttp_is_connection_close(req->flags, req->output_headers);
-}
+ return
+ evhttp_is_connection_close(req->flags, req->input_headers) ||
+ evhttp_is_connection_close(req->flags, req->output_headers);
+}
/* Return true iff 'headers' contains 'Connection: keep-alive' */
static int
@@ -505,7 +505,7 @@ evhttp_maybe_add_date_header(struct evkeyvalq *headers)
{
if (evhttp_find_header(headers, "Date") == NULL) {
char date[50];
- if (sizeof(date) - evutil_date_rfc1123(date, sizeof(date), NULL) > 0) {
+ if (sizeof(date) - evutil_date_rfc1123(date, sizeof(date), NULL) > 0) {
evhttp_add_header(headers, "Date", date);
}
}
@@ -568,11 +568,11 @@ evhttp_make_header_response(struct evhttp_connection *evcon,
/* Potentially add headers for unidentified content. */
if (evhttp_response_needs_body(req)) {
if (evhttp_find_header(req->output_headers,
- "Content-Type") == NULL
- && evcon->http_server->default_content_type) {
+ "Content-Type") == NULL
+ && evcon->http_server->default_content_type) {
evhttp_add_header(req->output_headers,
- "Content-Type",
- evcon->http_server->default_content_type);
+ "Content-Type",
+ evcon->http_server->default_content_type);
}
}
@@ -585,23 +585,23 @@ evhttp_make_header_response(struct evhttp_connection *evcon,
}
}
-enum expect { NO, CONTINUE, OTHER };
-static enum expect evhttp_have_expect(struct evhttp_request *req, int input)
-{
- const char *expect;
- struct evkeyvalq *h = input ? req->input_headers : req->output_headers;
-
- if (!(req->kind == EVHTTP_REQUEST) || !REQ_VERSION_ATLEAST(req, 1, 1))
- return NO;
-
- expect = evhttp_find_header(h, "Expect");
- if (!expect)
- return NO;
-
- return !evutil_ascii_strcasecmp(expect, "100-continue") ? CONTINUE : OTHER;
-}
-
-
+enum expect { NO, CONTINUE, OTHER };
+static enum expect evhttp_have_expect(struct evhttp_request *req, int input)
+{
+ const char *expect;
+ struct evkeyvalq *h = input ? req->input_headers : req->output_headers;
+
+ if (!(req->kind == EVHTTP_REQUEST) || !REQ_VERSION_ATLEAST(req, 1, 1))
+ return NO;
+
+ expect = evhttp_find_header(h, "Expect");
+ if (!expect)
+ return NO;
+
+ return !evutil_ascii_strcasecmp(expect, "100-continue") ? CONTINUE : OTHER;
+}
+
+
/** Generate all headers appropriate for sending the http request in req (or
* the response, if we're sending a response), and write them to evcon's
* bufferevent. Also writes all data from req->output_buffer */
@@ -627,8 +627,8 @@ evhttp_make_header(struct evhttp_connection *evcon, struct evhttp_request *req)
}
evbuffer_add(output, "\r\n", 2);
- if (evhttp_have_expect(req, 0) != CONTINUE &&
- evbuffer_get_length(req->output_buffer)) {
+ if (evhttp_have_expect(req, 0) != CONTINUE &&
+ evbuffer_get_length(req->output_buffer)) {
/*
* For a request, we add the POST data, for a reply, this
* is the regular data.
@@ -658,19 +658,19 @@ evhttp_connection_set_max_body_size(struct evhttp_connection* evcon,
static int
evhttp_connection_incoming_fail(struct evhttp_request *req,
- enum evhttp_request_error error)
+ enum evhttp_request_error error)
{
switch (error) {
- case EVREQ_HTTP_DATA_TOO_LONG:
- req->response_code = HTTP_ENTITYTOOLARGE;
- break;
- default:
- req->response_code = HTTP_BADREQUEST;
- }
-
- switch (error) {
- case EVREQ_HTTP_TIMEOUT:
- case EVREQ_HTTP_EOF:
+ case EVREQ_HTTP_DATA_TOO_LONG:
+ req->response_code = HTTP_ENTITYTOOLARGE;
+ break;
+ default:
+ req->response_code = HTTP_BADREQUEST;
+ }
+
+ switch (error) {
+ case EVREQ_HTTP_TIMEOUT:
+ case EVREQ_HTTP_EOF:
/*
* these are cases in which we probably should just
* close the connection and not send a reply. this
@@ -688,10 +688,10 @@ evhttp_connection_incoming_fail(struct evhttp_request *req,
req->evcon = NULL;
}
return (-1);
- case EVREQ_HTTP_INVALID_HEADER:
- case EVREQ_HTTP_BUFFER_ERROR:
- case EVREQ_HTTP_REQUEST_CANCEL:
- case EVREQ_HTTP_DATA_TOO_LONG:
+ case EVREQ_HTTP_INVALID_HEADER:
+ case EVREQ_HTTP_BUFFER_ERROR:
+ case EVREQ_HTTP_REQUEST_CANCEL:
+ case EVREQ_HTTP_DATA_TOO_LONG:
default: /* xxx: probably should just error on default */
/* the callback looks at the uri to determine errors */
if (req->uri) {
@@ -713,36 +713,36 @@ evhttp_connection_incoming_fail(struct evhttp_request *req,
return (0);
}
-/* Free connection ownership of which can be acquired by user using
- * evhttp_request_own(). */
-static inline void
-evhttp_request_free_auto(struct evhttp_request *req)
-{
- if (!(req->flags & EVHTTP_USER_OWNED))
- evhttp_request_free(req);
-}
-
-static void
-evhttp_request_free_(struct evhttp_connection *evcon, struct evhttp_request *req)
-{
- TAILQ_REMOVE(&evcon->requests, req, next);
- evhttp_request_free_auto(req);
-}
-
+/* Free connection ownership of which can be acquired by user using
+ * evhttp_request_own(). */
+static inline void
+evhttp_request_free_auto(struct evhttp_request *req)
+{
+ if (!(req->flags & EVHTTP_USER_OWNED))
+ evhttp_request_free(req);
+}
+
+static void
+evhttp_request_free_(struct evhttp_connection *evcon, struct evhttp_request *req)
+{
+ TAILQ_REMOVE(&evcon->requests, req, next);
+ evhttp_request_free_auto(req);
+}
+
/* Called when evcon has experienced a (non-recoverable? -NM) error, as
* given in error. If it's an outgoing connection, reset the connection,
* retry any pending requests, and inform the user. If it's incoming,
* delegates to evhttp_connection_incoming_fail(). */
void
-evhttp_connection_fail_(struct evhttp_connection *evcon,
- enum evhttp_request_error error)
+evhttp_connection_fail_(struct evhttp_connection *evcon,
+ enum evhttp_request_error error)
{
- const int errsave = EVUTIL_SOCKET_ERROR();
+ const int errsave = EVUTIL_SOCKET_ERROR();
struct evhttp_request* req = TAILQ_FIRST(&evcon->requests);
void (*cb)(struct evhttp_request *, void *);
void *cb_arg;
- void (*error_cb)(enum evhttp_request_error, void *);
- void *error_cb_arg;
+ void (*error_cb)(enum evhttp_request_error, void *);
+ void *error_cb_arg;
EVUTIL_ASSERT(req != NULL);
bufferevent_disable(evcon->bufev, EV_READ|EV_WRITE);
@@ -761,10 +761,10 @@ evhttp_connection_fail_(struct evhttp_connection *evcon,
return;
}
- error_cb = req->error_cb;
- error_cb_arg = req->cb_arg;
+ error_cb = req->error_cb;
+ error_cb_arg = req->cb_arg;
/* when the request was canceled, the callback is not executed */
- if (error != EVREQ_HTTP_REQUEST_CANCEL) {
+ if (error != EVREQ_HTTP_REQUEST_CANCEL) {
/* save the callback for later; the cb might free our object */
cb = req->cb;
cb_arg = req->cb_arg;
@@ -777,29 +777,29 @@ evhttp_connection_fail_(struct evhttp_connection *evcon,
* send over a new connection. when a user cancels a request,
* all other pending requests should be processed as normal
*/
- evhttp_request_free_(evcon, req);
+ evhttp_request_free_(evcon, req);
/* reset the connection */
- evhttp_connection_reset_(evcon);
+ evhttp_connection_reset_(evcon);
/* We are trying the next request that was queued on us */
if (TAILQ_FIRST(&evcon->requests) != NULL)
- evhttp_connection_connect_(evcon);
+ evhttp_connection_connect_(evcon);
else
if ((evcon->flags & EVHTTP_CON_OUTGOING) &&
(evcon->flags & EVHTTP_CON_AUTOFREE)) {
evhttp_connection_free(evcon);
}
- /* The call to evhttp_connection_reset_ overwrote errno.
- * Let's restore the original errno, so that the user's
- * callback can have a better idea of what the error was.
- */
- EVUTIL_SET_SOCKET_ERROR(errsave);
-
+ /* The call to evhttp_connection_reset_ overwrote errno.
+ * Let's restore the original errno, so that the user's
+ * callback can have a better idea of what the error was.
+ */
+ EVUTIL_SET_SOCKET_ERROR(errsave);
+
/* inform the user */
- if (error_cb != NULL)
- error_cb(error, error_cb_arg);
+ if (error_cb != NULL)
+ error_cb(error, error_cb_arg);
if (cb != NULL)
(*cb)(NULL, cb_arg);
}
@@ -828,11 +828,11 @@ evhttp_connection_done(struct evhttp_connection *evcon)
{
struct evhttp_request *req = TAILQ_FIRST(&evcon->requests);
int con_outgoing = evcon->flags & EVHTTP_CON_OUTGOING;
- int free_evcon = 0;
+ int free_evcon = 0;
if (con_outgoing) {
/* idle or close the connection */
- int need_close = evhttp_is_request_connection_close(req);
+ int need_close = evhttp_is_request_connection_close(req);
TAILQ_REMOVE(&evcon->requests, req, next);
req->evcon = NULL;
@@ -840,7 +840,7 @@ evhttp_connection_done(struct evhttp_connection *evcon)
/* check if we got asked to close the connection */
if (need_close)
- evhttp_connection_reset_(evcon);
+ evhttp_connection_reset_(evcon);
if (TAILQ_FIRST(&evcon->requests) != NULL) {
/*
@@ -848,7 +848,7 @@ evhttp_connection_done(struct evhttp_connection *evcon)
* and deal with the next request.
*/
if (!evhttp_connected(evcon))
- evhttp_connection_connect_(evcon);
+ evhttp_connection_connect_(evcon);
else
evhttp_request_dispatch(evcon);
} else if (!need_close) {
@@ -857,12 +857,12 @@ evhttp_connection_done(struct evhttp_connection *evcon)
* need to detect if the other side closes it.
*/
evhttp_connection_start_detectclose(evcon);
- } else if ((evcon->flags & EVHTTP_CON_AUTOFREE)) {
- /*
- * If we have no more requests that need completion
- * and we're not waiting for the connection to close
- */
- free_evcon = 1;
+ } else if ((evcon->flags & EVHTTP_CON_AUTOFREE)) {
+ /*
+ * If we have no more requests that need completion
+ * and we're not waiting for the connection to close
+ */
+ free_evcon = 1;
}
} else {
/*
@@ -875,19 +875,19 @@ evhttp_connection_done(struct evhttp_connection *evcon)
/* notify the user of the request */
(*req->cb)(req, req->cb_arg);
- /* if this was an outgoing request, we own and it's done. so free it. */
- if (con_outgoing) {
- evhttp_request_free_auto(req);
- }
-
- /* If this was the last request of an outgoing connection and we're
- * not waiting to receive a connection close event and we want to
- * automatically free the connection. We check to ensure our request
- * list is empty one last time just in case our callback added a
- * new request.
+ /* if this was an outgoing request, we own and it's done. so free it. */
+ if (con_outgoing) {
+ evhttp_request_free_auto(req);
+ }
+
+ /* If this was the last request of an outgoing connection and we're
+ * not waiting to receive a connection close event and we want to
+ * automatically free the connection. We check to ensure our request
+ * list is empty one last time just in case our callback added a
+ * new request.
*/
- if (free_evcon && TAILQ_FIRST(&evcon->requests) == NULL) {
- evhttp_connection_free(evcon);
+ if (free_evcon && TAILQ_FIRST(&evcon->requests) == NULL) {
+ evhttp_connection_free(evcon);
}
}
@@ -1007,10 +1007,10 @@ evhttp_read_trailer(struct evhttp_connection *evcon, struct evhttp_request *req)
{
struct evbuffer *buf = bufferevent_get_input(evcon->bufev);
- switch (evhttp_parse_headers_(req, buf)) {
+ switch (evhttp_parse_headers_(req, buf)) {
case DATA_CORRUPTED:
case DATA_TOO_LONG:
- evhttp_connection_fail_(evcon, EVREQ_HTTP_DATA_TOO_LONG);
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_DATA_TOO_LONG);
break;
case ALL_DATA_READ:
bufferevent_disable(evcon->bufev, EV_READ);
@@ -1024,35 +1024,35 @@ evhttp_read_trailer(struct evhttp_connection *evcon, struct evhttp_request *req)
}
static void
-evhttp_lingering_close(struct evhttp_connection *evcon,
- struct evhttp_request *req)
-{
- struct evbuffer *buf = bufferevent_get_input(evcon->bufev);
-
- size_t n = evbuffer_get_length(buf);
- if (n > (size_t) req->ntoread)
- n = (size_t) req->ntoread;
- req->ntoread -= n;
- req->body_size += n;
-
- event_debug(("Request body is too long, left " EV_I64_FMT,
- EV_I64_ARG(req->ntoread)));
-
- evbuffer_drain(buf, n);
- if (!req->ntoread)
- evhttp_connection_fail_(evcon, EVREQ_HTTP_DATA_TOO_LONG);
-}
-static void
-evhttp_lingering_fail(struct evhttp_connection *evcon,
- struct evhttp_request *req)
-{
- if (evcon->flags & EVHTTP_CON_LINGERING_CLOSE)
- evhttp_lingering_close(evcon, req);
- else
- evhttp_connection_fail_(evcon, EVREQ_HTTP_DATA_TOO_LONG);
-}
-
-static void
+evhttp_lingering_close(struct evhttp_connection *evcon,
+ struct evhttp_request *req)
+{
+ struct evbuffer *buf = bufferevent_get_input(evcon->bufev);
+
+ size_t n = evbuffer_get_length(buf);
+ if (n > (size_t) req->ntoread)
+ n = (size_t) req->ntoread;
+ req->ntoread -= n;
+ req->body_size += n;
+
+ event_debug(("Request body is too long, left " EV_I64_FMT,
+ EV_I64_ARG(req->ntoread)));
+
+ evbuffer_drain(buf, n);
+ if (!req->ntoread)
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_DATA_TOO_LONG);
+}
+static void
+evhttp_lingering_fail(struct evhttp_connection *evcon,
+ struct evhttp_request *req)
+{
+ if (evcon->flags & EVHTTP_CON_LINGERING_CLOSE)
+ evhttp_lingering_close(evcon, req);
+ else
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_DATA_TOO_LONG);
+}
+
+static void
evhttp_read_body(struct evhttp_connection *evcon, struct evhttp_request *req)
{
struct evbuffer *buf = bufferevent_get_input(evcon->bufev);
@@ -1065,14 +1065,14 @@ evhttp_read_body(struct evhttp_connection *evcon, struct evhttp_request *req)
evhttp_read_trailer(evcon, req);
return;
case DATA_CORRUPTED:
- case DATA_TOO_LONG:
+ case DATA_TOO_LONG:
/* corrupted data */
- evhttp_connection_fail_(evcon,
- EVREQ_HTTP_DATA_TOO_LONG);
+ evhttp_connection_fail_(evcon,
+ EVREQ_HTTP_DATA_TOO_LONG);
return;
case REQUEST_CANCELED:
/* request canceled */
- evhttp_request_free_auto(req);
+ evhttp_request_free_auto(req);
return;
case MORE_DATA_EXPECTED:
default:
@@ -1081,7 +1081,7 @@ evhttp_read_body(struct evhttp_connection *evcon, struct evhttp_request *req)
} else if (req->ntoread < 0) {
/* Read until connection close. */
if ((size_t)(req->body_size + evbuffer_get_length(buf)) < req->body_size) {
- evhttp_connection_fail_(evcon, EVREQ_HTTP_INVALID_HEADER);
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_INVALID_HEADER);
return;
}
@@ -1105,8 +1105,8 @@ evhttp_read_body(struct evhttp_connection *evcon, struct evhttp_request *req)
(size_t)req->ntoread > req->evcon->max_body_size)) {
/* XXX: The above casted comparison must checked for overflow */
/* failed body length test */
-
- evhttp_lingering_fail(evcon, req);
+
+ evhttp_lingering_fail(evcon, req);
return;
}
@@ -1117,12 +1117,12 @@ evhttp_read_body(struct evhttp_connection *evcon, struct evhttp_request *req)
evbuffer_drain(req->input_buffer,
evbuffer_get_length(req->input_buffer));
if ((req->flags & EVHTTP_REQ_NEEDS_FREE) != 0) {
- evhttp_request_free_auto(req);
+ evhttp_request_free_auto(req);
return;
}
}
- if (!req->ntoread) {
+ if (!req->ntoread) {
bufferevent_disable(evcon->bufev, EV_READ);
/* Completed content length */
evhttp_connection_done(evcon);
@@ -1131,7 +1131,7 @@ evhttp_read_body(struct evhttp_connection *evcon, struct evhttp_request *req)
}
#define get_deferred_queue(evcon) \
- ((evcon)->base)
+ ((evcon)->base)
/*
* Gets called when more data becomes available
@@ -1144,7 +1144,7 @@ evhttp_read_cb(struct bufferevent *bufev, void *arg)
struct evhttp_request *req = TAILQ_FIRST(&evcon->requests);
/* Cancel if it's pending. */
- event_deferred_cb_cancel_(get_deferred_queue(evcon),
+ event_deferred_cb_cancel_(get_deferred_queue(evcon),
&evcon->read_more_deferred_cb);
switch (evcon->state) {
@@ -1180,7 +1180,7 @@ evhttp_read_cb(struct bufferevent *bufev, void *arg)
__func__, EV_SIZE_ARG(total_len)));
#endif
- evhttp_connection_reset_(evcon);
+ evhttp_connection_reset_(evcon);
}
break;
case EVCON_DISCONNECTED:
@@ -1193,12 +1193,12 @@ evhttp_read_cb(struct bufferevent *bufev, void *arg)
}
static void
-evhttp_deferred_read_cb(struct event_callback *cb, void *data)
+evhttp_deferred_read_cb(struct event_callback *cb, void *data)
{
struct evhttp_connection *evcon = data;
- struct bufferevent *bev = evcon->bufev;
- if (bev->readcb)
- (bev->readcb)(evcon->bufev, evcon);
+ struct bufferevent *bev = evcon->bufev;
+ if (bev->readcb)
+ (bev->readcb)(evcon->bufev, evcon);
}
static void
@@ -1206,20 +1206,20 @@ evhttp_write_connectioncb(struct evhttp_connection *evcon, void *arg)
{
/* This is after writing the request to the server */
struct evhttp_request *req = TAILQ_FIRST(&evcon->requests);
- struct evbuffer *output = bufferevent_get_output(evcon->bufev);
+ struct evbuffer *output = bufferevent_get_output(evcon->bufev);
EVUTIL_ASSERT(req != NULL);
EVUTIL_ASSERT(evcon->state == EVCON_WRITING);
- /* We need to wait until we've written all of our output data before we can
- * continue */
- if (evbuffer_get_length(output) > 0)
- return;
-
+ /* We need to wait until we've written all of our output data before we can
+ * continue */
+ if (evbuffer_get_length(output) > 0)
+ return;
+
/* We are done writing our header and are now expecting the response */
req->kind = EVHTTP_RESPONSE;
- evhttp_start_read_(evcon);
+ evhttp_start_read_(evcon);
}
/*
@@ -1230,7 +1230,7 @@ void
evhttp_connection_free(struct evhttp_connection *evcon)
{
struct evhttp_request *req;
- int need_close = 0;
+ int need_close = 0;
/* notify interested parties that this connection is going down */
if (evcon->fd != -1) {
@@ -1241,10 +1241,10 @@ evhttp_connection_free(struct evhttp_connection *evcon)
/* remove all requests that might be queued on this
* connection. for server connections, this should be empty.
* because it gets dequeued either in evhttp_connection_done or
- * evhttp_connection_fail_.
+ * evhttp_connection_fail_.
*/
while ((req = TAILQ_FIRST(&evcon->requests)) != NULL) {
- evhttp_request_free_(evcon, req);
+ evhttp_request_free_(evcon, req);
}
if (evcon->http_server != NULL) {
@@ -1257,22 +1257,22 @@ evhttp_connection_free(struct evhttp_connection *evcon)
event_debug_unassign(&evcon->retry_ev);
}
- event_deferred_cb_cancel_(get_deferred_queue(evcon),
- &evcon->read_more_deferred_cb);
-
- if (evcon->bufev != NULL) {
- need_close =
- !(bufferevent_get_options_(evcon->bufev) & BEV_OPT_CLOSE_ON_FREE);
- if (evcon->fd == -1)
- evcon->fd = bufferevent_getfd(evcon->bufev);
-
+ event_deferred_cb_cancel_(get_deferred_queue(evcon),
+ &evcon->read_more_deferred_cb);
+
+ if (evcon->bufev != NULL) {
+ need_close =
+ !(bufferevent_get_options_(evcon->bufev) & BEV_OPT_CLOSE_ON_FREE);
+ if (evcon->fd == -1)
+ evcon->fd = bufferevent_getfd(evcon->bufev);
+
bufferevent_free(evcon->bufev);
- }
+ }
if (evcon->fd != -1) {
shutdown(evcon->fd, EVUTIL_SHUT_WR);
- if (need_close)
- evutil_closesocket(evcon->fd);
+ if (need_close)
+ evutil_closesocket(evcon->fd);
}
if (evcon->bind_address != NULL)
@@ -1285,11 +1285,11 @@ evhttp_connection_free(struct evhttp_connection *evcon)
}
void
-evhttp_connection_free_on_completion(struct evhttp_connection *evcon) {
- evcon->flags |= EVHTTP_CON_AUTOFREE;
-}
-
-void
+evhttp_connection_free_on_completion(struct evhttp_connection *evcon) {
+ evcon->flags |= EVHTTP_CON_AUTOFREE;
+}
+
+void
evhttp_connection_set_local_address(struct evhttp_connection *evcon,
const char *address)
{
@@ -1317,8 +1317,8 @@ evhttp_request_dispatch(struct evhttp_connection* evcon)
if (req == NULL)
return;
- EVUTIL_ASSERT(req->kind == EVHTTP_REQUEST);
-
+ EVUTIL_ASSERT(req->kind == EVHTTP_REQUEST);
+
/* delete possible close detection events */
evhttp_connection_stop_detectclose(evcon);
@@ -1336,13 +1336,13 @@ evhttp_request_dispatch(struct evhttp_connection* evcon)
/* Reset our connection state: disables reading/writing, closes our fd (if
* any), clears out buffers, and puts us in state DISCONNECTED. */
void
-evhttp_connection_reset_(struct evhttp_connection *evcon)
+evhttp_connection_reset_(struct evhttp_connection *evcon)
{
struct evbuffer *tmp;
- int err;
-
- bufferevent_setcb(evcon->bufev, NULL, NULL, NULL, NULL);
+ int err;
+ bufferevent_setcb(evcon->bufev, NULL, NULL, NULL, NULL);
+
/* XXXX This is not actually an optimal fix. Instead we ought to have
an API for "stop connecting", or use bufferevent_setfd to turn off
connecting. But for Libevent 2.0, this seems like a minimal change
@@ -1352,13 +1352,13 @@ evhttp_connection_reset_(struct evhttp_connection *evcon)
bufferevent is connecting, then you can't actually stop the
bufferevent from trying to connect with bufferevent_disable(). The
connect will never trigger, since we close the fd, but the timeout
- might. That caused an assertion failure in evhttp_connection_fail_.
+ might. That caused an assertion failure in evhttp_connection_fail_.
*/
- bufferevent_disable_hard_(evcon->bufev, EV_READ|EV_WRITE);
-
- if (evcon->fd == -1)
- evcon->fd = bufferevent_getfd(evcon->bufev);
+ bufferevent_disable_hard_(evcon->bufev, EV_READ|EV_WRITE);
+ if (evcon->fd == -1)
+ evcon->fd = bufferevent_getfd(evcon->bufev);
+
if (evcon->fd != -1) {
/* inform interested parties about connection close */
if (evhttp_connected(evcon) && evcon->closecb != NULL)
@@ -1385,19 +1385,19 @@ evhttp_connection_reset_(struct evhttp_connection *evcon)
evutil_closesocket(evcon->fd);
evcon->fd = -1;
}
- err = bufferevent_setfd(evcon->bufev, -1);
- EVUTIL_ASSERT(!err && "setfd");
+ err = bufferevent_setfd(evcon->bufev, -1);
+ EVUTIL_ASSERT(!err && "setfd");
/* we need to clean up any buffered data */
tmp = bufferevent_get_output(evcon->bufev);
- err = evbuffer_drain(tmp, -1);
- EVUTIL_ASSERT(!err && "drain output");
+ err = evbuffer_drain(tmp, -1);
+ EVUTIL_ASSERT(!err && "drain output");
tmp = bufferevent_get_input(evcon->bufev);
- err = evbuffer_drain(tmp, -1);
- EVUTIL_ASSERT(!err && "drain input");
-
- evcon->flags &= ~EVHTTP_CON_READING_ERROR;
+ err = evbuffer_drain(tmp, -1);
+ EVUTIL_ASSERT(!err && "drain input");
+ evcon->flags &= ~EVHTTP_CON_READING_ERROR;
+
evcon->state = EVCON_DISCONNECTED;
}
@@ -1421,7 +1421,7 @@ evhttp_connection_retry(evutil_socket_t fd, short what, void *arg)
struct evhttp_connection *evcon = arg;
evcon->state = EVCON_DISCONNECTED;
- evhttp_connection_connect_(evcon);
+ evhttp_connection_connect_(evcon);
}
static void
@@ -1429,25 +1429,25 @@ evhttp_connection_cb_cleanup(struct evhttp_connection *evcon)
{
struct evcon_requestq requests;
- evhttp_connection_reset_(evcon);
+ evhttp_connection_reset_(evcon);
if (evcon->retry_max < 0 || evcon->retry_cnt < evcon->retry_max) {
- struct timeval tv_retry = evcon->initial_retry_timeout;
- int i;
+ struct timeval tv_retry = evcon->initial_retry_timeout;
+ int i;
evtimer_assign(&evcon->retry_ev, evcon->base, evhttp_connection_retry, evcon);
/* XXXX handle failure from evhttp_add_event */
- for (i=0; i < evcon->retry_cnt; ++i) {
- tv_retry.tv_usec *= 2;
- if (tv_retry.tv_usec > 1000000) {
- tv_retry.tv_usec -= 1000000;
- tv_retry.tv_sec += 1;
- }
- tv_retry.tv_sec *= 2;
- if (tv_retry.tv_sec > 3600) {
- tv_retry.tv_sec = 3600;
- tv_retry.tv_usec = 0;
- }
- }
- event_add(&evcon->retry_ev, &tv_retry);
+ for (i=0; i < evcon->retry_cnt; ++i) {
+ tv_retry.tv_usec *= 2;
+ if (tv_retry.tv_usec > 1000000) {
+ tv_retry.tv_usec -= 1000000;
+ tv_retry.tv_sec += 1;
+ }
+ tv_retry.tv_sec *= 2;
+ if (tv_retry.tv_sec > 3600) {
+ tv_retry.tv_sec = 3600;
+ tv_retry.tv_usec = 0;
+ }
+ }
+ event_add(&evcon->retry_ev, &tv_retry);
evcon->retry_cnt++;
return;
}
@@ -1473,43 +1473,43 @@ evhttp_connection_cb_cleanup(struct evhttp_connection *evcon)
/* we might want to set an error here */
request->cb(request, request->cb_arg);
- evhttp_request_free_auto(request);
+ evhttp_request_free_auto(request);
}
}
static void
-evhttp_connection_read_on_write_error(struct evhttp_connection *evcon,
- struct evhttp_request *req)
-{
- struct evbuffer *buf;
-
- /** Second time, we can't read anything */
- if (evcon->flags & EVHTTP_CON_READING_ERROR) {
- evcon->flags &= ~EVHTTP_CON_READING_ERROR;
- evhttp_connection_fail_(evcon, EVREQ_HTTP_EOF);
- return;
- }
-
- req->kind = EVHTTP_RESPONSE;
-
- buf = bufferevent_get_output(evcon->bufev);
- evbuffer_unfreeze(buf, 1);
- evbuffer_drain(buf, evbuffer_get_length(buf));
- evbuffer_freeze(buf, 1);
-
- evhttp_start_read_(evcon);
- evcon->flags |= EVHTTP_CON_READING_ERROR;
-}
-
-static void
+evhttp_connection_read_on_write_error(struct evhttp_connection *evcon,
+ struct evhttp_request *req)
+{
+ struct evbuffer *buf;
+
+ /** Second time, we can't read anything */
+ if (evcon->flags & EVHTTP_CON_READING_ERROR) {
+ evcon->flags &= ~EVHTTP_CON_READING_ERROR;
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_EOF);
+ return;
+ }
+
+ req->kind = EVHTTP_RESPONSE;
+
+ buf = bufferevent_get_output(evcon->bufev);
+ evbuffer_unfreeze(buf, 1);
+ evbuffer_drain(buf, evbuffer_get_length(buf));
+ evbuffer_freeze(buf, 1);
+
+ evhttp_start_read_(evcon);
+ evcon->flags |= EVHTTP_CON_READING_ERROR;
+}
+
+static void
evhttp_error_cb(struct bufferevent *bufev, short what, void *arg)
{
struct evhttp_connection *evcon = arg;
struct evhttp_request *req = TAILQ_FIRST(&evcon->requests);
- if (evcon->fd == -1)
- evcon->fd = bufferevent_getfd(bufev);
-
+ if (evcon->fd == -1)
+ evcon->fd = bufferevent_getfd(bufev);
+
switch (evcon->state) {
case EVCON_CONNECTING:
if (what & BEV_EVENT_TIMEOUT) {
@@ -1552,42 +1552,42 @@ evhttp_error_cb(struct bufferevent *bufev, short what, void *arg)
* disconnected.
*/
EVUTIL_ASSERT(evcon->state == EVCON_IDLE);
- evhttp_connection_reset_(evcon);
-
- /*
- * If we have no more requests that need completion
- * and we want to auto-free the connection when all
- * requests have been completed.
- */
- if (TAILQ_FIRST(&evcon->requests) == NULL
- && (evcon->flags & EVHTTP_CON_OUTGOING)
- && (evcon->flags & EVHTTP_CON_AUTOFREE)) {
- evhttp_connection_free(evcon);
- }
+ evhttp_connection_reset_(evcon);
+
+ /*
+ * If we have no more requests that need completion
+ * and we want to auto-free the connection when all
+ * requests have been completed.
+ */
+ if (TAILQ_FIRST(&evcon->requests) == NULL
+ && (evcon->flags & EVHTTP_CON_OUTGOING)
+ && (evcon->flags & EVHTTP_CON_AUTOFREE)) {
+ evhttp_connection_free(evcon);
+ }
return;
}
if (what & BEV_EVENT_TIMEOUT) {
- evhttp_connection_fail_(evcon, EVREQ_HTTP_TIMEOUT);
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_TIMEOUT);
} else if (what & (BEV_EVENT_EOF|BEV_EVENT_ERROR)) {
- if (what & BEV_EVENT_WRITING &&
- evcon->flags & EVHTTP_CON_READ_ON_WRITE_ERROR) {
- evhttp_connection_read_on_write_error(evcon, req);
- return;
- }
-
- if (what & BEV_EVENT_READING &&
- evcon->flags & EVHTTP_CON_READ_ON_WRITE_ERROR &&
- evbuffer_get_length(bufferevent_get_input(bufev))) {
- event_deferred_cb_schedule_(get_deferred_queue(evcon),
- &evcon->read_more_deferred_cb);
- return;
- }
-
- evhttp_connection_fail_(evcon, EVREQ_HTTP_EOF);
+ if (what & BEV_EVENT_WRITING &&
+ evcon->flags & EVHTTP_CON_READ_ON_WRITE_ERROR) {
+ evhttp_connection_read_on_write_error(evcon, req);
+ return;
+ }
+
+ if (what & BEV_EVENT_READING &&
+ evcon->flags & EVHTTP_CON_READ_ON_WRITE_ERROR &&
+ evbuffer_get_length(bufferevent_get_input(bufev))) {
+ event_deferred_cb_schedule_(get_deferred_queue(evcon),
+ &evcon->read_more_deferred_cb);
+ return;
+ }
+
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_EOF);
} else if (what == BEV_EVENT_CONNECTED) {
} else {
- evhttp_connection_fail_(evcon, EVREQ_HTTP_BUFFER_ERROR);
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_BUFFER_ERROR);
}
}
@@ -1609,7 +1609,7 @@ evhttp_connection_cb(struct bufferevent *bufev, short what, void *arg)
* when connecting to a local address. the cleanup is going
* to reschedule this function call.
*/
-#ifndef _WIN32
+#ifndef _WIN32
if (errno == ECONNREFUSED)
goto cleanup;
#endif
@@ -1617,12 +1617,12 @@ evhttp_connection_cb(struct bufferevent *bufev, short what, void *arg)
return;
}
- if (evcon->fd == -1) {
- event_debug(("%s: bufferevent_getfd returned -1",
- __func__));
- goto cleanup;
- }
-
+ if (evcon->fd == -1) {
+ event_debug(("%s: bufferevent_getfd returned -1",
+ __func__));
+ goto cleanup;
+ }
+
/* Check if the connection completed */
if (getsockopt(evcon->fd, SOL_SOCKET, SO_ERROR, (void*)&error,
&errsz) == -1) {
@@ -1657,12 +1657,12 @@ evhttp_connection_cb(struct bufferevent *bufev, short what, void *arg)
evhttp_error_cb,
evcon);
- if (!evutil_timerisset(&evcon->timeout)) {
- const struct timeval read_tv = { HTTP_READ_TIMEOUT, 0 };
- const struct timeval write_tv = { HTTP_WRITE_TIMEOUT, 0 };
- bufferevent_set_timeouts(evcon->bufev, &read_tv, &write_tv);
- } else {
- bufferevent_set_timeouts(evcon->bufev, &evcon->timeout, &evcon->timeout);
+ if (!evutil_timerisset(&evcon->timeout)) {
+ const struct timeval read_tv = { HTTP_READ_TIMEOUT, 0 };
+ const struct timeval write_tv = { HTTP_WRITE_TIMEOUT, 0 };
+ bufferevent_set_timeouts(evcon->bufev, &read_tv, &write_tv);
+ } else {
+ bufferevent_set_timeouts(evcon->bufev, &evcon->timeout, &evcon->timeout);
}
/* try to start requests that have queued up on this connection */
@@ -1728,8 +1728,8 @@ evhttp_parse_response_line(struct evhttp_request *req, char *line)
return (-1);
}
- if (req->response_code_line != NULL)
- mm_free(req->response_code_line);
+ if (req->response_code_line != NULL)
+ mm_free(req->response_code_line);
if ((req->response_code_line = mm_strdup(readable)) == NULL) {
event_warn("%s: strdup", __func__);
return (-1);
@@ -1741,170 +1741,170 @@ evhttp_parse_response_line(struct evhttp_request *req, char *line)
/* Parse the first line of a HTTP request */
static int
-evhttp_parse_request_line(struct evhttp_request *req, char *line, size_t len)
+evhttp_parse_request_line(struct evhttp_request *req, char *line, size_t len)
{
- char *eos = line + len;
+ char *eos = line + len;
char *method;
char *uri;
char *version;
const char *hostname;
const char *scheme;
- size_t method_len;
- enum evhttp_cmd_type type;
-
- while (eos > line && *(eos-1) == ' ') {
- *(eos-1) = '\0';
- --eos;
- --len;
- }
- if (len < strlen("GET / HTTP/1.0"))
- return -1;
-
+ size_t method_len;
+ enum evhttp_cmd_type type;
+
+ while (eos > line && *(eos-1) == ' ') {
+ *(eos-1) = '\0';
+ --eos;
+ --len;
+ }
+ if (len < strlen("GET / HTTP/1.0"))
+ return -1;
+
/* Parse the request line */
method = strsep(&line, " ");
- if (!line)
- return -1;
- uri = line;
- version = strrchr(uri, ' ');
- if (!version || uri == version)
- return -1;
- *version = '\0';
- version++;
-
- method_len = (uri - method) - 1;
- type = EVHTTP_REQ_UNKNOWN_;
-
+ if (!line)
+ return -1;
+ uri = line;
+ version = strrchr(uri, ' ');
+ if (!version || uri == version)
+ return -1;
+ *version = '\0';
+ version++;
+
+ method_len = (uri - method) - 1;
+ type = EVHTTP_REQ_UNKNOWN_;
+
/* First line */
- switch (method_len) {
- case 3:
- /* The length of the method string is 3, meaning it can only be one of two methods: GET or PUT */
-
- /* Since both GET and PUT share the same character 'T' at the end,
- * if the string doesn't have 'T', we can immediately determine this
- * is an invalid HTTP method */
-
- if (method[2] != 'T') {
- break;
- }
-
- switch (*method) {
- case 'G':
- /* This first byte is 'G', so make sure the next byte is
- * 'E', if it isn't then this isn't a valid method */
-
- if (method[1] == 'E') {
- type = EVHTTP_REQ_GET;
- }
-
- break;
- case 'P':
- /* First byte is P, check second byte for 'U', if not,
- * we know it's an invalid method */
- if (method[1] == 'U') {
- type = EVHTTP_REQ_PUT;
- }
- break;
- default:
- break;
- }
- break;
- case 4:
- /* The method length is 4 bytes, leaving only the methods "POST" and "HEAD" */
- switch (*method) {
- case 'P':
- if (method[3] == 'T' && method[2] == 'S' && method[1] == 'O') {
- type = EVHTTP_REQ_POST;
- }
- break;
- case 'H':
- if (method[3] == 'D' && method[2] == 'A' && method[1] == 'E') {
- type = EVHTTP_REQ_HEAD;
- }
- break;
- default:
- break;
- }
- break;
- case 5:
- /* Method length is 5 bytes, which can only encompass PATCH and TRACE */
- switch (*method) {
- case 'P':
- if (method[4] == 'H' && method[3] == 'C' && method[2] == 'T' && method[1] == 'A') {
- type = EVHTTP_REQ_PATCH;
- }
- break;
- case 'T':
- if (method[4] == 'E' && method[3] == 'C' && method[2] == 'A' && method[1] == 'R') {
- type = EVHTTP_REQ_TRACE;
- }
+ switch (method_len) {
+ case 3:
+ /* The length of the method string is 3, meaning it can only be one of two methods: GET or PUT */
+
+ /* Since both GET and PUT share the same character 'T' at the end,
+ * if the string doesn't have 'T', we can immediately determine this
+ * is an invalid HTTP method */
+
+ if (method[2] != 'T') {
+ break;
+ }
+
+ switch (*method) {
+ case 'G':
+ /* This first byte is 'G', so make sure the next byte is
+ * 'E', if it isn't then this isn't a valid method */
+
+ if (method[1] == 'E') {
+ type = EVHTTP_REQ_GET;
+ }
+
+ break;
+ case 'P':
+ /* First byte is P, check second byte for 'U', if not,
+ * we know it's an invalid method */
+ if (method[1] == 'U') {
+ type = EVHTTP_REQ_PUT;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ case 4:
+ /* The method length is 4 bytes, leaving only the methods "POST" and "HEAD" */
+ switch (*method) {
+ case 'P':
+ if (method[3] == 'T' && method[2] == 'S' && method[1] == 'O') {
+ type = EVHTTP_REQ_POST;
+ }
+ break;
+ case 'H':
+ if (method[3] == 'D' && method[2] == 'A' && method[1] == 'E') {
+ type = EVHTTP_REQ_HEAD;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ case 5:
+ /* Method length is 5 bytes, which can only encompass PATCH and TRACE */
+ switch (*method) {
+ case 'P':
+ if (method[4] == 'H' && method[3] == 'C' && method[2] == 'T' && method[1] == 'A') {
+ type = EVHTTP_REQ_PATCH;
+ }
+ break;
+ case 'T':
+ if (method[4] == 'E' && method[3] == 'C' && method[2] == 'A' && method[1] == 'R') {
+ type = EVHTTP_REQ_TRACE;
+ }
+
+ break;
+ default:
+ break;
+ }
+ break;
+ case 6:
+ /* Method length is 6, only valid method 6 bytes in length is DELEte */
+
+ /* If the first byte isn't 'D' then it's invalid */
+ if (*method != 'D') {
+ break;
+ }
+
+ if (method[5] == 'E' && method[4] == 'T' && method[3] == 'E' && method[2] == 'L' && method[1] == 'E') {
+ type = EVHTTP_REQ_DELETE;
+ }
+
+ break;
+ case 7:
+ /* Method length is 7, only valid methods are "OPTIONS" and "CONNECT" */
+ switch (*method) {
+ case 'O':
+ if (method[6] == 'S' && method[5] == 'N' && method[4] == 'O' &&
+ method[3] == 'I' && method[2] == 'T' && method[1] == 'P') {
+ type = EVHTTP_REQ_OPTIONS;
+ }
- break;
- default:
- break;
- }
- break;
- case 6:
- /* Method length is 6, only valid method 6 bytes in length is DELEte */
-
- /* If the first byte isn't 'D' then it's invalid */
- if (*method != 'D') {
- break;
- }
-
- if (method[5] == 'E' && method[4] == 'T' && method[3] == 'E' && method[2] == 'L' && method[1] == 'E') {
- type = EVHTTP_REQ_DELETE;
- }
-
- break;
- case 7:
- /* Method length is 7, only valid methods are "OPTIONS" and "CONNECT" */
- switch (*method) {
- case 'O':
- if (method[6] == 'S' && method[5] == 'N' && method[4] == 'O' &&
- method[3] == 'I' && method[2] == 'T' && method[1] == 'P') {
- type = EVHTTP_REQ_OPTIONS;
- }
-
- break;
- case 'C':
- if (method[6] == 'T' && method[5] == 'C' && method[4] == 'E' &&
- method[3] == 'N' && method[2] == 'N' && method[1] == 'O') {
- type = EVHTTP_REQ_CONNECT;
- }
-
- break;
- default:
- break;
- }
- break;
- } /* switch */
-
- if ((int)type == EVHTTP_REQ_UNKNOWN_) {
- event_debug(("%s: bad method %s on request %p from %s",
+ break;
+ case 'C':
+ if (method[6] == 'T' && method[5] == 'C' && method[4] == 'E' &&
+ method[3] == 'N' && method[2] == 'N' && method[1] == 'O') {
+ type = EVHTTP_REQ_CONNECT;
+ }
+
+ break;
+ default:
+ break;
+ }
+ break;
+ } /* switch */
+
+ if ((int)type == EVHTTP_REQ_UNKNOWN_) {
+ event_debug(("%s: bad method %s on request %p from %s",
__func__, method, req, req->remote_host));
- /* No error yet; we'll give a better error later when
- * we see that req->type is unsupported. */
+ /* No error yet; we'll give a better error later when
+ * we see that req->type is unsupported. */
}
-
- req->type = type;
+
+ req->type = type;
if (evhttp_parse_http_version(version, req) < 0)
- return -1;
+ return -1;
if ((req->uri = mm_strdup(uri)) == NULL) {
event_debug(("%s: mm_strdup", __func__));
- return -1;
+ return -1;
}
- if (type == EVHTTP_REQ_CONNECT) {
- if ((req->uri_elems = evhttp_uri_parse_authority(req->uri)) == NULL) {
- return -1;
- }
- } else {
- if ((req->uri_elems = evhttp_uri_parse_with_flags(req->uri,
- EVHTTP_URI_NONCONFORMANT)) == NULL) {
- return -1;
- }
+ if (type == EVHTTP_REQ_CONNECT) {
+ if ((req->uri_elems = evhttp_uri_parse_authority(req->uri)) == NULL) {
+ return -1;
+ }
+ } else {
+ if ((req->uri_elems = evhttp_uri_parse_with_flags(req->uri,
+ EVHTTP_URI_NONCONFORMANT)) == NULL) {
+ return -1;
+ }
}
/* If we have an absolute-URI, check to see if it is an http request
@@ -1925,8 +1925,8 @@ evhttp_parse_request_line(struct evhttp_request *req, char *line, size_t len)
req->chunk_cb_arg = chunkcb->cbarg;
}
}
-
- return 0;
+
+ return 0;
}
const char *
@@ -2056,14 +2056,14 @@ evhttp_add_header_internal(struct evkeyvalq *headers,
*/
enum message_read_status
-evhttp_parse_firstline_(struct evhttp_request *req, struct evbuffer *buffer)
+evhttp_parse_firstline_(struct evhttp_request *req, struct evbuffer *buffer)
{
char *line;
enum message_read_status status = ALL_DATA_READ;
- size_t len;
+ size_t len;
/* XXX try */
- line = evbuffer_readln(buffer, &len, EVBUFFER_EOL_CRLF);
+ line = evbuffer_readln(buffer, &len, EVBUFFER_EOL_CRLF);
if (line == NULL) {
if (req->evcon != NULL &&
evbuffer_get_length(buffer) > req->evcon->max_headers_size)
@@ -2072,16 +2072,16 @@ evhttp_parse_firstline_(struct evhttp_request *req, struct evbuffer *buffer)
return (MORE_DATA_EXPECTED);
}
- if (req->evcon != NULL && len > req->evcon->max_headers_size) {
+ if (req->evcon != NULL && len > req->evcon->max_headers_size) {
mm_free(line);
return (DATA_TOO_LONG);
}
- req->headers_size = len;
+ req->headers_size = len;
switch (req->kind) {
case EVHTTP_REQUEST:
- if (evhttp_parse_request_line(req, line, len) == -1)
+ if (evhttp_parse_request_line(req, line, len) == -1)
status = DATA_CORRUPTED;
break;
case EVHTTP_RESPONSE:
@@ -2097,7 +2097,7 @@ evhttp_parse_firstline_(struct evhttp_request *req, struct evbuffer *buffer)
}
static int
-evhttp_append_to_last_header(struct evkeyvalq *headers, char *line)
+evhttp_append_to_last_header(struct evkeyvalq *headers, char *line)
{
struct evkeyval *header = TAILQ_LAST(headers, evkeyvalq);
char *newval;
@@ -2107,39 +2107,39 @@ evhttp_append_to_last_header(struct evkeyvalq *headers, char *line)
return (-1);
old_len = strlen(header->value);
-
- /* Strip space from start and end of line. */
- while (*line == ' ' || *line == '\t')
- ++line;
- evutil_rtrim_lws_(line);
-
+
+ /* Strip space from start and end of line. */
+ while (*line == ' ' || *line == '\t')
+ ++line;
+ evutil_rtrim_lws_(line);
+
line_len = strlen(line);
- newval = mm_realloc(header->value, old_len + line_len + 2);
+ newval = mm_realloc(header->value, old_len + line_len + 2);
if (newval == NULL)
return (-1);
- newval[old_len] = ' ';
- memcpy(newval + old_len + 1, line, line_len + 1);
+ newval[old_len] = ' ';
+ memcpy(newval + old_len + 1, line, line_len + 1);
header->value = newval;
return (0);
}
enum message_read_status
-evhttp_parse_headers_(struct evhttp_request *req, struct evbuffer* buffer)
+evhttp_parse_headers_(struct evhttp_request *req, struct evbuffer* buffer)
{
enum message_read_status errcode = DATA_CORRUPTED;
char *line;
enum message_read_status status = MORE_DATA_EXPECTED;
struct evkeyvalq* headers = req->input_headers;
- size_t len;
- while ((line = evbuffer_readln(buffer, &len, EVBUFFER_EOL_CRLF))
+ size_t len;
+ while ((line = evbuffer_readln(buffer, &len, EVBUFFER_EOL_CRLF))
!= NULL) {
char *skey, *svalue;
- req->headers_size += len;
+ req->headers_size += len;
if (req->evcon != NULL &&
req->headers_size > req->evcon->max_headers_size) {
@@ -2168,7 +2168,7 @@ evhttp_parse_headers_(struct evhttp_request *req, struct evbuffer* buffer)
goto error;
svalue += strspn(svalue, " ");
- evutil_rtrim_lws_(svalue);
+ evutil_rtrim_lws_(svalue);
if (evhttp_add_header(headers, skey, svalue) == -1)
goto error;
@@ -2203,7 +2203,7 @@ evhttp_get_body_length(struct evhttp_request *req)
req->ntoread = -1;
else if (content_length == NULL &&
evutil_ascii_strcasecmp(connection, "Close") != 0) {
- req->ntoread = 0;
+ req->ntoread = 0;
} else if (content_length == NULL) {
req->ntoread = -1;
} else {
@@ -2231,15 +2231,15 @@ evhttp_method_may_have_body(enum evhttp_cmd_type type)
case EVHTTP_REQ_POST:
case EVHTTP_REQ_PUT:
case EVHTTP_REQ_PATCH:
-
+
case EVHTTP_REQ_GET:
case EVHTTP_REQ_DELETE:
case EVHTTP_REQ_OPTIONS:
case EVHTTP_REQ_CONNECT:
- return 1;
-
- case EVHTTP_REQ_TRACE:
- case EVHTTP_REQ_HEAD:
+ return 1;
+
+ case EVHTTP_REQ_TRACE:
+ case EVHTTP_REQ_HEAD:
default:
return 0;
}
@@ -2263,7 +2263,7 @@ evhttp_get_body(struct evhttp_connection *evcon, struct evhttp_request *req)
req->ntoread = -1;
} else {
if (evhttp_get_body_length(req) == -1) {
- evhttp_connection_fail_(evcon, EVREQ_HTTP_INVALID_HEADER);
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_INVALID_HEADER);
return;
}
if (req->kind == EVHTTP_REQUEST && req->ntoread < 1) {
@@ -2275,8 +2275,8 @@ evhttp_get_body(struct evhttp_connection *evcon, struct evhttp_request *req)
}
/* Should we send a 100 Continue status line? */
- switch (evhttp_have_expect(req, 1)) {
- case CONTINUE:
+ switch (evhttp_have_expect(req, 1)) {
+ case CONTINUE:
/* XXX It would be nice to do some sanity
checking here. Does the resource exist?
Should the resource accept post requests? If
@@ -2284,20 +2284,20 @@ evhttp_get_body(struct evhttp_connection *evcon, struct evhttp_request *req)
now, just optimistically tell the client to
send their message body. */
if (req->ntoread > 0) {
- /* ntoread is ev_int64_t, max_body_size is ev_uint64_t */
- if ((req->evcon->max_body_size <= EV_INT64_MAX) &&
- (ev_uint64_t)req->ntoread > req->evcon->max_body_size) {
- evhttp_lingering_fail(evcon, req);
+ /* ntoread is ev_int64_t, max_body_size is ev_uint64_t */
+ if ((req->evcon->max_body_size <= EV_INT64_MAX) &&
+ (ev_uint64_t)req->ntoread > req->evcon->max_body_size) {
+ evhttp_lingering_fail(evcon, req);
return;
}
}
if (!evbuffer_get_length(bufferevent_get_input(evcon->bufev)))
evhttp_send_continue(evcon, req);
- break;
- case OTHER:
- evhttp_send_error(req, HTTP_EXPECTATIONFAILED, NULL);
- return;
- case NO: break;
+ break;
+ case OTHER:
+ evhttp_send_error(req, HTTP_EXPECTATIONFAILED, NULL);
+ return;
+ case NO: break;
}
evhttp_read_body(evcon, req);
@@ -2310,12 +2310,12 @@ evhttp_read_firstline(struct evhttp_connection *evcon,
{
enum message_read_status res;
- res = evhttp_parse_firstline_(req, bufferevent_get_input(evcon->bufev));
+ res = evhttp_parse_firstline_(req, bufferevent_get_input(evcon->bufev));
if (res == DATA_CORRUPTED || res == DATA_TOO_LONG) {
/* Error while reading, terminate */
event_debug(("%s: bad header lines on "EV_SOCK_FMT"\n",
__func__, EV_SOCK_ARG(evcon->fd)));
- evhttp_connection_fail_(evcon, EVREQ_HTTP_INVALID_HEADER);
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_INVALID_HEADER);
return;
} else if (res == MORE_DATA_EXPECTED) {
/* Need more header lines */
@@ -2333,25 +2333,25 @@ evhttp_read_header(struct evhttp_connection *evcon,
enum message_read_status res;
evutil_socket_t fd = evcon->fd;
- res = evhttp_parse_headers_(req, bufferevent_get_input(evcon->bufev));
+ res = evhttp_parse_headers_(req, bufferevent_get_input(evcon->bufev));
if (res == DATA_CORRUPTED || res == DATA_TOO_LONG) {
/* Error while reading, terminate */
event_debug(("%s: bad header lines on "EV_SOCK_FMT"\n",
__func__, EV_SOCK_ARG(fd)));
- evhttp_connection_fail_(evcon, EVREQ_HTTP_INVALID_HEADER);
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_INVALID_HEADER);
return;
} else if (res == MORE_DATA_EXPECTED) {
/* Need more header lines */
return;
}
- /* Callback can shut down connection with negative return value */
- if (req->header_cb != NULL) {
- if ((*req->header_cb)(req, req->cb_arg) < 0) {
- evhttp_connection_fail_(evcon, EVREQ_HTTP_EOF);
- return;
- }
- }
+ /* Callback can shut down connection with negative return value */
+ if (req->header_cb != NULL) {
+ if ((*req->header_cb)(req, req->cb_arg) < 0) {
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_EOF);
+ return;
+ }
+ }
/* Done reading headers, do the real work */
switch (req->kind) {
@@ -2365,9 +2365,9 @@ evhttp_read_header(struct evhttp_connection *evcon,
case EVHTTP_RESPONSE:
/* Start over if we got a 100 Continue response. */
if (req->response_code == 100) {
- struct evbuffer *output = bufferevent_get_output(evcon->bufev);
- evbuffer_add_buffer(output, req->output_buffer);
- evhttp_start_write_(evcon);
+ struct evbuffer *output = bufferevent_get_output(evcon->bufev);
+ evbuffer_add_buffer(output, req->output_buffer);
+ evhttp_start_write_(evcon);
return;
}
if (!evhttp_response_needs_body(req)) {
@@ -2387,7 +2387,7 @@ evhttp_read_header(struct evhttp_connection *evcon,
default:
event_warnx("%s: bad header on "EV_SOCK_FMT, __func__,
EV_SOCK_ARG(fd));
- evhttp_connection_fail_(evcon, EVREQ_HTTP_INVALID_HEADER);
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_INVALID_HEADER);
break;
}
/* request may have been freed above */
@@ -2428,14 +2428,14 @@ struct evhttp_connection *evhttp_connection_base_bufferevent_factory_new(
}
struct evhttp_connection *
-evhttp_connection_new(const char *address, ev_uint16_t port)
+evhttp_connection_new(const char *address, ev_uint16_t port)
{
return (evhttp_connection_base_new(NULL, NULL, address, port));
}
struct evhttp_connection *
evhttp_connection_base_bufferevent_new(struct event_base *base, struct evdns_base *dnsbase, struct bufferevent* bev,
- const char *address, ev_uint16_t port)
+ const char *address, ev_uint16_t port)
{
struct evhttp_connection *evcon = NULL;
@@ -2452,43 +2452,43 @@ evhttp_connection_base_bufferevent_new(struct event_base *base, struct evdns_bas
evcon->max_headers_size = EV_SIZE_MAX;
evcon->max_body_size = EV_SIZE_MAX;
- evutil_timerclear(&evcon->timeout);
+ evutil_timerclear(&evcon->timeout);
evcon->retry_cnt = evcon->retry_max = 0;
if ((evcon->address = mm_strdup(address)) == NULL) {
event_warn("%s: strdup failed", __func__);
goto error;
}
-
+
if (bev == NULL) {
- if (!(bev = bufferevent_socket_new(base, -1, 0))) {
- event_warn("%s: bufferevent_socket_new failed", __func__);
+ if (!(bev = bufferevent_socket_new(base, -1, 0))) {
+ event_warn("%s: bufferevent_socket_new failed", __func__);
goto error;
}
}
- bufferevent_setcb(bev, evhttp_read_cb, evhttp_write_cb, evhttp_error_cb, evcon);
- evcon->bufev = bev;
-
+ bufferevent_setcb(bev, evhttp_read_cb, evhttp_write_cb, evhttp_error_cb, evcon);
+ evcon->bufev = bev;
+
evcon->state = EVCON_DISCONNECTED;
TAILQ_INIT(&evcon->requests);
- evcon->initial_retry_timeout.tv_sec = 2;
- evcon->initial_retry_timeout.tv_usec = 0;
-
+ evcon->initial_retry_timeout.tv_sec = 2;
+ evcon->initial_retry_timeout.tv_usec = 0;
+
if (base != NULL) {
evcon->base = base;
- if (bufferevent_get_base(bev) != base)
- bufferevent_base_set(base, evcon->bufev);
+ if (bufferevent_get_base(bev) != base)
+ bufferevent_base_set(base, evcon->bufev);
}
- event_deferred_cb_init_(
- &evcon->read_more_deferred_cb,
- bufferevent_get_priority(bev),
+ event_deferred_cb_init_(
+ &evcon->read_more_deferred_cb,
+ bufferevent_get_priority(bev),
evhttp_deferred_read_cb, evcon);
evcon->dns_base = dnsbase;
- evcon->ai_family = AF_UNSPEC;
+ evcon->ai_family = AF_UNSPEC;
return (evcon);
@@ -2498,46 +2498,46 @@ evhttp_connection_base_bufferevent_new(struct event_base *base, struct evdns_bas
return (NULL);
}
-struct bufferevent* evhttp_connection_get_bufferevent(struct evhttp_connection *evcon)
+struct bufferevent* evhttp_connection_get_bufferevent(struct evhttp_connection *evcon)
{
return evcon->bufev;
}
-struct evhttp *
-evhttp_connection_get_server(struct evhttp_connection *evcon)
+struct evhttp *
+evhttp_connection_get_server(struct evhttp_connection *evcon)
{
- return evcon->http_server;
-}
+ return evcon->http_server;
+}
struct evhttp_connection *
evhttp_connection_base_new(struct event_base *base, struct evdns_base *dnsbase,
- const char *address, ev_uint16_t port)
+ const char *address, ev_uint16_t port)
{
return evhttp_connection_base_bufferevent_new(base, dnsbase, NULL, address, port);
}
-void evhttp_connection_set_family(struct evhttp_connection *evcon,
- int family)
-{
- evcon->ai_family = family;
-}
-
-int evhttp_connection_set_flags(struct evhttp_connection *evcon,
- int flags)
-{
- int avail_flags = 0;
- avail_flags |= EVHTTP_CON_REUSE_CONNECTED_ADDR;
- avail_flags |= EVHTTP_CON_READ_ON_WRITE_ERROR;
-
- if (flags & ~avail_flags || flags > EVHTTP_CON_PUBLIC_FLAGS_END)
- return 1;
- evcon->flags &= ~avail_flags;
-
- evcon->flags |= flags;
-
- return 0;
-}
-
+void evhttp_connection_set_family(struct evhttp_connection *evcon,
+ int family)
+{
+ evcon->ai_family = family;
+}
+
+int evhttp_connection_set_flags(struct evhttp_connection *evcon,
+ int flags)
+{
+ int avail_flags = 0;
+ avail_flags |= EVHTTP_CON_REUSE_CONNECTED_ADDR;
+ avail_flags |= EVHTTP_CON_READ_ON_WRITE_ERROR;
+
+ if (flags & ~avail_flags || flags > EVHTTP_CON_PUBLIC_FLAGS_END)
+ return 1;
+ evcon->flags &= ~avail_flags;
+
+ evcon->flags |= flags;
+
+ return 0;
+}
+
void
evhttp_connection_set_base(struct evhttp_connection *evcon,
struct event_base *base)
@@ -2552,44 +2552,44 @@ void
evhttp_connection_set_timeout(struct evhttp_connection *evcon,
int timeout_in_secs)
{
- if (timeout_in_secs == -1)
- evhttp_connection_set_timeout_tv(evcon, NULL);
- else {
- struct timeval tv;
- tv.tv_sec = timeout_in_secs;
- tv.tv_usec = 0;
- evhttp_connection_set_timeout_tv(evcon, &tv);
- }
-}
-
-void
-evhttp_connection_set_timeout_tv(struct evhttp_connection *evcon,
- const struct timeval* tv)
-{
- if (tv) {
- evcon->timeout = *tv;
- bufferevent_set_timeouts(evcon->bufev, &evcon->timeout, &evcon->timeout);
- } else {
- const struct timeval read_tv = { HTTP_READ_TIMEOUT, 0 };
- const struct timeval write_tv = { HTTP_WRITE_TIMEOUT, 0 };
- evutil_timerclear(&evcon->timeout);
- bufferevent_set_timeouts(evcon->bufev, &read_tv, &write_tv);
- }
-}
-
-void
-evhttp_connection_set_initial_retry_tv(struct evhttp_connection *evcon,
- const struct timeval *tv)
-{
- if (tv) {
- evcon->initial_retry_timeout = *tv;
- } else {
- evutil_timerclear(&evcon->initial_retry_timeout);
- evcon->initial_retry_timeout.tv_sec = 2;
- }
+ if (timeout_in_secs == -1)
+ evhttp_connection_set_timeout_tv(evcon, NULL);
+ else {
+ struct timeval tv;
+ tv.tv_sec = timeout_in_secs;
+ tv.tv_usec = 0;
+ evhttp_connection_set_timeout_tv(evcon, &tv);
+ }
+}
+
+void
+evhttp_connection_set_timeout_tv(struct evhttp_connection *evcon,
+ const struct timeval* tv)
+{
+ if (tv) {
+ evcon->timeout = *tv;
+ bufferevent_set_timeouts(evcon->bufev, &evcon->timeout, &evcon->timeout);
+ } else {
+ const struct timeval read_tv = { HTTP_READ_TIMEOUT, 0 };
+ const struct timeval write_tv = { HTTP_WRITE_TIMEOUT, 0 };
+ evutil_timerclear(&evcon->timeout);
+ bufferevent_set_timeouts(evcon->bufev, &read_tv, &write_tv);
+ }
}
void
+evhttp_connection_set_initial_retry_tv(struct evhttp_connection *evcon,
+ const struct timeval *tv)
+{
+ if (tv) {
+ evcon->initial_retry_timeout = *tv;
+ } else {
+ evutil_timerclear(&evcon->initial_retry_timeout);
+ evcon->initial_retry_timeout.tv_sec = 2;
+ }
+}
+
+void
evhttp_connection_set_retries(struct evhttp_connection *evcon,
int retry_max)
{
@@ -2612,24 +2612,24 @@ evhttp_connection_get_peer(struct evhttp_connection *evcon,
*port = evcon->port;
}
-const struct sockaddr*
-evhttp_connection_get_addr(struct evhttp_connection *evcon)
-{
- return bufferevent_socket_get_conn_address_(evcon->bufev);
-}
-
+const struct sockaddr*
+evhttp_connection_get_addr(struct evhttp_connection *evcon)
+{
+ return bufferevent_socket_get_conn_address_(evcon->bufev);
+}
+
int
-evhttp_connection_connect_(struct evhttp_connection *evcon)
+evhttp_connection_connect_(struct evhttp_connection *evcon)
{
int old_state = evcon->state;
- const char *address = evcon->address;
- const struct sockaddr *sa = evhttp_connection_get_addr(evcon);
- int ret;
+ const char *address = evcon->address;
+ const struct sockaddr *sa = evhttp_connection_get_addr(evcon);
+ int ret;
if (evcon->state == EVCON_CONNECTING)
return (0);
- evhttp_connection_reset_(evcon);
+ evhttp_connection_reset_(evcon);
EVUTIL_ASSERT(!(evcon->flags & EVHTTP_CON_INCOMING));
evcon->flags |= EVHTTP_CON_OUTGOING;
@@ -2643,11 +2643,11 @@ evhttp_connection_connect_(struct evhttp_connection *evcon)
return (-1);
}
- if (bufferevent_setfd(evcon->bufev, evcon->fd))
- return (-1);
+ if (bufferevent_setfd(evcon->bufev, evcon->fd))
+ return (-1);
} else {
- if (bufferevent_setfd(evcon->bufev, -1))
- return (-1);
+ if (bufferevent_setfd(evcon->bufev, -1))
+ return (-1);
}
/* Set up a callback for successful connection setup */
@@ -2656,32 +2656,32 @@ evhttp_connection_connect_(struct evhttp_connection *evcon)
NULL /* evhttp_write_cb */,
evhttp_connection_cb,
evcon);
- if (!evutil_timerisset(&evcon->timeout)) {
- const struct timeval conn_tv = { HTTP_CONNECT_TIMEOUT, 0 };
- bufferevent_set_timeouts(evcon->bufev, &conn_tv, &conn_tv);
- } else {
- bufferevent_set_timeouts(evcon->bufev, &evcon->timeout, &evcon->timeout);
- }
+ if (!evutil_timerisset(&evcon->timeout)) {
+ const struct timeval conn_tv = { HTTP_CONNECT_TIMEOUT, 0 };
+ bufferevent_set_timeouts(evcon->bufev, &conn_tv, &conn_tv);
+ } else {
+ bufferevent_set_timeouts(evcon->bufev, &evcon->timeout, &evcon->timeout);
+ }
/* make sure that we get a write callback */
- if (bufferevent_enable(evcon->bufev, EV_WRITE))
- return (-1);
+ if (bufferevent_enable(evcon->bufev, EV_WRITE))
+ return (-1);
evcon->state = EVCON_CONNECTING;
- if (evcon->flags & EVHTTP_CON_REUSE_CONNECTED_ADDR &&
- sa &&
- (sa->sa_family == AF_INET || sa->sa_family == AF_INET6)) {
- int socklen = sizeof(struct sockaddr_in);
- if (sa->sa_family == AF_INET6) {
- socklen = sizeof(struct sockaddr_in6);
- }
- ret = bufferevent_socket_connect(evcon->bufev, sa, socklen);
- } else {
- ret = bufferevent_socket_connect_hostname(evcon->bufev,
- evcon->dns_base, evcon->ai_family, address, evcon->port);
- }
-
- if (ret < 0) {
+ if (evcon->flags & EVHTTP_CON_REUSE_CONNECTED_ADDR &&
+ sa &&
+ (sa->sa_family == AF_INET || sa->sa_family == AF_INET6)) {
+ int socklen = sizeof(struct sockaddr_in);
+ if (sa->sa_family == AF_INET6) {
+ socklen = sizeof(struct sockaddr_in6);
+ }
+ ret = bufferevent_socket_connect(evcon->bufev, sa, socklen);
+ } else {
+ ret = bufferevent_socket_connect_hostname(evcon->bufev,
+ evcon->dns_base, evcon->ai_family, address, evcon->port);
+ }
+
+ if (ret < 0) {
evcon->state = old_state;
event_sock_warn(evcon->fd, "%s: connection to \"%s\" failed",
__func__, evcon->address);
@@ -2714,7 +2714,7 @@ evhttp_make_request(struct evhttp_connection *evcon,
mm_free(req->uri);
if ((req->uri = mm_strdup(uri)) == NULL) {
event_warn("%s: strdup", __func__);
- evhttp_request_free_auto(req);
+ evhttp_request_free_auto(req);
return (-1);
}
@@ -2728,23 +2728,23 @@ evhttp_make_request(struct evhttp_connection *evcon,
req->evcon = evcon;
EVUTIL_ASSERT(!(req->flags & EVHTTP_REQ_OWN_CONNECTION));
- TAILQ_INSERT_TAIL(&evcon->requests, req, next);
-
- /* We do not want to conflict with retry_ev */
- if (evcon->retry_cnt)
- return (0);
+ TAILQ_INSERT_TAIL(&evcon->requests, req, next);
+ /* We do not want to conflict with retry_ev */
+ if (evcon->retry_cnt)
+ return (0);
+
/* If the connection object is not connected; make it so */
if (!evhttp_connected(evcon)) {
- int res = evhttp_connection_connect_(evcon);
- /* evhttp_connection_fail_(), which is called through
- * evhttp_connection_connect_(), assumes that req lies in
- * evcon->requests. Thus, enqueue the request in advance and
- * remove it in the error case. */
- if (res != 0)
- TAILQ_REMOVE(&evcon->requests, req, next);
+ int res = evhttp_connection_connect_(evcon);
+ /* evhttp_connection_fail_(), which is called through
+ * evhttp_connection_connect_(), assumes that req lies in
+ * evcon->requests. Thus, enqueue the request in advance and
+ * remove it in the error case. */
+ if (res != 0)
+ TAILQ_REMOVE(&evcon->requests, req, next);
- return (res);
+ return (res);
}
/*
@@ -2768,8 +2768,8 @@ evhttp_cancel_request(struct evhttp_request *req)
/* it's currently being worked on, so reset
* the connection.
*/
- evhttp_connection_fail_(evcon,
- EVREQ_HTTP_REQUEST_CANCEL);
+ evhttp_connection_fail_(evcon,
+ EVREQ_HTTP_REQUEST_CANCEL);
/* connection fail freed the request */
return;
@@ -2781,7 +2781,7 @@ evhttp_cancel_request(struct evhttp_request *req)
}
}
- evhttp_request_free_auto(req);
+ evhttp_request_free_auto(req);
}
/*
@@ -2790,11 +2790,11 @@ evhttp_cancel_request(struct evhttp_request *req)
*/
void
-evhttp_start_read_(struct evhttp_connection *evcon)
+evhttp_start_read_(struct evhttp_connection *evcon)
{
bufferevent_disable(evcon->bufev, EV_WRITE);
bufferevent_enable(evcon->bufev, EV_READ);
-
+
evcon->state = EVCON_READING_FIRSTLINE;
/* Reset the bufferevent callbacks */
bufferevent_setcb(evcon->bufev,
@@ -2806,21 +2806,21 @@ evhttp_start_read_(struct evhttp_connection *evcon)
/* If there's still data pending, process it next time through the
* loop. Don't do it now; that could get recusive. */
if (evbuffer_get_length(bufferevent_get_input(evcon->bufev))) {
- event_deferred_cb_schedule_(get_deferred_queue(evcon),
+ event_deferred_cb_schedule_(get_deferred_queue(evcon),
&evcon->read_more_deferred_cb);
}
}
-void
-evhttp_start_write_(struct evhttp_connection *evcon)
-{
- bufferevent_disable(evcon->bufev, EV_WRITE);
- bufferevent_enable(evcon->bufev, EV_READ);
-
- evcon->state = EVCON_WRITING;
- evhttp_write_buffer(evcon, evhttp_write_connectioncb, NULL);
-}
-
+void
+evhttp_start_write_(struct evhttp_connection *evcon)
+{
+ bufferevent_disable(evcon->bufev, EV_WRITE);
+ bufferevent_enable(evcon->bufev, EV_READ);
+
+ evcon->state = EVCON_WRITING;
+ evhttp_write_buffer(evcon, evhttp_write_connectioncb, NULL);
+}
+
static void
evhttp_send_done(struct evhttp_connection *evcon, void *arg)
{
@@ -2828,14 +2828,14 @@ evhttp_send_done(struct evhttp_connection *evcon, void *arg)
struct evhttp_request *req = TAILQ_FIRST(&evcon->requests);
TAILQ_REMOVE(&evcon->requests, req, next);
- if (req->on_complete_cb != NULL) {
- req->on_complete_cb(req, req->on_complete_cb_arg);
- }
-
+ if (req->on_complete_cb != NULL) {
+ req->on_complete_cb(req, req->on_complete_cb_arg);
+ }
+
need_close =
(REQ_VERSION_BEFORE(req, 1, 1) &&
- !evhttp_is_connection_keepalive(req->input_headers)) ||
- evhttp_is_request_connection_close(req);
+ !evhttp_is_connection_keepalive(req->input_headers)) ||
+ evhttp_is_request_connection_close(req);
EVUTIL_ASSERT(req->flags & EVHTTP_REQ_OWN_CONNECTION);
evhttp_request_free(req);
@@ -2875,11 +2875,11 @@ evhttp_send_error(struct evhttp_request *req, int error, const char *reason)
reason = evhttp_response_phrase_internal(error);
}
- evhttp_response_code_(req, error, reason);
+ evhttp_response_code_(req, error, reason);
evbuffer_add_printf(buf, ERR_FORMAT, error, reason, reason);
- evhttp_send_page_(req, buf);
+ evhttp_send_page_(req, buf);
evbuffer_free(buf);
#undef ERR_FORMAT
@@ -2916,7 +2916,7 @@ void
evhttp_send_reply(struct evhttp_request *req, int code, const char *reason,
struct evbuffer *databuf)
{
- evhttp_response_code_(req, code, reason);
+ evhttp_response_code_(req, code, reason);
evhttp_send(req, databuf);
}
@@ -2925,11 +2925,11 @@ void
evhttp_send_reply_start(struct evhttp_request *req, int code,
const char *reason)
{
- evhttp_response_code_(req, code, reason);
-
- if (req->evcon == NULL)
- return;
-
+ evhttp_response_code_(req, code, reason);
+
+ if (req->evcon == NULL)
+ return;
+
if (evhttp_find_header(req->output_headers, "Content-Length") == NULL &&
REQ_VERSION_ATLEAST(req, 1, 1) &&
evhttp_response_needs_body(req)) {
@@ -2949,8 +2949,8 @@ evhttp_send_reply_start(struct evhttp_request *req, int code,
}
void
-evhttp_send_reply_chunk_with_cb(struct evhttp_request *req, struct evbuffer *databuf,
- void (*cb)(struct evhttp_connection *, void *), void *arg)
+evhttp_send_reply_chunk_with_cb(struct evhttp_request *req, struct evbuffer *databuf,
+ void (*cb)(struct evhttp_connection *, void *), void *arg)
{
struct evhttp_connection *evcon = req->evcon;
struct evbuffer *output;
@@ -2972,15 +2972,15 @@ evhttp_send_reply_chunk_with_cb(struct evhttp_request *req, struct evbuffer *dat
if (req->chunked) {
evbuffer_add(output, "\r\n", 2);
}
- evhttp_write_buffer(evcon, cb, arg);
+ evhttp_write_buffer(evcon, cb, arg);
}
void
-evhttp_send_reply_chunk(struct evhttp_request *req, struct evbuffer *databuf)
-{
- evhttp_send_reply_chunk_with_cb(req, databuf, NULL, NULL);
-}
-void
+evhttp_send_reply_chunk(struct evhttp_request *req, struct evbuffer *databuf)
+{
+ evhttp_send_reply_chunk_with_cb(req, databuf, NULL, NULL);
+}
+void
evhttp_send_reply_end(struct evhttp_request *req)
{
struct evhttp_connection *evcon = req->evcon;
@@ -3101,7 +3101,7 @@ evhttp_response_phrase_internal(int code)
}
void
-evhttp_response_code_(struct evhttp_request *req, int code, const char *reason)
+evhttp_response_code_(struct evhttp_request *req, int code, const char *reason)
{
req->kind = EVHTTP_RESPONSE;
req->response_code = code;
@@ -3117,7 +3117,7 @@ evhttp_response_code_(struct evhttp_request *req, int code, const char *reason)
}
void
-evhttp_send_page_(struct evhttp_request *req, struct evbuffer *databuf)
+evhttp_send_page_(struct evhttp_request *req, struct evbuffer *databuf)
{
if (!req->major || !req->minor) {
req->major = 1;
@@ -3125,7 +3125,7 @@ evhttp_send_page_(struct evhttp_request *req, struct evbuffer *databuf)
}
if (req->kind != EVHTTP_RESPONSE)
- evhttp_response_code_(req, 200, "OK");
+ evhttp_response_code_(req, 200, "OK");
evhttp_clear_headers(req->output_headers);
evhttp_add_header(req->output_headers, "Content-Type", "text/html");
@@ -3169,33 +3169,33 @@ evhttp_uriencode(const char *uri, ev_ssize_t len, int space_as_plus)
{
struct evbuffer *buf = evbuffer_new();
const char *p, *end;
- char *result = NULL;
-
- if (!buf) {
- goto out;
- }
-
- if (len >= 0) {
- if (uri + len < uri) {
- goto out;
- }
-
- end = uri + len;
- } else {
- size_t slen = strlen(uri);
-
- if (slen >= EV_SSIZE_MAX) {
- /* we don't want to mix signed and unsigned */
- goto out;
- }
-
- if (uri + slen < uri) {
- goto out;
- }
-
- end = uri + slen;
- }
-
+ char *result = NULL;
+
+ if (!buf) {
+ goto out;
+ }
+
+ if (len >= 0) {
+ if (uri + len < uri) {
+ goto out;
+ }
+
+ end = uri + len;
+ } else {
+ size_t slen = strlen(uri);
+
+ if (slen >= EV_SSIZE_MAX) {
+ /* we don't want to mix signed and unsigned */
+ goto out;
+ }
+
+ if (uri + slen < uri) {
+ goto out;
+ }
+
+ end = uri + slen;
+ }
+
for (p = uri; p < end; p++) {
if (CHAR_IS_UNRESERVED(*p)) {
evbuffer_add(buf, p, 1);
@@ -3205,17 +3205,17 @@ evhttp_uriencode(const char *uri, ev_ssize_t len, int space_as_plus)
evbuffer_add_printf(buf, "%%%02X", (unsigned char)(*p));
}
}
-
+
evbuffer_add(buf, "", 1); /* NUL-terminator. */
result = mm_malloc(evbuffer_get_length(buf));
-
+
if (result)
evbuffer_remove(buf, result, evbuffer_get_length(buf));
-out:
- if (buf)
- evbuffer_free(buf);
- return result;
+out:
+ if (buf)
+ evbuffer_free(buf);
+ return result;
}
char *
@@ -3230,7 +3230,7 @@ evhttp_encode_uri(const char *str)
* a ?. -1 is deprecated.
* @return the number of bytes written to 'ret'.
*/
-int
+int
evhttp_decode_uri_internal(
const char *uri, size_t length, char *ret, int decode_plus_ctl)
{
@@ -3246,8 +3246,8 @@ evhttp_decode_uri_internal(
decode_plus = 1;
} else if (c == '+' && decode_plus) {
c = ' ';
- } else if ((i + 2) < length && c == '%' &&
- EVUTIL_ISXDIGIT_(uri[i+1]) && EVUTIL_ISXDIGIT_(uri[i+2])) {
+ } else if ((i + 2) < length && c == '%' &&
+ EVUTIL_ISXDIGIT_(uri[i+1]) && EVUTIL_ISXDIGIT_(uri[i+2])) {
char tmp[3];
tmp[0] = uri[i+1];
tmp[1] = uri[i+2];
@@ -3443,7 +3443,7 @@ prefix_suffix_match(const char *pattern, const char *name, int ignorecase)
default:
if (c != *name) {
if (!ignorecase ||
- EVUTIL_TOLOWER_(c) != EVUTIL_TOLOWER_(*name))
+ EVUTIL_TOLOWER_(c) != EVUTIL_TOLOWER_(*name))
return (0);
}
++name;
@@ -3534,10 +3534,10 @@ evhttp_handle_request(struct evhttp_request *req, void *arg)
/* we have a new request on which the user needs to take action */
req->userdone = 0;
- bufferevent_disable(req->evcon->bufev, EV_READ);
-
+ bufferevent_disable(req->evcon->bufev, EV_READ);
+
if (req->type == 0 || req->uri == NULL) {
- evhttp_send_error(req, req->response_code, NULL);
+ evhttp_send_error(req, req->response_code, NULL);
return;
}
@@ -3586,13 +3586,13 @@ evhttp_handle_request(struct evhttp_request *req, void *arg)
return;
}
- evhttp_response_code_(req, HTTP_NOTFOUND, "Not Found");
+ evhttp_response_code_(req, HTTP_NOTFOUND, "Not Found");
evbuffer_add_printf(buf, ERR_FORMAT, escaped_html);
mm_free(escaped_html);
- evhttp_send_page_(req, buf);
+ evhttp_send_page_(req, buf);
evbuffer_free(buf);
#undef ERR_FORMAT
@@ -3623,16 +3623,16 @@ evhttp_bind_socket_with_handle(struct evhttp *http, const char *address, ev_uint
{
evutil_socket_t fd;
struct evhttp_bound_socket *bound;
- int serrno;
+ int serrno;
if ((fd = bind_socket(address, port, 1 /*reuse*/)) == -1)
return (NULL);
if (listen(fd, 128) == -1) {
- serrno = EVUTIL_SOCKET_ERROR();
+ serrno = EVUTIL_SOCKET_ERROR();
event_sock_warn(fd, "%s: listen", __func__);
evutil_closesocket(fd);
- EVUTIL_SET_SOCKET_ERROR(serrno);
+ EVUTIL_SET_SOCKET_ERROR(serrno);
return (NULL);
}
@@ -3657,17 +3657,17 @@ evhttp_accept_socket(struct evhttp *http, evutil_socket_t fd)
return (0);
}
-void
-evhttp_foreach_bound_socket(struct evhttp *http,
- evhttp_bound_socket_foreach_fn *function,
- void *argument)
-{
- struct evhttp_bound_socket *bound;
-
- TAILQ_FOREACH(bound, &http->sockets, next)
- function(bound, argument);
-}
+void
+evhttp_foreach_bound_socket(struct evhttp *http,
+ evhttp_bound_socket_foreach_fn *function,
+ void *argument)
+{
+ struct evhttp_bound_socket *bound;
+ TAILQ_FOREACH(bound, &http->sockets, next)
+ function(bound, argument);
+}
+
struct evhttp_bound_socket *
evhttp_accept_socket_with_handle(struct evhttp *http, evutil_socket_t fd)
{
@@ -3737,10 +3737,10 @@ evhttp_new_object(void)
return (NULL);
}
- evutil_timerclear(&http->timeout);
+ evutil_timerclear(&http->timeout);
evhttp_set_max_headers_size(http, EV_SIZE_MAX);
evhttp_set_max_body_size(http, EV_SIZE_MAX);
- evhttp_set_default_content_type(http, "text/html; charset=ISO-8859-1");
+ evhttp_set_default_content_type(http, "text/html; charset=ISO-8859-1");
evhttp_set_allowed_methods(http,
EVHTTP_REQ_GET |
EVHTTP_REQ_POST |
@@ -3775,7 +3775,7 @@ evhttp_new(struct event_base *base)
*/
struct evhttp *
-evhttp_start(const char *address, ev_uint16_t port)
+evhttp_start(const char *address, ev_uint16_t port)
{
struct evhttp *http = NULL;
@@ -3909,41 +3909,41 @@ evhttp_remove_server_alias(struct evhttp *http, const char *alias)
void
evhttp_set_timeout(struct evhttp* http, int timeout_in_secs)
{
- if (timeout_in_secs == -1) {
- evhttp_set_timeout_tv(http, NULL);
- } else {
- struct timeval tv;
- tv.tv_sec = timeout_in_secs;
- tv.tv_usec = 0;
- evhttp_set_timeout_tv(http, &tv);
- }
-}
-
-void
-evhttp_set_timeout_tv(struct evhttp* http, const struct timeval* tv)
-{
- if (tv) {
- http->timeout = *tv;
- } else {
- evutil_timerclear(&http->timeout);
- }
-}
-
-int evhttp_set_flags(struct evhttp *http, int flags)
-{
- int avail_flags = 0;
- avail_flags |= EVHTTP_SERVER_LINGERING_CLOSE;
-
- if (flags & ~avail_flags)
- return 1;
- http->flags &= ~avail_flags;
-
- http->flags |= flags;
-
- return 0;
+ if (timeout_in_secs == -1) {
+ evhttp_set_timeout_tv(http, NULL);
+ } else {
+ struct timeval tv;
+ tv.tv_sec = timeout_in_secs;
+ tv.tv_usec = 0;
+ evhttp_set_timeout_tv(http, &tv);
+ }
}
void
+evhttp_set_timeout_tv(struct evhttp* http, const struct timeval* tv)
+{
+ if (tv) {
+ http->timeout = *tv;
+ } else {
+ evutil_timerclear(&http->timeout);
+ }
+}
+
+int evhttp_set_flags(struct evhttp *http, int flags)
+{
+ int avail_flags = 0;
+ avail_flags |= EVHTTP_SERVER_LINGERING_CLOSE;
+
+ if (flags & ~avail_flags)
+ return 1;
+ http->flags &= ~avail_flags;
+
+ http->flags |= flags;
+
+ return 0;
+}
+
+void
evhttp_set_max_headers_size(struct evhttp* http, ev_ssize_t max_headers_size)
{
if (max_headers_size < 0)
@@ -3962,18 +3962,18 @@ evhttp_set_max_body_size(struct evhttp* http, ev_ssize_t max_body_size)
}
void
-evhttp_set_default_content_type(struct evhttp *http,
- const char *content_type) {
- http->default_content_type = content_type;
-}
-
-void
+evhttp_set_default_content_type(struct evhttp *http,
+ const char *content_type) {
+ http->default_content_type = content_type;
+}
+
+void
evhttp_set_allowed_methods(struct evhttp* http, ev_uint16_t methods)
{
http->allowed_methods = methods;
}
-int
+int
evhttp_set_cb_internal(struct evhttp *http, const char *uri,
void (*cb)(struct evhttp_request *, void *), void *cbarg, int chunked)
{
@@ -3995,8 +3995,8 @@ evhttp_set_cb_internal(struct evhttp *http, const char *uri,
mm_free(http_cb);
return (-3);
}
- http_cb->cb = cb;
- http_cb->cbarg = cbarg;
+ http_cb->cb = cb;
+ http_cb->cbarg = cbarg;
http_cb->chunked = chunked;
TAILQ_INSERT_TAIL(&http->callbacks, http_cb, next);
@@ -4172,28 +4172,28 @@ evhttp_request_set_chunked_cb(struct evhttp_request *req,
req->chunk_cb_arg = arg;
}
-void
-evhttp_request_set_header_cb(struct evhttp_request *req,
- int (*cb)(struct evhttp_request *, void *))
-{
- req->header_cb = cb;
-}
-
-void
-evhttp_request_set_error_cb(struct evhttp_request *req,
- void (*cb)(enum evhttp_request_error, void *))
-{
- req->error_cb = cb;
-}
-
-void
-evhttp_request_set_on_complete_cb(struct evhttp_request *req,
- void (*cb)(struct evhttp_request *, void *), void *cb_arg)
-{
- req->on_complete_cb = cb;
- req->on_complete_cb_arg = cb_arg;
-}
-
+void
+evhttp_request_set_header_cb(struct evhttp_request *req,
+ int (*cb)(struct evhttp_request *, void *))
+{
+ req->header_cb = cb;
+}
+
+void
+evhttp_request_set_error_cb(struct evhttp_request *req,
+ void (*cb)(enum evhttp_request_error, void *))
+{
+ req->error_cb = cb;
+}
+
+void
+evhttp_request_set_on_complete_cb(struct evhttp_request *req,
+ void (*cb)(struct evhttp_request *, void *), void *cb_arg)
+{
+ req->on_complete_cb = cb;
+ req->on_complete_cb_arg = cb_arg;
+}
+
/*
* Allows for inspection of the request URI
*/
@@ -4232,7 +4232,7 @@ evhttp_request_get_host(struct evhttp_request *req)
to be consistent with uri_elems case above. */
if (host) {
p = host + strlen(host) - 1;
- while (p > host && EVUTIL_ISDIGIT_(*p))
+ while (p > host && EVUTIL_ISDIGIT_(*p))
--p;
if (p > host && *p == ':') {
len = p - host;
@@ -4262,12 +4262,12 @@ evhttp_request_get_response_code(const struct evhttp_request *req)
return req->response_code;
}
-const char *
-evhttp_request_get_response_code_line(const struct evhttp_request *req)
-{
- return req->response_code_line;
-}
-
+const char *
+evhttp_request_get_response_code_line(const struct evhttp_request *req)
+{
+ return req->response_code_line;
+}
+
/** Returns the input headers */
struct evkeyvalq *evhttp_request_get_input_headers(struct evhttp_request *req)
{
@@ -4307,13 +4307,13 @@ evhttp_get_request_connection(
char *hostname = NULL, *portname = NULL;
struct bufferevent* bev = NULL;
-#ifdef EVENT__HAVE_STRUCT_SOCKADDR_UN
- if (sa->sa_family == AF_UNIX) {
- struct sockaddr_un *sa_un = (struct sockaddr_un *)sa;
- sa_un->sun_path[0] = '\0';
- }
-#endif
-
+#ifdef EVENT__HAVE_STRUCT_SOCKADDR_UN
+ if (sa->sa_family == AF_UNIX) {
+ struct sockaddr_un *sa_un = (struct sockaddr_un *)sa;
+ sa_un->sun_path[0] = '\0';
+ }
+#endif
+
name_from_addr(sa, salen, &hostname, &portname);
if (hostname == NULL || portname == NULL) {
if (hostname) mm_free(hostname);
@@ -4337,27 +4337,27 @@ evhttp_get_request_connection(
evcon->max_headers_size = http->default_max_headers_size;
evcon->max_body_size = http->default_max_body_size;
- if (http->flags & EVHTTP_SERVER_LINGERING_CLOSE)
- evcon->flags |= EVHTTP_CON_LINGERING_CLOSE;
+ if (http->flags & EVHTTP_SERVER_LINGERING_CLOSE)
+ evcon->flags |= EVHTTP_CON_LINGERING_CLOSE;
evcon->flags |= EVHTTP_CON_INCOMING;
evcon->state = EVCON_READING_FIRSTLINE;
evcon->fd = fd;
- if (bufferevent_setfd(evcon->bufev, fd))
- goto err;
- if (bufferevent_enable(evcon->bufev, EV_READ))
- goto err;
- if (bufferevent_disable(evcon->bufev, EV_WRITE))
- goto err;
- bufferevent_socket_set_conn_address_(evcon->bufev, sa, salen);
+ if (bufferevent_setfd(evcon->bufev, fd))
+ goto err;
+ if (bufferevent_enable(evcon->bufev, EV_READ))
+ goto err;
+ if (bufferevent_disable(evcon->bufev, EV_WRITE))
+ goto err;
+ bufferevent_socket_set_conn_address_(evcon->bufev, sa, salen);
return (evcon);
-
-err:
- evhttp_connection_free(evcon);
- return (NULL);
+
+err:
+ evhttp_connection_free(evcon);
+ return (NULL);
}
static int
@@ -4390,7 +4390,7 @@ evhttp_associate_new_request_with_connection(struct evhttp_connection *evcon)
req->kind = EVHTTP_REQUEST;
- evhttp_start_read_(evcon);
+ evhttp_start_read_(evcon);
return (0);
}
@@ -4410,8 +4410,8 @@ evhttp_get_request(struct evhttp *http, evutil_socket_t fd,
}
/* the timeout can be used by the server to close idle connections */
- if (evutil_timerisset(&http->timeout))
- evhttp_connection_set_timeout_tv(evcon, &http->timeout);
+ if (evutil_timerisset(&http->timeout))
+ evhttp_connection_set_timeout_tv(evcon, &http->timeout);
/*
* if we want to accept more than one request on a connection,
@@ -4438,7 +4438,7 @@ name_from_addr(struct sockaddr *sa, ev_socklen_t salen,
char strport[NI_MAXSERV];
int ni_result;
-#ifdef EVENT__HAVE_GETNAMEINFO
+#ifdef EVENT__HAVE_GETNAMEINFO
ni_result = getnameinfo(sa, salen,
ntop, sizeof(ntop), strport, sizeof(strport),
NI_NUMERICHOST|NI_NUMERICSERV);
@@ -4475,15 +4475,15 @@ create_bind_socket_nonblock(struct evutil_addrinfo *ai, int reuse)
int serrno;
/* Create listen socket */
- fd = evutil_socket_(ai ? ai->ai_family : AF_INET,
- SOCK_STREAM|EVUTIL_SOCK_NONBLOCK|EVUTIL_SOCK_CLOEXEC, 0);
+ fd = evutil_socket_(ai ? ai->ai_family : AF_INET,
+ SOCK_STREAM|EVUTIL_SOCK_NONBLOCK|EVUTIL_SOCK_CLOEXEC, 0);
if (fd == -1) {
event_sock_warn(-1, "socket");
return (-1);
}
#if defined IPV6_V6ONLY
- int v6opt = 1;
+ int v6opt = 1;
if (ai->ai_family == AF_INET6 && setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &v6opt, sizeof(v6opt)) < 0)
goto out;
#endif
@@ -4620,10 +4620,10 @@ scheme_ok(const char *s, const char *eos)
EVUTIL_ASSERT(eos >= s);
if (s == eos)
return 0;
- if (!EVUTIL_ISALPHA_(*s))
+ if (!EVUTIL_ISALPHA_(*s))
return 0;
while (++s < eos) {
- if (! EVUTIL_ISALNUM_(*s) &&
+ if (! EVUTIL_ISALNUM_(*s) &&
*s != '+' && *s != '-' && *s != '.')
return 0;
}
@@ -4642,8 +4642,8 @@ userinfo_ok(const char *s, const char *eos)
*s == ':')
++s;
else if (*s == '%' && s+2 < eos &&
- EVUTIL_ISXDIGIT_(s[1]) &&
- EVUTIL_ISXDIGIT_(s[2]))
+ EVUTIL_ISXDIGIT_(s[1]) &&
+ EVUTIL_ISXDIGIT_(s[2]))
s += 3;
else
return 0;
@@ -4659,8 +4659,8 @@ regname_ok(const char *s, const char *eos)
strchr(SUBDELIMS, *s))
++s;
else if (*s == '%' &&
- EVUTIL_ISXDIGIT_(s[1]) &&
- EVUTIL_ISXDIGIT_(s[2]))
+ EVUTIL_ISXDIGIT_(s[1]) &&
+ EVUTIL_ISXDIGIT_(s[2]))
s += 3;
else
return 0;
@@ -4673,13 +4673,13 @@ parse_port(const char *s, const char *eos)
{
int portnum = 0;
while (s < eos) {
- if (! EVUTIL_ISDIGIT_(*s))
+ if (! EVUTIL_ISDIGIT_(*s))
return -1;
portnum = (portnum * 10) + (*s - '0');
if (portnum < 0)
return -1;
- if (portnum > 65535)
- return -1;
+ if (portnum > 65535)
+ return -1;
++s;
}
return portnum;
@@ -4697,10 +4697,10 @@ bracket_addr_ok(const char *s, const char *eos)
*/
s += 2; /* skip [v */
--eos;
- if (!EVUTIL_ISXDIGIT_(*s)) /*require at least one*/
+ if (!EVUTIL_ISXDIGIT_(*s)) /*require at least one*/
return 0;
while (s < eos && *s != '.') {
- if (EVUTIL_ISXDIGIT_(*s))
+ if (EVUTIL_ISXDIGIT_(*s))
++s;
else
return 0;
@@ -4760,7 +4760,7 @@ parse_authority(struct evhttp_uri *uri, char *s, char *eos)
cp = s;
}
/* Optionally, we end with ":port" */
- for (port=eos-1; port >= cp && EVUTIL_ISDIGIT_(*port); --port)
+ for (port=eos-1; port >= cp && EVUTIL_ISDIGIT_(*port); --port)
;
if (port >= cp && *port == ':') {
if (port+1 == eos) /* Leave port unspecified; the RFC allows a
@@ -4844,8 +4844,8 @@ end_of_path(char *cp, enum uri_part part, unsigned flags)
strchr(SUBDELIMS, *cp) ||
*cp == ':' || *cp == '@' || *cp == '/')
++cp;
- else if (*cp == '%' && EVUTIL_ISXDIGIT_(cp[1]) &&
- EVUTIL_ISXDIGIT_(cp[2]))
+ else if (*cp == '%' && EVUTIL_ISXDIGIT_(cp[1]) &&
+ EVUTIL_ISXDIGIT_(cp[2]))
cp += 3;
else if (*cp == '?' && part != PART_PATH)
++cp;
@@ -5002,53 +5002,53 @@ err:
return NULL;
}
-static struct evhttp_uri *
-evhttp_uri_parse_authority(char *source_uri)
-{
- struct evhttp_uri *uri = mm_calloc(1, sizeof(struct evhttp_uri));
- char *end;
-
- if (uri == NULL) {
- event_warn("%s: calloc", __func__);
- goto err;
- }
- uri->port = -1;
- uri->flags = 0;
-
- end = end_of_authority(source_uri);
- if (parse_authority(uri, source_uri, end) < 0)
- goto err;
-
- uri->path = mm_strdup("");
- if (uri->path == NULL) {
- event_warn("%s: strdup", __func__);
- goto err;
- }
-
- return uri;
-err:
- if (uri)
- evhttp_uri_free(uri);
- return NULL;
-}
-
+static struct evhttp_uri *
+evhttp_uri_parse_authority(char *source_uri)
+{
+ struct evhttp_uri *uri = mm_calloc(1, sizeof(struct evhttp_uri));
+ char *end;
+
+ if (uri == NULL) {
+ event_warn("%s: calloc", __func__);
+ goto err;
+ }
+ uri->port = -1;
+ uri->flags = 0;
+
+ end = end_of_authority(source_uri);
+ if (parse_authority(uri, source_uri, end) < 0)
+ goto err;
+
+ uri->path = mm_strdup("");
+ if (uri->path == NULL) {
+ event_warn("%s: strdup", __func__);
+ goto err;
+ }
+
+ return uri;
+err:
+ if (uri)
+ evhttp_uri_free(uri);
+ return NULL;
+}
+
void
evhttp_uri_free(struct evhttp_uri *uri)
{
-#define URI_FREE_STR_(f) \
+#define URI_FREE_STR_(f) \
if (uri->f) { \
mm_free(uri->f); \
}
- URI_FREE_STR_(scheme);
- URI_FREE_STR_(userinfo);
- URI_FREE_STR_(host);
- URI_FREE_STR_(path);
- URI_FREE_STR_(query);
- URI_FREE_STR_(fragment);
+ URI_FREE_STR_(scheme);
+ URI_FREE_STR_(userinfo);
+ URI_FREE_STR_(host);
+ URI_FREE_STR_(path);
+ URI_FREE_STR_(query);
+ URI_FREE_STR_(fragment);
mm_free(uri);
-#undef URI_FREE_STR_
+#undef URI_FREE_STR_
}
char *
@@ -5058,7 +5058,7 @@ evhttp_uri_join(struct evhttp_uri *uri, char *buf, size_t limit)
size_t joined_size = 0;
char *output = NULL;
-#define URI_ADD_(f) evbuffer_add(tmp, uri->f, strlen(uri->f))
+#define URI_ADD_(f) evbuffer_add(tmp, uri->f, strlen(uri->f))
if (!uri || !buf || !limit)
return NULL;
@@ -5068,14 +5068,14 @@ evhttp_uri_join(struct evhttp_uri *uri, char *buf, size_t limit)
return NULL;
if (uri->scheme) {
- URI_ADD_(scheme);
+ URI_ADD_(scheme);
evbuffer_add(tmp, ":", 1);
}
if (uri->host) {
evbuffer_add(tmp, "//", 2);
if (uri->userinfo)
evbuffer_add_printf(tmp,"%s@", uri->userinfo);
- URI_ADD_(host);
+ URI_ADD_(host);
if (uri->port >= 0)
evbuffer_add_printf(tmp,":%d", uri->port);
@@ -5084,16 +5084,16 @@ evhttp_uri_join(struct evhttp_uri *uri, char *buf, size_t limit)
}
if (uri->path)
- URI_ADD_(path);
+ URI_ADD_(path);
if (uri->query) {
evbuffer_add(tmp, "?", 1);
- URI_ADD_(query);
+ URI_ADD_(query);
}
if (uri->fragment) {
evbuffer_add(tmp, "#", 1);
- URI_ADD_(fragment);
+ URI_ADD_(fragment);
}
evbuffer_add(tmp, "\0", 1); /* NUL */
@@ -5112,7 +5112,7 @@ err:
evbuffer_free(tmp);
return output;
-#undef URI_ADD_
+#undef URI_ADD_
}
const char *
@@ -5151,7 +5151,7 @@ evhttp_uri_get_fragment(const struct evhttp_uri *uri)
return uri->fragment;
}
-#define URI_SET_STR_(f) do { \
+#define URI_SET_STR_(f) do { \
if (uri->f) \
mm_free(uri->f); \
if (f) { \
@@ -5170,7 +5170,7 @@ evhttp_uri_set_scheme(struct evhttp_uri *uri, const char *scheme)
if (scheme && !scheme_ok(scheme, scheme+strlen(scheme)))
return -1;
- URI_SET_STR_(scheme);
+ URI_SET_STR_(scheme);
return 0;
}
int
@@ -5178,7 +5178,7 @@ evhttp_uri_set_userinfo(struct evhttp_uri *uri, const char *userinfo)
{
if (userinfo && !userinfo_ok(userinfo, userinfo+strlen(userinfo)))
return -1;
- URI_SET_STR_(userinfo);
+ URI_SET_STR_(userinfo);
return 0;
}
int
@@ -5194,7 +5194,7 @@ evhttp_uri_set_host(struct evhttp_uri *uri, const char *host)
}
}
- URI_SET_STR_(host);
+ URI_SET_STR_(host);
return 0;
}
int
@@ -5214,7 +5214,7 @@ evhttp_uri_set_path(struct evhttp_uri *uri, const char *path)
if (path && end_of_cpath(path, PART_PATH, uri->flags) != path+strlen(path))
return -1;
- URI_SET_STR_(path);
+ URI_SET_STR_(path);
return 0;
}
int
@@ -5222,7 +5222,7 @@ evhttp_uri_set_query(struct evhttp_uri *uri, const char *query)
{
if (query && end_of_cpath(query, PART_QUERY, uri->flags) != query+strlen(query))
return -1;
- URI_SET_STR_(query);
+ URI_SET_STR_(query);
return 0;
}
int
@@ -5230,6 +5230,6 @@ evhttp_uri_set_fragment(struct evhttp_uri *uri, const char *fragment)
{
if (fragment && end_of_cpath(fragment, PART_FRAGMENT, uri->flags) != fragment+strlen(fragment))
return -1;
- URI_SET_STR_(fragment);
+ URI_SET_STR_(fragment);
return 0;
}
diff --git a/contrib/libs/libevent/include/evdns.h b/contrib/libs/libevent/include/evdns.h
index 8672db0369..45c36c8cb3 100644
--- a/contrib/libs/libevent/include/evdns.h
+++ b/contrib/libs/libevent/include/evdns.h
@@ -1,45 +1,45 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT1_EVDNS_H_INCLUDED_
-#define EVENT1_EVDNS_H_INCLUDED_
-
-/** @file evdns.h
-
- A dns subsystem for Libevent.
-
- The <evdns.h> header is deprecated in Libevent 2.0 and later; please
- use <event2/evdns.h> instead. Depending on what functionality you
- need, you may also want to include more of the other <event2/...>
- headers.
- */
-
-#include <event.h>
-#include <event2/dns.h>
-#include <event2/dns_compat.h>
-#include <event2/dns_struct.h>
-
-#endif /* EVENT1_EVDNS_H_INCLUDED_ */
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef EVENT1_EVDNS_H_INCLUDED_
+#define EVENT1_EVDNS_H_INCLUDED_
+
+/** @file evdns.h
+
+ A dns subsystem for Libevent.
+
+ The <evdns.h> header is deprecated in Libevent 2.0 and later; please
+ use <event2/evdns.h> instead. Depending on what functionality you
+ need, you may also want to include more of the other <event2/...>
+ headers.
+ */
+
+#include <event.h>
+#include <event2/dns.h>
+#include <event2/dns_compat.h>
+#include <event2/dns_struct.h>
+
+#endif /* EVENT1_EVDNS_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event.h b/contrib/libs/libevent/include/event.h
index ba5186713b..dcf8af7a16 100644
--- a/contrib/libs/libevent/include/event.h
+++ b/contrib/libs/libevent/include/event.h
@@ -1,83 +1,83 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT1_EVENT_H_INCLUDED_
-#define EVENT1_EVENT_H_INCLUDED_
-
-/** @file event.h
-
- A library for writing event-driven network servers.
-
- The <event.h> header is deprecated in Libevent 2.0 and later; please
- use <event2/event.h> instead. Depending on what functionality you
- need, you may also want to include more of the other event2/
- headers.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <event2/event-config.h>
-#ifdef EVENT__HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef EVENT__HAVE_STDINT_H
-#include <stdint.h>
-#endif
-#include <stdarg.h>
-
-/* For int types. */
-#include <evutil.h>
-
-#ifdef _WIN32
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include <winsock2.h>
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-#endif
-
-#include <event2/event_struct.h>
-#include <event2/event.h>
-#include <event2/event_compat.h>
-#include <event2/buffer.h>
-#include <event2/buffer_compat.h>
-#include <event2/bufferevent.h>
-#include <event2/bufferevent_struct.h>
-#include <event2/bufferevent_compat.h>
-#include <event2/tag.h>
-#include <event2/tag_compat.h>
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT1_EVENT_H_INCLUDED_ */
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef EVENT1_EVENT_H_INCLUDED_
+#define EVENT1_EVENT_H_INCLUDED_
+
+/** @file event.h
+
+ A library for writing event-driven network servers.
+
+ The <event.h> header is deprecated in Libevent 2.0 and later; please
+ use <event2/event.h> instead. Depending on what functionality you
+ need, you may also want to include more of the other event2/
+ headers.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+#ifdef EVENT__HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef EVENT__HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef EVENT__HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <stdarg.h>
+
+/* For int types. */
+#include <evutil.h>
+
+#ifdef _WIN32
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <winsock2.h>
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+#endif
+
+#include <event2/event_struct.h>
+#include <event2/event.h>
+#include <event2/event_compat.h>
+#include <event2/buffer.h>
+#include <event2/buffer_compat.h>
+#include <event2/bufferevent.h>
+#include <event2/bufferevent_struct.h>
+#include <event2/bufferevent_compat.h>
+#include <event2/tag.h>
+#include <event2/tag_compat.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* EVENT1_EVENT_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/buffer.h b/contrib/libs/libevent/include/event2/buffer.h
index 88af3ae141..fb776f5480 100644
--- a/contrib/libs/libevent/include/event2/buffer.h
+++ b/contrib/libs/libevent/include/event2/buffer.h
@@ -23,8 +23,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_BUFFER_H_INCLUDED_
-#define EVENT2_BUFFER_H_INCLUDED_
+#ifndef EVENT2_BUFFER_H_INCLUDED_
+#define EVENT2_BUFFER_H_INCLUDED_
/** @file event2/buffer.h
@@ -72,18 +72,18 @@
evbuffer_peek() if you don't require that the memory to be contiguous.
*/
-#include <event2/visibility.h>
-
+#include <event2/visibility.h>
+
#ifdef __cplusplus
extern "C" {
#endif
#include <event2/event-config.h>
#include <stdarg.h>
-#ifdef EVENT__HAVE_SYS_TYPES_H
+#ifdef EVENT__HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef EVENT__HAVE_SYS_UIO_H
+#ifdef EVENT__HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#include <event2/util.h>
@@ -95,7 +95,7 @@ extern "C" {
@see event2/event.h for more information
*/
struct evbuffer
-#ifdef EVENT_IN_DOXYGEN_
+#ifdef EVENT_IN_DOXYGEN_
{}
#endif
;
@@ -105,23 +105,23 @@ struct evbuffer
Used when repeatedly searching through a buffer. Calling any function
that modifies or re-packs the buffer contents may invalidate all
- evbuffer_ptrs for that buffer. Do not modify or contruct these values
- except with evbuffer_ptr_set.
-
- An evbuffer_ptr can represent any position from the start of a buffer up
- to a position immediately after the end of a buffer.
-
- @see evbuffer_ptr_set()
+ evbuffer_ptrs for that buffer. Do not modify or contruct these values
+ except with evbuffer_ptr_set.
+
+ An evbuffer_ptr can represent any position from the start of a buffer up
+ to a position immediately after the end of a buffer.
+
+ @see evbuffer_ptr_set()
*/
struct evbuffer_ptr {
ev_ssize_t pos;
- /* Do not alter or rely on the values of fields: they are for internal
- * use */
+ /* Do not alter or rely on the values of fields: they are for internal
+ * use */
struct {
void *chain;
size_t pos_in_chain;
- } internal_;
+ } internal_;
};
/** Describes a single extent of memory inside an evbuffer. Used for
@@ -129,10 +129,10 @@ struct evbuffer_ptr {
@see evbuffer_reserve_space, evbuffer_commit_space, evbuffer_peek
*/
-#ifdef EVENT__HAVE_SYS_UIO_H
+#ifdef EVENT__HAVE_SYS_UIO_H
#define evbuffer_iovec iovec
/* Internal use -- defined only if we are using the native struct iovec */
-#define EVBUFFER_IOVEC_IS_NATIVE_
+#define EVBUFFER_IOVEC_IS_NATIVE_
#else
struct evbuffer_iovec {
/** The start of the extent of memory. */
@@ -148,14 +148,14 @@ struct evbuffer_iovec {
@return a pointer to a newly allocated evbuffer struct, or NULL if an error
occurred
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evbuffer *evbuffer_new(void);
/**
Deallocate storage for an evbuffer.
@param buf pointer to the evbuffer to be freed
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evbuffer_free(struct evbuffer *buf);
/**
@@ -170,21 +170,21 @@ void evbuffer_free(struct evbuffer *buf);
@param lock A lock object, or NULL if we should allocate our own.
@return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_enable_locking(struct evbuffer *buf, void *lock);
/**
Acquire the lock on an evbuffer. Has no effect if locking was not enabled
with evbuffer_enable_locking.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evbuffer_lock(struct evbuffer *buf);
/**
Release the lock on an evbuffer. Has no effect if locking was not enabled
with evbuffer_enable_locking.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evbuffer_unlock(struct evbuffer *buf);
@@ -212,7 +212,7 @@ void evbuffer_unlock(struct evbuffer *buf);
* @param flags One or more EVBUFFER_FLAG_* options
* @return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_set_flags(struct evbuffer *buf, ev_uint64_t flags);
/** Change the flags that are set for an evbuffer by removing some.
*
@@ -221,7 +221,7 @@ int evbuffer_set_flags(struct evbuffer *buf, ev_uint64_t flags);
* @param flags One or more EVBUFFER_FLAG_* options
* @return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_clear_flags(struct evbuffer *buf, ev_uint64_t flags);
/**
@@ -230,7 +230,7 @@ int evbuffer_clear_flags(struct evbuffer *buf, ev_uint64_t flags);
@param buf pointer to the evbuffer
@return the number of bytes stored in the evbuffer
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
size_t evbuffer_get_length(const struct evbuffer *buf);
/**
@@ -245,7 +245,7 @@ size_t evbuffer_get_length(const struct evbuffer *buf);
@return 0 if no data is available, otherwise the number of available bytes
in the first buffer chain.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
size_t evbuffer_get_contiguous_space(const struct evbuffer *buf);
/**
@@ -258,7 +258,7 @@ size_t evbuffer_get_contiguous_space(const struct evbuffer *buf);
@param datlen the new minimum length requirement
@return 0 if successful, or -1 if an error occurred
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_expand(struct evbuffer *buf, size_t datlen);
/**
@@ -294,7 +294,7 @@ int evbuffer_expand(struct evbuffer *buf, size_t datlen);
@return the number of provided extents, or -1 on error.
@see evbuffer_commit_space()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int
evbuffer_reserve_space(struct evbuffer *buf, ev_ssize_t size,
struct evbuffer_iovec *vec, int n_vec);
@@ -320,7 +320,7 @@ evbuffer_reserve_space(struct evbuffer *buf, ev_ssize_t size,
@return 0 on success, -1 on error
@see evbuffer_reserve_space()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_commit_space(struct evbuffer *buf,
struct evbuffer_iovec *vec, int n_vecs);
@@ -332,7 +332,7 @@ int evbuffer_commit_space(struct evbuffer *buf,
@param datlen the number of bytes to be copied from the data buffer
@return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_add(struct evbuffer *buf, const void *data, size_t datlen);
@@ -347,7 +347,7 @@ int evbuffer_add(struct evbuffer *buf, const void *data, size_t datlen);
@param datlen the maximum size of the destination buffer
@return the number of bytes read, or -1 if we can't drain the buffer.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_remove(struct evbuffer *buf, void *data, size_t datlen);
/**
@@ -361,25 +361,25 @@ int evbuffer_remove(struct evbuffer *buf, void *data, size_t datlen);
@param datlen the maximum size of the destination buffer
@return the number of bytes read, or -1 if we can't drain the buffer.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
ev_ssize_t evbuffer_copyout(struct evbuffer *buf, void *data_out, size_t datlen);
/**
- Read data from the middle of an evbuffer, and leave the buffer unchanged.
-
- If more bytes are requested than are available in the evbuffer, we
- only extract as many bytes as were available.
-
- @param buf the evbuffer to be read from
- @param pos the position to start reading from
- @param data_out the destination buffer to store the result
- @param datlen the maximum size of the destination buffer
- @return the number of bytes read, or -1 if we can't drain the buffer.
- */
-EVENT2_EXPORT_SYMBOL
-ev_ssize_t evbuffer_copyout_from(struct evbuffer *buf, const struct evbuffer_ptr *pos, void *data_out, size_t datlen);
-
-/**
+ Read data from the middle of an evbuffer, and leave the buffer unchanged.
+
+ If more bytes are requested than are available in the evbuffer, we
+ only extract as many bytes as were available.
+
+ @param buf the evbuffer to be read from
+ @param pos the position to start reading from
+ @param data_out the destination buffer to store the result
+ @param datlen the maximum size of the destination buffer
+ @return the number of bytes read, or -1 if we can't drain the buffer.
+ */
+EVENT2_EXPORT_SYMBOL
+ev_ssize_t evbuffer_copyout_from(struct evbuffer *buf, const struct evbuffer_ptr *pos, void *data_out, size_t datlen);
+
+/**
Read data from an evbuffer into another evbuffer, draining
the bytes from the source buffer. This function avoids copy
operations to the extent possible.
@@ -392,7 +392,7 @@ ev_ssize_t evbuffer_copyout_from(struct evbuffer *buf, const struct evbuffer_ptr
@param datlen the maximum numbers of bytes to transfer
@return the number of bytes read
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_remove_buffer(struct evbuffer *src, struct evbuffer *dst,
size_t datlen);
@@ -415,9 +415,9 @@ enum evbuffer_eol_style {
/** An EOL is a CR followed by an LF. */
EVBUFFER_EOL_CRLF_STRICT,
/** An EOL is a LF. */
- EVBUFFER_EOL_LF,
- /** An EOL is a NUL character (that is, a single byte with value 0) */
- EVBUFFER_EOL_NUL
+ EVBUFFER_EOL_LF,
+ /** An EOL is a NUL character (that is, a single byte with value 0) */
+ EVBUFFER_EOL_NUL
};
/**
@@ -434,7 +434,7 @@ enum evbuffer_eol_style {
* @param eol_style the style of line-ending to use.
* @return pointer to a single line, or NULL if an error occurred
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
char *evbuffer_readln(struct evbuffer *buffer, size_t *n_read_out,
enum evbuffer_eol_style eol_style);
@@ -450,27 +450,27 @@ char *evbuffer_readln(struct evbuffer *buffer, size_t *n_read_out,
@see evbuffer_remove_buffer()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_add_buffer(struct evbuffer *outbuf, struct evbuffer *inbuf);
/**
- Copy data from one evbuffer into another evbuffer.
-
- This is a non-destructive add. The data from one buffer is copied
- into the other buffer. However, no unnecessary memory copies occur.
-
- Note that buffers already containing buffer references can't be added
- to other buffers.
-
- @param outbuf the output buffer
- @param inbuf the input buffer
- @return 0 if successful, or -1 if an error occurred
- */
-EVENT2_EXPORT_SYMBOL
-int evbuffer_add_buffer_reference(struct evbuffer *outbuf,
- struct evbuffer *inbuf);
-
-/**
+ Copy data from one evbuffer into another evbuffer.
+
+ This is a non-destructive add. The data from one buffer is copied
+ into the other buffer. However, no unnecessary memory copies occur.
+
+ Note that buffers already containing buffer references can't be added
+ to other buffers.
+
+ @param outbuf the output buffer
+ @param inbuf the input buffer
+ @return 0 if successful, or -1 if an error occurred
+ */
+EVENT2_EXPORT_SYMBOL
+int evbuffer_add_buffer_reference(struct evbuffer *outbuf,
+ struct evbuffer *inbuf);
+
+/**
A cleanup function for a piece of memory added to an evbuffer by
reference.
@@ -494,7 +494,7 @@ typedef void (*evbuffer_ref_cleanup_cb)(const void *data,
@param cleanupfn_arg optional argument to the cleanup callback
@return 0 if successful, or -1 if an error occurred
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_add_reference(struct evbuffer *outbuf,
const void *data, size_t datlen,
evbuffer_ref_cleanup_cb cleanupfn, void *cleanupfn_arg);
@@ -513,140 +513,140 @@ int evbuffer_add_reference(struct evbuffer *outbuf,
The results of using evbuffer_remove() or evbuffer_pullup() on
evbuffers whose data was added using this function are undefined.
- For more fine-grained control, use evbuffer_add_file_segment.
-
+ For more fine-grained control, use evbuffer_add_file_segment.
+
@param outbuf the output buffer
@param fd the file descriptor
@param offset the offset from which to read data
- @param length how much data to read, or -1 to read as much as possible.
- (-1 requires that 'fd' support fstat.)
+ @param length how much data to read, or -1 to read as much as possible.
+ (-1 requires that 'fd' support fstat.)
@return 0 if successful, or -1 if an error occurred
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_add_file(struct evbuffer *outbuf, int fd, ev_off_t offset,
ev_off_t length);
/**
- An evbuffer_file_segment holds a reference to a range of a file --
- possibly the whole file! -- for use in writing from an evbuffer to a
- socket. It could be implemented with mmap, sendfile, splice, or (if all
- else fails) by just pulling all the data into RAM. A single
- evbuffer_file_segment can be added more than once, and to more than one
- evbuffer.
- */
-struct evbuffer_file_segment;
-
-/**
- Flag for creating evbuffer_file_segment: If this flag is set, then when
- the evbuffer_file_segment is freed and no longer in use by any
- evbuffer, the underlying fd is closed.
- */
-#define EVBUF_FS_CLOSE_ON_FREE 0x01
-/**
- Flag for creating evbuffer_file_segment: Disable memory-map based
- implementations.
- */
-#define EVBUF_FS_DISABLE_MMAP 0x02
-/**
- Flag for creating evbuffer_file_segment: Disable direct fd-to-fd
- implementations (including sendfile and splice).
-
- You might want to use this option if data needs to be taken from the
- evbuffer by any means other than writing it to the network: the sendfile
- backend is fast, but it only works for sending files directly to the
- network.
- */
-#define EVBUF_FS_DISABLE_SENDFILE 0x04
-/**
- Flag for creating evbuffer_file_segment: Do not allocate a lock for this
- segment. If this option is set, then neither the segment nor any
- evbuffer it is added to may ever be accessed from more than one thread
- at a time.
- */
-#define EVBUF_FS_DISABLE_LOCKING 0x08
-
-/**
- A cleanup function for a evbuffer_file_segment added to an evbuffer
- for reference.
- */
-typedef void (*evbuffer_file_segment_cleanup_cb)(
- struct evbuffer_file_segment const* seg, int flags, void* arg);
-
-/**
- Create and return a new evbuffer_file_segment for reading data from a
- file and sending it out via an evbuffer.
-
- This function avoids unnecessary data copies between userland and
- kernel. Where available, it uses sendfile or splice.
-
- The file descriptor must not be closed so long as any evbuffer is using
- this segment.
-
- The results of using evbuffer_remove() or evbuffer_pullup() or any other
- function that reads bytes from an evbuffer on any evbuffer containing
- the newly returned segment are undefined, unless you pass the
- EVBUF_FS_DISABLE_SENDFILE flag to this function.
-
- @param fd an open file to read from.
- @param offset an index within the file at which to start reading
- @param length how much data to read, or -1 to read as much as possible.
- (-1 requires that 'fd' support fstat.)
- @param flags any number of the EVBUF_FS_* flags
- @return a new evbuffer_file_segment, or NULL on failure.
- **/
-EVENT2_EXPORT_SYMBOL
-struct evbuffer_file_segment *evbuffer_file_segment_new(
- int fd, ev_off_t offset, ev_off_t length, unsigned flags);
-
-/**
- Free an evbuffer_file_segment
-
- It is safe to call this function even if the segment has been added to
- one or more evbuffers. The evbuffer_file_segment will not be freed
- until no more references to it exist.
- */
-EVENT2_EXPORT_SYMBOL
-void evbuffer_file_segment_free(struct evbuffer_file_segment *seg);
-
-/**
- Add cleanup callback and argument for the callback to an
- evbuffer_file_segment.
-
- The cleanup callback will be invoked when no more references to the
- evbuffer_file_segment exist.
- **/
-EVENT2_EXPORT_SYMBOL
-void evbuffer_file_segment_add_cleanup_cb(struct evbuffer_file_segment *seg,
- evbuffer_file_segment_cleanup_cb cb, void* arg);
-
-/**
- Insert some or all of an evbuffer_file_segment at the end of an evbuffer
-
- Note that the offset and length parameters of this function have a
- different meaning from those provided to evbuffer_file_segment_new: When
- you create the segment, the offset is the offset _within the file_, and
- the length is the length _of the segment_, whereas when you add a
- segment to an evbuffer, the offset is _within the segment_ and the
- length is the length of the _part of the segment you want to use.
-
- In other words, if you have a 10 KiB file, and you create an
- evbuffer_file_segment for it with offset 20 and length 1000, it will
- refer to bytes 20..1019 inclusive. If you then pass this segment to
- evbuffer_add_file_segment and specify an offset of 20 and a length of
- 50, you will be adding bytes 40..99 inclusive.
-
- @param buf the evbuffer to append to
- @param seg the segment to add
- @param offset the offset within the segment to start from
- @param length the amount of data to add, or -1 to add it all.
- @return 0 on success, -1 on failure.
- */
-EVENT2_EXPORT_SYMBOL
-int evbuffer_add_file_segment(struct evbuffer *buf,
- struct evbuffer_file_segment *seg, ev_off_t offset, ev_off_t length);
-
-/**
+ An evbuffer_file_segment holds a reference to a range of a file --
+ possibly the whole file! -- for use in writing from an evbuffer to a
+ socket. It could be implemented with mmap, sendfile, splice, or (if all
+ else fails) by just pulling all the data into RAM. A single
+ evbuffer_file_segment can be added more than once, and to more than one
+ evbuffer.
+ */
+struct evbuffer_file_segment;
+
+/**
+ Flag for creating evbuffer_file_segment: If this flag is set, then when
+ the evbuffer_file_segment is freed and no longer in use by any
+ evbuffer, the underlying fd is closed.
+ */
+#define EVBUF_FS_CLOSE_ON_FREE 0x01
+/**
+ Flag for creating evbuffer_file_segment: Disable memory-map based
+ implementations.
+ */
+#define EVBUF_FS_DISABLE_MMAP 0x02
+/**
+ Flag for creating evbuffer_file_segment: Disable direct fd-to-fd
+ implementations (including sendfile and splice).
+
+ You might want to use this option if data needs to be taken from the
+ evbuffer by any means other than writing it to the network: the sendfile
+ backend is fast, but it only works for sending files directly to the
+ network.
+ */
+#define EVBUF_FS_DISABLE_SENDFILE 0x04
+/**
+ Flag for creating evbuffer_file_segment: Do not allocate a lock for this
+ segment. If this option is set, then neither the segment nor any
+ evbuffer it is added to may ever be accessed from more than one thread
+ at a time.
+ */
+#define EVBUF_FS_DISABLE_LOCKING 0x08
+
+/**
+ A cleanup function for a evbuffer_file_segment added to an evbuffer
+ for reference.
+ */
+typedef void (*evbuffer_file_segment_cleanup_cb)(
+ struct evbuffer_file_segment const* seg, int flags, void* arg);
+
+/**
+ Create and return a new evbuffer_file_segment for reading data from a
+ file and sending it out via an evbuffer.
+
+ This function avoids unnecessary data copies between userland and
+ kernel. Where available, it uses sendfile or splice.
+
+ The file descriptor must not be closed so long as any evbuffer is using
+ this segment.
+
+ The results of using evbuffer_remove() or evbuffer_pullup() or any other
+ function that reads bytes from an evbuffer on any evbuffer containing
+ the newly returned segment are undefined, unless you pass the
+ EVBUF_FS_DISABLE_SENDFILE flag to this function.
+
+ @param fd an open file to read from.
+ @param offset an index within the file at which to start reading
+ @param length how much data to read, or -1 to read as much as possible.
+ (-1 requires that 'fd' support fstat.)
+ @param flags any number of the EVBUF_FS_* flags
+ @return a new evbuffer_file_segment, or NULL on failure.
+ **/
+EVENT2_EXPORT_SYMBOL
+struct evbuffer_file_segment *evbuffer_file_segment_new(
+ int fd, ev_off_t offset, ev_off_t length, unsigned flags);
+
+/**
+ Free an evbuffer_file_segment
+
+ It is safe to call this function even if the segment has been added to
+ one or more evbuffers. The evbuffer_file_segment will not be freed
+ until no more references to it exist.
+ */
+EVENT2_EXPORT_SYMBOL
+void evbuffer_file_segment_free(struct evbuffer_file_segment *seg);
+
+/**
+ Add cleanup callback and argument for the callback to an
+ evbuffer_file_segment.
+
+ The cleanup callback will be invoked when no more references to the
+ evbuffer_file_segment exist.
+ **/
+EVENT2_EXPORT_SYMBOL
+void evbuffer_file_segment_add_cleanup_cb(struct evbuffer_file_segment *seg,
+ evbuffer_file_segment_cleanup_cb cb, void* arg);
+
+/**
+ Insert some or all of an evbuffer_file_segment at the end of an evbuffer
+
+ Note that the offset and length parameters of this function have a
+ different meaning from those provided to evbuffer_file_segment_new: When
+ you create the segment, the offset is the offset _within the file_, and
+ the length is the length _of the segment_, whereas when you add a
+ segment to an evbuffer, the offset is _within the segment_ and the
+ length is the length of the _part of the segment you want to use.
+
+ In other words, if you have a 10 KiB file, and you create an
+ evbuffer_file_segment for it with offset 20 and length 1000, it will
+ refer to bytes 20..1019 inclusive. If you then pass this segment to
+ evbuffer_add_file_segment and specify an offset of 20 and a length of
+ 50, you will be adding bytes 40..99 inclusive.
+
+ @param buf the evbuffer to append to
+ @param seg the segment to add
+ @param offset the offset within the segment to start from
+ @param length the amount of data to add, or -1 to add it all.
+ @return 0 on success, -1 on failure.
+ */
+EVENT2_EXPORT_SYMBOL
+int evbuffer_add_file_segment(struct evbuffer *buf,
+ struct evbuffer_file_segment *seg, ev_off_t offset, ev_off_t length);
+
+/**
Append a formatted string to the end of an evbuffer.
The string is formated as printf.
@@ -658,7 +658,7 @@ int evbuffer_add_file_segment(struct evbuffer *buf,
@see evutil_printf(), evbuffer_add_vprintf()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_add_printf(struct evbuffer *buf, const char *fmt, ...)
#ifdef __GNUC__
__attribute__((format(printf, 2, 3)))
@@ -673,7 +673,7 @@ int evbuffer_add_printf(struct evbuffer *buf, const char *fmt, ...)
@param ap a varargs va_list argument array that will be passed to vprintf(3)
@return The number of bytes added if successful, or -1 if an error occurred.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_add_vprintf(struct evbuffer *buf, const char *fmt, va_list ap)
#ifdef __GNUC__
__attribute__((format(printf, 2, 0)))
@@ -688,7 +688,7 @@ int evbuffer_add_vprintf(struct evbuffer *buf, const char *fmt, va_list ap)
@param len the number of bytes to drain from the beginning of the buffer
@return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_drain(struct evbuffer *buf, size_t len);
@@ -702,7 +702,7 @@ int evbuffer_drain(struct evbuffer *buf, size_t len);
@return the number of bytes written, or -1 if an error occurred
@see evbuffer_read()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_write(struct evbuffer *buffer, evutil_socket_t fd);
/**
@@ -717,7 +717,7 @@ int evbuffer_write(struct evbuffer *buffer, evutil_socket_t fd);
@return the number of bytes written, or -1 if an error occurred
@see evbuffer_read()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd,
ev_ssize_t howmuch);
@@ -731,7 +731,7 @@ int evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd,
@return the number of bytes read, or -1 if an error occurred
@see evbuffer_write()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_read(struct evbuffer *buffer, evutil_socket_t fd, int howmuch);
/**
@@ -745,7 +745,7 @@ int evbuffer_read(struct evbuffer *buffer, evutil_socket_t fd, int howmuch);
first occurrence of the string in the buffer after 'start'. The 'pos'
field of the result is -1 if the string was not found.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evbuffer_ptr evbuffer_search(struct evbuffer *buffer, const char *what, size_t len, const struct evbuffer_ptr *start);
/**
@@ -762,7 +762,7 @@ struct evbuffer_ptr evbuffer_search(struct evbuffer *buffer, const char *what, s
first occurrence of the string in the buffer after 'start'. The 'pos'
field of the result is -1 if the string was not found.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evbuffer_ptr evbuffer_search_range(struct evbuffer *buffer, const char *what, size_t len, const struct evbuffer_ptr *start, const struct evbuffer_ptr *end);
/**
@@ -780,25 +780,25 @@ enum evbuffer_ptr_how {
/**
Sets the search pointer in the buffer to position.
- There are two ways to use this function: you can call
- evbuffer_ptr_set(buf, &pos, N, EVBUFFER_PTR_SET)
- to move 'pos' to a position 'N' bytes after the start of the buffer, or
- evbuffer_ptr_set(buf, &pos, N, EVBUFFER_PTR_ADD)
- to move 'pos' forward by 'N' bytes.
-
- If evbuffer_ptr is not initialized, this function can only be called
+ There are two ways to use this function: you can call
+ evbuffer_ptr_set(buf, &pos, N, EVBUFFER_PTR_SET)
+ to move 'pos' to a position 'N' bytes after the start of the buffer, or
+ evbuffer_ptr_set(buf, &pos, N, EVBUFFER_PTR_ADD)
+ to move 'pos' forward by 'N' bytes.
+
+ If evbuffer_ptr is not initialized, this function can only be called
with EVBUFFER_PTR_SET.
- An evbuffer_ptr can represent any position from the start of the buffer to
- a position immediately after the end of the buffer.
-
+ An evbuffer_ptr can represent any position from the start of the buffer to
+ a position immediately after the end of the buffer.
+
@param buffer the evbuffer to be search
@param ptr a pointer to a struct evbuffer_ptr
@param position the position at which to start the next search
@param how determines how the pointer should be manipulated.
@returns 0 on success or -1 otherwise
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int
evbuffer_ptr_set(struct evbuffer *buffer, struct evbuffer_ptr *ptr,
size_t position, enum evbuffer_ptr_how how);
@@ -817,7 +817,7 @@ evbuffer_ptr_set(struct evbuffer *buffer, struct evbuffer_ptr *ptr,
first occurrence EOL in the buffer after 'start'. The 'pos'
field of the result is -1 if the string was not found.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evbuffer_ptr evbuffer_search_eol(struct evbuffer *buffer,
struct evbuffer_ptr *start, size_t *eol_len_out,
enum evbuffer_eol_style eol_style);
@@ -850,7 +850,7 @@ struct evbuffer_ptr evbuffer_search_eol(struct evbuffer *buffer,
than n_vec if we would need more to return all the data that was
requested.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_peek(struct evbuffer *buffer, ev_ssize_t len,
struct evbuffer_ptr *start_at,
struct evbuffer_iovec *vec_out, int n_vec);
@@ -903,7 +903,7 @@ struct evbuffer_cb_entry;
@param cbarg an argument to be provided to the callback function
@return a handle to the callback on success, or NULL on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evbuffer_cb_entry *evbuffer_add_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg);
/** Remove a callback from an evbuffer, given a handle returned from
@@ -914,7 +914,7 @@ struct evbuffer_cb_entry *evbuffer_add_cb(struct evbuffer *buffer, evbuffer_cb_f
@return 0 if a callback was removed, or -1 if no matching callback was
found.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_remove_cb_entry(struct evbuffer *buffer,
struct evbuffer_cb_entry *ent);
@@ -924,7 +924,7 @@ int evbuffer_remove_cb_entry(struct evbuffer *buffer,
@return 0 if a callback was removed, or -1 if no matching callback was
found.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_remove_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg);
/** If this flag is not set, then a callback is temporarily disabled, and
@@ -941,7 +941,7 @@ int evbuffer_remove_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg
@param flags EVBUFFER_CB_ENABLED to re-enable the callback.
@return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_cb_set_flags(struct evbuffer *buffer,
struct evbuffer_cb_entry *cb, ev_uint32_t flags);
@@ -952,7 +952,7 @@ int evbuffer_cb_set_flags(struct evbuffer *buffer,
@param flags EVBUFFER_CB_ENABLED to disable the callback.
@return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_cb_clear_flags(struct evbuffer *buffer,
struct evbuffer_cb_entry *cb, ev_uint32_t flags);
@@ -966,7 +966,7 @@ int evbuffer_cb_clear_flags(struct evbuffer *buffer,
@param the buffer that the callback is watching.
@param cb the callback we want to suspend.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evbuffer_cb_suspend(struct evbuffer *buffer, struct evbuffer_cb_entry *cb);
/** Stop postponing a callback that we postponed with evbuffer_cb_suspend.
@@ -976,7 +976,7 @@ void evbuffer_cb_suspend(struct evbuffer *buffer, struct evbuffer_cb_entry *cb);
@param the buffer that the callback is watching.
@param cb the callback we want to stop suspending.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evbuffer_cb_unsuspend(struct evbuffer *buffer, struct evbuffer_cb_entry *cb);
#endif
@@ -986,11 +986,11 @@ void evbuffer_cb_unsuspend(struct evbuffer *buffer, struct evbuffer_cb_entry *cb
@param buf the evbuffer to make contiguous
@param size the number of bytes to make contiguous, or -1 to make the
entire buffer contiguous.
- @return a pointer to the contiguous memory array, or NULL if param size
- requested more data than is present in the buffer.
+ @return a pointer to the contiguous memory array, or NULL if param size
+ requested more data than is present in the buffer.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
unsigned char *evbuffer_pullup(struct evbuffer *buf, ev_ssize_t size);
/**
@@ -1002,7 +1002,7 @@ unsigned char *evbuffer_pullup(struct evbuffer *buf, ev_ssize_t size);
@return 0 if successful, or -1 otherwise
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_prepend(struct evbuffer *buf, const void *data, size_t size);
/**
@@ -1013,7 +1013,7 @@ int evbuffer_prepend(struct evbuffer *buf, const void *data, size_t size);
@param src the evbuffer to prepend; it will be emptied as a result
@return 0 if successful, or -1 otherwise
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_prepend_buffer(struct evbuffer *dst, struct evbuffer* src);
/**
@@ -1030,7 +1030,7 @@ int evbuffer_prepend_buffer(struct evbuffer *dst, struct evbuffer* src);
we freeze the back.
@return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_freeze(struct evbuffer *buf, int at_front);
/**
Re-enable calls that modify an evbuffer.
@@ -1040,7 +1040,7 @@ int evbuffer_freeze(struct evbuffer *buf, int at_front);
we unfreeze the back.
@return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_unfreeze(struct evbuffer *buf, int at_front);
struct event_base;
@@ -1051,27 +1051,27 @@ struct event_base;
This can be used to serialize all the callbacks to a single thread
of execution.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evbuffer_defer_callbacks(struct evbuffer *buffer, struct event_base *base);
-/**
- Append data from 1 or more iovec's to an evbuffer
-
- Calculates the number of bytes needed for an iovec structure and guarantees
- all data will fit into a single chain. Can be used in lieu of functionality
- which calls evbuffer_add() constantly before being used to increase
- performance.
-
- @param buffer the destination buffer
- @param vec the source iovec
- @param n_vec the number of iovec structures.
- @return the number of bytes successfully written to the output buffer.
-*/
-EVENT2_EXPORT_SYMBOL
-size_t evbuffer_add_iovec(struct evbuffer * buffer, struct evbuffer_iovec * vec, int n_vec);
-
+/**
+ Append data from 1 or more iovec's to an evbuffer
+
+ Calculates the number of bytes needed for an iovec structure and guarantees
+ all data will fit into a single chain. Can be used in lieu of functionality
+ which calls evbuffer_add() constantly before being used to increase
+ performance.
+
+ @param buffer the destination buffer
+ @param vec the source iovec
+ @param n_vec the number of iovec structures.
+ @return the number of bytes successfully written to the output buffer.
+*/
+EVENT2_EXPORT_SYMBOL
+size_t evbuffer_add_iovec(struct evbuffer * buffer, struct evbuffer_iovec * vec, int n_vec);
+
#ifdef __cplusplus
}
#endif
-#endif /* EVENT2_BUFFER_H_INCLUDED_ */
+#endif /* EVENT2_BUFFER_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/buffer_compat.h b/contrib/libs/libevent/include/event2/buffer_compat.h
index 0ce1025448..8b55bc6fe6 100644
--- a/contrib/libs/libevent/include/event2/buffer_compat.h
+++ b/contrib/libs/libevent/include/event2/buffer_compat.h
@@ -24,11 +24,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_BUFFER_COMPAT_H_INCLUDED_
-#define EVENT2_BUFFER_COMPAT_H_INCLUDED_
-
-#include <event2/visibility.h>
+#ifndef EVENT2_BUFFER_COMPAT_H_INCLUDED_
+#define EVENT2_BUFFER_COMPAT_H_INCLUDED_
+#include <event2/visibility.h>
+
/** @file event2/buffer_compat.h
Obsolete and deprecated versions of the functions in buffer.h: provided
@@ -37,7 +37,7 @@
/**
- Obsolete alias for evbuffer_readln(buffer, NULL, EVBUFFER_EOL_ANY).
+ Obsolete alias for evbuffer_readln(buffer, NULL, EVBUFFER_EOL_ANY).
@deprecated This function is deprecated because its behavior is not correct
for almost any protocol, and also because it's wholly subsumed by
@@ -47,7 +47,7 @@
@return pointer to a single line, or NULL if an error occurred
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
char *evbuffer_readline(struct evbuffer *buffer);
/** Type definition for a callback that is invoked whenever data is added or
@@ -90,10 +90,10 @@ typedef void (*evbuffer_cb)(struct evbuffer *buffer, size_t old_len, size_t new_
@param cb the callback function to invoke when the evbuffer is modified,
or NULL to remove all callbacks.
@param cbarg an argument to be provided to the callback function
- @return 0 if successful, or -1 on error
+ @return 0 if successful, or -1 on error
*/
-EVENT2_EXPORT_SYMBOL
-int evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg);
+EVENT2_EXPORT_SYMBOL
+int evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg);
/**
@@ -104,7 +104,7 @@ int evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg);
@param len the length of the search string
@return a pointer to the beginning of the search string, or NULL if the search failed.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
unsigned char *evbuffer_find(struct evbuffer *buffer, const unsigned char *what, size_t len);
/** deprecated in favor of calling the functions directly */
diff --git a/contrib/libs/libevent/include/event2/bufferevent.h b/contrib/libs/libevent/include/event2/bufferevent.h
index 48cd153563..87876effec 100644
--- a/contrib/libs/libevent/include/event2/bufferevent.h
+++ b/contrib/libs/libevent/include/event2/bufferevent.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_BUFFEREVENT_H_INCLUDED_
-#define EVENT2_BUFFEREVENT_H_INCLUDED_
+#ifndef EVENT2_BUFFEREVENT_H_INCLUDED_
+#define EVENT2_BUFFEREVENT_H_INCLUDED_
/**
@file event2/bufferevent.h
@@ -74,17 +74,17 @@
</dl>
*/
-#include <event2/visibility.h>
-
+#include <event2/visibility.h>
+
#ifdef __cplusplus
extern "C" {
#endif
#include <event2/event-config.h>
-#ifdef EVENT__HAVE_SYS_TYPES_H
+#ifdef EVENT__HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -111,7 +111,7 @@ extern "C" {
@see event2/bufferevent.h
*/
struct bufferevent
-#ifdef EVENT_IN_DOXYGEN_
+#ifdef EVENT_IN_DOXYGEN_
{}
#endif
;
@@ -140,9 +140,9 @@ typedef void (*bufferevent_data_cb)(struct bufferevent *bev, void *ctx);
The event callback is triggered if either an EOF condition or another
unrecoverable error was encountered.
- For bufferevents with deferred callbacks, this is a bitwise OR of all errors
- that have happened on the bufferevent since the last callback invocation.
-
+ For bufferevents with deferred callbacks, this is a bitwise OR of all errors
+ that have happened on the bufferevent since the last callback invocation.
+
@param bev the bufferevent for which the error condition was reached
@param what a conjunction of flags: BEV_EVENT_READING or BEV_EVENT_WRITING
to indicate if the error was encountered on the read or write path,
@@ -186,7 +186,7 @@ enum bufferevent_options {
error occurred
@see bufferevent_free()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct bufferevent *bufferevent_socket_new(struct event_base *base, evutil_socket_t fd, int options);
/**
@@ -208,8 +208,8 @@ struct bufferevent *bufferevent_socket_new(struct event_base *base, evutil_socke
@param socklen The length of the address
@return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
-int bufferevent_socket_connect(struct bufferevent *, const struct sockaddr *, int);
+EVENT2_EXPORT_SYMBOL
+int bufferevent_socket_connect(struct bufferevent *, const struct sockaddr *, int);
struct evdns_base;
/**
@@ -238,7 +238,7 @@ struct evdns_base;
may block while it waits for a DNS response. This is probably not
what you want.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_socket_connect_hostname(struct bufferevent *,
struct evdns_base *, int, const char *, int);
@@ -250,7 +250,7 @@ int bufferevent_socket_connect_hostname(struct bufferevent *,
@return DNS error code.
@see evutil_gai_strerror()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_socket_get_dns_error(struct bufferevent *bev);
/**
@@ -264,13 +264,13 @@ int bufferevent_socket_get_dns_error(struct bufferevent *bev);
@return 0 if successful, or -1 if an error occurred
@see bufferevent_new()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_base_set(struct event_base *base, struct bufferevent *bufev);
/**
Return the event_base used by a bufferevent
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct event_base *bufferevent_get_base(struct bufferevent *bev);
/**
@@ -282,26 +282,26 @@ struct event_base *bufferevent_get_base(struct bufferevent *bev);
@param pri the priority to be assigned
@return 0 if successful, or -1 if an error occurred
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_priority_set(struct bufferevent *bufev, int pri);
-/**
- Return the priority of a bufferevent.
-
- Only supported for socket bufferevents
- */
-EVENT2_EXPORT_SYMBOL
-int bufferevent_get_priority(const struct bufferevent *bufev);
+/**
+ Return the priority of a bufferevent.
+ Only supported for socket bufferevents
+ */
+EVENT2_EXPORT_SYMBOL
+int bufferevent_get_priority(const struct bufferevent *bufev);
+
/**
Deallocate the storage associated with a bufferevent structure.
- If there is pending data to write on the bufferevent, it probably won't be
- flushed before the bufferevent is freed.
-
+ If there is pending data to write on the bufferevent, it probably won't be
+ flushed before the bufferevent is freed.
+
@param bufev the bufferevent structure to be freed.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void bufferevent_free(struct bufferevent *bufev);
@@ -319,54 +319,54 @@ void bufferevent_free(struct bufferevent *bufev);
(readcb, writecb, and errorcb)
@see bufferevent_new()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void bufferevent_setcb(struct bufferevent *bufev,
bufferevent_data_cb readcb, bufferevent_data_cb writecb,
bufferevent_event_cb eventcb, void *cbarg);
/**
- Retrieves the callbacks for a bufferevent.
-
- @param bufev the bufferevent to examine.
- @param readcb_ptr if readcb_ptr is nonnull, *readcb_ptr is set to the current
- read callback for the bufferevent.
- @param writecb_ptr if writecb_ptr is nonnull, *writecb_ptr is set to the
- current write callback for the bufferevent.
- @param eventcb_ptr if eventcb_ptr is nonnull, *eventcb_ptr is set to the
- current event callback for the bufferevent.
- @param cbarg_ptr if cbarg_ptr is nonnull, *cbarg_ptr is set to the current
- callback argument for the bufferevent.
- @see buffervent_setcb()
-*/
-EVENT2_EXPORT_SYMBOL
-void bufferevent_getcb(struct bufferevent *bufev,
- bufferevent_data_cb *readcb_ptr,
- bufferevent_data_cb *writecb_ptr,
- bufferevent_event_cb *eventcb_ptr,
- void **cbarg_ptr);
-
-/**
+ Retrieves the callbacks for a bufferevent.
+
+ @param bufev the bufferevent to examine.
+ @param readcb_ptr if readcb_ptr is nonnull, *readcb_ptr is set to the current
+ read callback for the bufferevent.
+ @param writecb_ptr if writecb_ptr is nonnull, *writecb_ptr is set to the
+ current write callback for the bufferevent.
+ @param eventcb_ptr if eventcb_ptr is nonnull, *eventcb_ptr is set to the
+ current event callback for the bufferevent.
+ @param cbarg_ptr if cbarg_ptr is nonnull, *cbarg_ptr is set to the current
+ callback argument for the bufferevent.
+ @see buffervent_setcb()
+*/
+EVENT2_EXPORT_SYMBOL
+void bufferevent_getcb(struct bufferevent *bufev,
+ bufferevent_data_cb *readcb_ptr,
+ bufferevent_data_cb *writecb_ptr,
+ bufferevent_event_cb *eventcb_ptr,
+ void **cbarg_ptr);
+
+/**
Changes the file descriptor on which the bufferevent operates.
Not supported for all bufferevent types.
@param bufev the bufferevent object for which to change the file descriptor
@param fd the file descriptor to operate on
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_setfd(struct bufferevent *bufev, evutil_socket_t fd);
/**
Returns the file descriptor associated with a bufferevent, or -1 if
no file descriptor is associated with the bufferevent.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
evutil_socket_t bufferevent_getfd(struct bufferevent *bufev);
/**
Returns the underlying bufferevent associated with a bufferevent (if
the bufferevent is a wrapper), or NULL if there is no underlying bufferevent.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct bufferevent *bufferevent_get_underlying(struct bufferevent *bufev);
/**
@@ -382,7 +382,7 @@ struct bufferevent *bufferevent_get_underlying(struct bufferevent *bufev);
@return 0 if successful, or -1 if an error occurred
@see bufferevent_write_buffer()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_write(struct bufferevent *bufev,
const void *data, size_t size);
@@ -396,7 +396,7 @@ int bufferevent_write(struct bufferevent *bufev,
@return 0 if successful, or -1 if an error occurred
@see bufferevent_write()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_write_buffer(struct bufferevent *bufev, struct evbuffer *buf);
@@ -410,7 +410,7 @@ int bufferevent_write_buffer(struct bufferevent *bufev, struct evbuffer *buf);
@param size the size of the data buffer, in bytes
@return the amount of data read, in bytes.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
size_t bufferevent_read(struct bufferevent *bufev, void *data, size_t size);
/**
@@ -421,7 +421,7 @@ size_t bufferevent_read(struct bufferevent *bufev, void *data, size_t size);
@param buf the evbuffer to which to add data
@return 0 if successful, or -1 if an error occurred.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_read_buffer(struct bufferevent *bufev, struct evbuffer *buf);
/**
@@ -433,7 +433,7 @@ int bufferevent_read_buffer(struct bufferevent *bufev, struct evbuffer *buf);
@return the evbuffer object for the input buffer
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evbuffer *bufferevent_get_input(struct bufferevent *bufev);
/**
@@ -448,7 +448,7 @@ struct evbuffer *bufferevent_get_input(struct bufferevent *bufev);
@return the evbuffer object for the output buffer
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evbuffer *bufferevent_get_output(struct bufferevent *bufev);
/**
@@ -459,7 +459,7 @@ struct evbuffer *bufferevent_get_output(struct bufferevent *bufev);
@return 0 if successful, or -1 if an error occurred
@see bufferevent_disable()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_enable(struct bufferevent *bufev, short event);
/**
@@ -470,7 +470,7 @@ int bufferevent_enable(struct bufferevent *bufev, short event);
@return 0 if successful, or -1 if an error occurred
@see bufferevent_enable()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_disable(struct bufferevent *bufev, short event);
/**
@@ -479,7 +479,7 @@ int bufferevent_disable(struct bufferevent *bufev, short event);
@param bufev the bufferevent to inspect
@return A combination of EV_READ | EV_WRITE
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
short bufferevent_get_enabled(struct bufferevent *bufev);
/**
@@ -491,7 +491,7 @@ short bufferevent_get_enabled(struct bufferevent *bufev);
(In other words, if reading or writing is disabled, or if the
bufferevent's read or write operation has been suspended because
- there's no data to write, or not enough bandwidth, or so on, the
+ there's no data to write, or not enough bandwidth, or so on, the
timeout isn't active. The timeout only becomes active when we we're
willing to actually read or write.)
@@ -508,7 +508,7 @@ short bufferevent_get_enabled(struct bufferevent *bufev);
@param timeout_read the read timeout, or NULL
@param timeout_write the write timeout, or NULL
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_set_timeouts(struct bufferevent *bufev,
const struct timeval *timeout_read, const struct timeval *timeout_write);
@@ -518,9 +518,9 @@ int bufferevent_set_timeouts(struct bufferevent *bufev,
On input, a bufferevent does not invoke the user read callback unless
there is at least low watermark data in the buffer. If the read buffer
is beyond the high watermark, the bufferevent stops reading from the network.
- But be aware that bufferevent input/read buffer can overrun high watermark
- limit (typical example is openssl bufferevent), so you should not relay in
- this.
+ But be aware that bufferevent input/read buffer can overrun high watermark
+ limit (typical example is openssl bufferevent), so you should not relay in
+ this.
On output, the user write callback is invoked whenever the buffered data
falls below the low watermark. Filters that write to this bufev will try
@@ -533,65 +533,65 @@ int bufferevent_set_timeouts(struct bufferevent *bufev,
@param highmark the high watermark to set
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void bufferevent_setwatermark(struct bufferevent *bufev, short events,
size_t lowmark, size_t highmark);
/**
- Retrieves the watermarks for read or write events.
- Returns non-zero if events contains not only EV_READ or EV_WRITE.
- Returns zero if events equal EV_READ or EV_WRITE
-
- @param bufev the bufferevent to be examined
- @param events EV_READ or EV_WRITE
- @param lowmark receives the lower watermark if not NULL
- @param highmark receives the high watermark if not NULL
-*/
-EVENT2_EXPORT_SYMBOL
-int bufferevent_getwatermark(struct bufferevent *bufev, short events,
- size_t *lowmark, size_t *highmark);
-
-/**
+ Retrieves the watermarks for read or write events.
+ Returns non-zero if events contains not only EV_READ or EV_WRITE.
+ Returns zero if events equal EV_READ or EV_WRITE
+
+ @param bufev the bufferevent to be examined
+ @param events EV_READ or EV_WRITE
+ @param lowmark receives the lower watermark if not NULL
+ @param highmark receives the high watermark if not NULL
+*/
+EVENT2_EXPORT_SYMBOL
+int bufferevent_getwatermark(struct bufferevent *bufev, short events,
+ size_t *lowmark, size_t *highmark);
+
+/**
Acquire the lock on a bufferevent. Has no effect if locking was not
enabled with BEV_OPT_THREADSAFE.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void bufferevent_lock(struct bufferevent *bufev);
/**
Release the lock on a bufferevent. Has no effect if locking was not
enabled with BEV_OPT_THREADSAFE.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void bufferevent_unlock(struct bufferevent *bufev);
-
-/**
- * Public interface to manually increase the reference count of a bufferevent
- * this is useful in situations where a user may reference the bufferevent
- * somewhere else (unknown to libevent)
- *
- * @param bufev the bufferevent to increase the refcount on
- *
- */
-EVENT2_EXPORT_SYMBOL
-void bufferevent_incref(struct bufferevent *bufev);
-
-/**
- * Public interface to manually decrement the reference count of a bufferevent
- *
- * Warning: make sure you know what you're doing. This is mainly used in
- * conjunction with bufferevent_incref(). This will free up all data associated
- * with a bufferevent if the reference count hits 0.
- *
- * @param bufev the bufferevent to decrement the refcount on
- *
- * @return 1 if the bufferevent was freed, otherwise 0 (still referenced)
- */
-EVENT2_EXPORT_SYMBOL
-int bufferevent_decref(struct bufferevent *bufev);
-
+
/**
+ * Public interface to manually increase the reference count of a bufferevent
+ * this is useful in situations where a user may reference the bufferevent
+ * somewhere else (unknown to libevent)
+ *
+ * @param bufev the bufferevent to increase the refcount on
+ *
+ */
+EVENT2_EXPORT_SYMBOL
+void bufferevent_incref(struct bufferevent *bufev);
+
+/**
+ * Public interface to manually decrement the reference count of a bufferevent
+ *
+ * Warning: make sure you know what you're doing. This is mainly used in
+ * conjunction with bufferevent_incref(). This will free up all data associated
+ * with a bufferevent if the reference count hits 0.
+ *
+ * @param bufev the bufferevent to decrement the refcount on
+ *
+ * @return 1 if the bufferevent was freed, otherwise 0 (still referenced)
+ */
+EVENT2_EXPORT_SYMBOL
+int bufferevent_decref(struct bufferevent *bufev);
+
+/**
Flags that can be passed into filters to let them know how to
deal with the incoming data.
*/
@@ -614,55 +614,55 @@ enum bufferevent_flush_mode {
@param mode either BEV_NORMAL or BEV_FLUSH or BEV_FINISHED
@return -1 on failure, 0 if no data was produces, 1 if data was produced
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_flush(struct bufferevent *bufev,
short iotype,
enum bufferevent_flush_mode mode);
/**
- Flags for bufferevent_trigger(_event) that modify when and how to trigger
- the callback.
-*/
-enum bufferevent_trigger_options {
- /** trigger the callback regardless of the watermarks */
- BEV_TRIG_IGNORE_WATERMARKS = (1<<16),
-
- /** defer even if the callbacks are not */
- BEV_TRIG_DEFER_CALLBACKS = BEV_OPT_DEFER_CALLBACKS
-
- /* (Note: for internal reasons, these need to be disjoint from
- * bufferevent_options, except when they mean the same thing. */
-};
-
-/**
- Triggers bufferevent data callbacks.
-
- The function will honor watermarks unless options contain
- BEV_TRIG_IGNORE_WATERMARKS. If the options contain BEV_OPT_DEFER_CALLBACKS,
- the callbacks are deferred.
-
- @param bufev the bufferevent object
- @param iotype either EV_READ or EV_WRITE or both.
- @param options
- */
-EVENT2_EXPORT_SYMBOL
-void bufferevent_trigger(struct bufferevent *bufev, short iotype,
- int options);
-
-/**
- Triggers the bufferevent event callback.
-
- If the options contain BEV_OPT_DEFER_CALLBACKS, the callbacks are deferred.
-
- @param bufev the bufferevent object
- @param what the flags to pass onto the event callback
- @param options
- */
-EVENT2_EXPORT_SYMBOL
-void bufferevent_trigger_event(struct bufferevent *bufev, short what,
- int options);
-
-/**
+ Flags for bufferevent_trigger(_event) that modify when and how to trigger
+ the callback.
+*/
+enum bufferevent_trigger_options {
+ /** trigger the callback regardless of the watermarks */
+ BEV_TRIG_IGNORE_WATERMARKS = (1<<16),
+
+ /** defer even if the callbacks are not */
+ BEV_TRIG_DEFER_CALLBACKS = BEV_OPT_DEFER_CALLBACKS
+
+ /* (Note: for internal reasons, these need to be disjoint from
+ * bufferevent_options, except when they mean the same thing. */
+};
+
+/**
+ Triggers bufferevent data callbacks.
+
+ The function will honor watermarks unless options contain
+ BEV_TRIG_IGNORE_WATERMARKS. If the options contain BEV_OPT_DEFER_CALLBACKS,
+ the callbacks are deferred.
+
+ @param bufev the bufferevent object
+ @param iotype either EV_READ or EV_WRITE or both.
+ @param options
+ */
+EVENT2_EXPORT_SYMBOL
+void bufferevent_trigger(struct bufferevent *bufev, short iotype,
+ int options);
+
+/**
+ Triggers the bufferevent event callback.
+
+ If the options contain BEV_OPT_DEFER_CALLBACKS, the callbacks are deferred.
+
+ @param bufev the bufferevent object
+ @param what the flags to pass onto the event callback
+ @param options
+ */
+EVENT2_EXPORT_SYMBOL
+void bufferevent_trigger_event(struct bufferevent *bufev, short what,
+ int options);
+
+/**
@name Filtering support
@{
@@ -717,7 +717,7 @@ typedef enum bufferevent_filter_result (*bufferevent_filter_cb)(
this bufferevent is freed.
@param ctx A context pointer to pass to the filter functions.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct bufferevent *
bufferevent_filter_new(struct bufferevent *underlying,
bufferevent_filter_cb input_filter,
@@ -737,7 +737,7 @@ bufferevent_filter_new(struct bufferevent *underlying,
@param pair A pointer to an array to hold the two new bufferevent objects.
@return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_pair_new(struct event_base *base, int options,
struct bufferevent *pair[2]);
@@ -745,7 +745,7 @@ int bufferevent_pair_new(struct event_base *base, int options,
Given one bufferevent returned by bufferevent_pair_new(), returns the
other one if it still exists. Otherwise returns NULL.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct bufferevent *bufferevent_pair_get_partner(struct bufferevent *bev);
/**
@@ -779,7 +779,7 @@ struct bufferevent_rate_limit_group;
Note that all rate-limits hare are currently best-effort: future versions
of Libevent may implement them more tightly.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct ev_token_bucket_cfg *ev_token_bucket_cfg_new(
size_t read_rate, size_t read_burst,
size_t write_rate, size_t write_burst,
@@ -790,7 +790,7 @@ struct ev_token_bucket_cfg *ev_token_bucket_cfg_new(
Note: 'cfg' is not currently reference-counted; it is not safe to free it
until no bufferevent is using it.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void ev_token_bucket_cfg_free(struct ev_token_bucket_cfg *cfg);
/**
@@ -802,9 +802,9 @@ void ev_token_bucket_cfg_free(struct ev_token_bucket_cfg *cfg);
They are: socket-based bufferevents (normal and IOCP-based), and SSL-based
bufferevents.
- Return 0 on success, -1 on failure.
+ Return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_set_rate_limit(struct bufferevent *bev,
struct ev_token_bucket_cfg *cfg);
@@ -825,7 +825,7 @@ int bufferevent_set_rate_limit(struct bufferevent *bev,
They are: socket-based bufferevents (normal and IOCP-based), and SSL-based
bufferevents.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct bufferevent_rate_limit_group *bufferevent_rate_limit_group_new(
struct event_base *base,
const struct ev_token_bucket_cfg *cfg);
@@ -834,7 +834,7 @@ struct bufferevent_rate_limit_group *bufferevent_rate_limit_group_new(
Return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_rate_limit_group_set_cfg(
struct bufferevent_rate_limit_group *,
const struct ev_token_bucket_cfg *);
@@ -853,9 +853,9 @@ int bufferevent_rate_limit_group_set_cfg(
The default min-share is currently 64 bytes.
- Returns 0 on success, -1 on failure.
+ Returns 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_rate_limit_group_set_min_share(
struct bufferevent_rate_limit_group *, size_t);
@@ -863,7 +863,7 @@ int bufferevent_rate_limit_group_set_min_share(
Free a rate-limiting group. The group must have no members when
this function is called.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void bufferevent_rate_limit_group_free(struct bufferevent_rate_limit_group *);
/**
@@ -876,43 +876,43 @@ void bufferevent_rate_limit_group_free(struct bufferevent_rate_limit_group *);
Return 0 on success and -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_add_to_rate_limit_group(struct bufferevent *bev,
struct bufferevent_rate_limit_group *g);
/** Remove 'bev' from its current rate-limit group (if any). */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_remove_from_rate_limit_group(struct bufferevent *bev);
/**
- Set the size limit for single read operation.
-
- Set to 0 for a reasonable default.
-
- Return 0 on success and -1 on failure.
- */
-EVENT2_EXPORT_SYMBOL
-int bufferevent_set_max_single_read(struct bufferevent *bev, size_t size);
-
-/**
- Set the size limit for single write operation.
-
- Set to 0 for a reasonable default.
-
- Return 0 on success and -1 on failure.
- */
-EVENT2_EXPORT_SYMBOL
-int bufferevent_set_max_single_write(struct bufferevent *bev, size_t size);
-
-/** Get the current size limit for single read operation. */
-EVENT2_EXPORT_SYMBOL
-ev_ssize_t bufferevent_get_max_single_read(struct bufferevent *bev);
-
-/** Get the current size limit for single write operation. */
-EVENT2_EXPORT_SYMBOL
-ev_ssize_t bufferevent_get_max_single_write(struct bufferevent *bev);
-
-/**
+ Set the size limit for single read operation.
+
+ Set to 0 for a reasonable default.
+
+ Return 0 on success and -1 on failure.
+ */
+EVENT2_EXPORT_SYMBOL
+int bufferevent_set_max_single_read(struct bufferevent *bev, size_t size);
+
+/**
+ Set the size limit for single write operation.
+
+ Set to 0 for a reasonable default.
+
+ Return 0 on success and -1 on failure.
+ */
+EVENT2_EXPORT_SYMBOL
+int bufferevent_set_max_single_write(struct bufferevent *bev, size_t size);
+
+/** Get the current size limit for single read operation. */
+EVENT2_EXPORT_SYMBOL
+ev_ssize_t bufferevent_get_max_single_read(struct bufferevent *bev);
+
+/** Get the current size limit for single write operation. */
+EVENT2_EXPORT_SYMBOL
+ev_ssize_t bufferevent_get_max_single_write(struct bufferevent *bev);
+
+/**
@name Rate limit inspection
Return the current read or write bucket size for a bufferevent.
@@ -923,20 +923,20 @@ ev_ssize_t bufferevent_get_max_single_write(struct bufferevent *bev);
@{
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
ev_ssize_t bufferevent_get_read_limit(struct bufferevent *bev);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
ev_ssize_t bufferevent_get_write_limit(struct bufferevent *bev);
/*@}*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
ev_ssize_t bufferevent_get_max_to_read(struct bufferevent *bev);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
ev_ssize_t bufferevent_get_max_to_write(struct bufferevent *bev);
-EVENT2_EXPORT_SYMBOL
-const struct ev_token_bucket_cfg *bufferevent_get_token_bucket_cfg(const struct bufferevent * bev);
-
+EVENT2_EXPORT_SYMBOL
+const struct ev_token_bucket_cfg *bufferevent_get_token_bucket_cfg(const struct bufferevent * bev);
+
/**
@name Group Rate limit inspection
@@ -946,10 +946,10 @@ const struct ev_token_bucket_cfg *bufferevent_get_token_bucket_cfg(const struct
@{
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
ev_ssize_t bufferevent_rate_limit_group_get_read_limit(
struct bufferevent_rate_limit_group *);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
ev_ssize_t bufferevent_rate_limit_group_get_write_limit(
struct bufferevent_rate_limit_group *);
/*@}*/
@@ -968,9 +968,9 @@ ev_ssize_t bufferevent_rate_limit_group_get_write_limit(
@{
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_decrement_read_limit(struct bufferevent *bev, ev_ssize_t decr);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_decrement_write_limit(struct bufferevent *bev, ev_ssize_t decr);
/*@}*/
@@ -987,10 +987,10 @@ int bufferevent_decrement_write_limit(struct bufferevent *bev, ev_ssize_t decr);
@{
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_rate_limit_group_decrement_read(
struct bufferevent_rate_limit_group *, ev_ssize_t);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_rate_limit_group_decrement_write(
struct bufferevent_rate_limit_group *, ev_ssize_t);
/*@}*/
@@ -1002,7 +1002,7 @@ int bufferevent_rate_limit_group_decrement_write(
* Set the variable pointed to by total_read_out to the total number of bytes
* ever read on grp, and the variable pointed to by total_written_out to the
* total number of bytes ever written on grp. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void bufferevent_rate_limit_group_get_totals(
struct bufferevent_rate_limit_group *grp,
ev_uint64_t *total_read_out, ev_uint64_t *total_written_out);
@@ -1012,7 +1012,7 @@ void bufferevent_rate_limit_group_get_totals(
*
* Reset the number of bytes read or written on grp as given by
* bufferevent_rate_limit_group_reset_totals(). */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void
bufferevent_rate_limit_group_reset_totals(
struct bufferevent_rate_limit_group *grp);
@@ -1021,4 +1021,4 @@ bufferevent_rate_limit_group_reset_totals(
}
#endif
-#endif /* EVENT2_BUFFEREVENT_H_INCLUDED_ */
+#endif /* EVENT2_BUFFEREVENT_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/bufferevent_compat.h b/contrib/libs/libevent/include/event2/bufferevent_compat.h
index a5a3c7207d..22aefba4b8 100644
--- a/contrib/libs/libevent/include/event2/bufferevent_compat.h
+++ b/contrib/libs/libevent/include/event2/bufferevent_compat.h
@@ -25,11 +25,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
-#define EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
-
-#include <event2/visibility.h>
+#ifndef EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
+#define EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
+#include <event2/visibility.h>
+
#define evbuffercb bufferevent_data_cb
#define everrorcb bufferevent_event_cb
@@ -74,7 +74,7 @@
error occurred
@see bufferevent_base_set(), bufferevent_free()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct bufferevent *bufferevent_new(evutil_socket_t fd,
evbuffercb readcb, evbuffercb writecb, everrorcb errorcb, void *cbarg);
@@ -86,7 +86,7 @@ struct bufferevent *bufferevent_new(evutil_socket_t fd,
@param timeout_read the read timeout
@param timeout_write the write timeout
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void bufferevent_settimeout(struct bufferevent *bufev,
int timeout_read, int timeout_write);
diff --git a/contrib/libs/libevent/include/event2/bufferevent_ssl.h b/contrib/libs/libevent/include/event2/bufferevent_ssl.h
index bf39b844a9..39b4768562 100644
--- a/contrib/libs/libevent/include/event2/bufferevent_ssl.h
+++ b/contrib/libs/libevent/include/event2/bufferevent_ssl.h
@@ -23,14 +23,14 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_BUFFEREVENT_SSL_H_INCLUDED_
-#define EVENT2_BUFFEREVENT_SSL_H_INCLUDED_
+#ifndef EVENT2_BUFFEREVENT_SSL_H_INCLUDED_
+#define EVENT2_BUFFEREVENT_SSL_H_INCLUDED_
/** @file event2/bufferevent_ssl.h
OpenSSL support for bufferevents.
*/
-#include <event2/visibility.h>
+#include <event2/visibility.h>
#include <event2/event-config.h>
#include <event2/bufferevent.h>
#include <event2/util.h>
@@ -52,7 +52,7 @@ enum bufferevent_ssl_state {
BUFFEREVENT_SSL_ACCEPTING = 2
};
-#if defined(EVENT__HAVE_OPENSSL) || defined(EVENT_IN_DOXYGEN_)
+#if defined(EVENT__HAVE_OPENSSL) || defined(EVENT_IN_DOXYGEN_)
/**
Create a new SSL bufferevent to send its data over another bufferevent.
@@ -64,7 +64,7 @@ enum bufferevent_ssl_state {
@param options One or more bufferevent_options
@return A new bufferevent on success, or NULL on failure
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct bufferevent *
bufferevent_openssl_filter_new(struct event_base *base,
struct bufferevent *underlying,
@@ -82,7 +82,7 @@ bufferevent_openssl_filter_new(struct event_base *base,
@param options One or more bufferevent_options
@return A new bufferevent on success, or NULL on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct bufferevent *
bufferevent_openssl_socket_new(struct event_base *base,
evutil_socket_t fd,
@@ -90,39 +90,39 @@ bufferevent_openssl_socket_new(struct event_base *base,
enum bufferevent_ssl_state state,
int options);
-/** Control how to report dirty SSL shutdowns.
-
- If the peer (or the network, or an attacker) closes the TCP
- connection before closing the SSL channel, and the protocol is SSL >= v3,
- this is a "dirty" shutdown. If allow_dirty_shutdown is 0 (default),
- this is reported as BEV_EVENT_ERROR.
-
- If instead allow_dirty_shutdown=1, a dirty shutdown is reported as
- BEV_EVENT_EOF.
-
- (Note that if the protocol is < SSLv3, you will always receive
- BEV_EVENT_EOF, since SSL 2 and earlier cannot distinguish a secure
- connection close from a dirty one. This is one reason (among many)
- not to use SSL 2.)
-*/
-
-EVENT2_EXPORT_SYMBOL
-int bufferevent_openssl_get_allow_dirty_shutdown(struct bufferevent *bev);
-EVENT2_EXPORT_SYMBOL
-void bufferevent_openssl_set_allow_dirty_shutdown(struct bufferevent *bev,
- int allow_dirty_shutdown);
-
+/** Control how to report dirty SSL shutdowns.
+
+ If the peer (or the network, or an attacker) closes the TCP
+ connection before closing the SSL channel, and the protocol is SSL >= v3,
+ this is a "dirty" shutdown. If allow_dirty_shutdown is 0 (default),
+ this is reported as BEV_EVENT_ERROR.
+
+ If instead allow_dirty_shutdown=1, a dirty shutdown is reported as
+ BEV_EVENT_EOF.
+
+ (Note that if the protocol is < SSLv3, you will always receive
+ BEV_EVENT_EOF, since SSL 2 and earlier cannot distinguish a secure
+ connection close from a dirty one. This is one reason (among many)
+ not to use SSL 2.)
+*/
+
+EVENT2_EXPORT_SYMBOL
+int bufferevent_openssl_get_allow_dirty_shutdown(struct bufferevent *bev);
+EVENT2_EXPORT_SYMBOL
+void bufferevent_openssl_set_allow_dirty_shutdown(struct bufferevent *bev,
+ int allow_dirty_shutdown);
+
/** Return the underlying openssl SSL * object for an SSL bufferevent. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct ssl_st *
bufferevent_openssl_get_ssl(struct bufferevent *bufev);
/** Tells a bufferevent to begin SSL renegotiation. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int bufferevent_ssl_renegotiate(struct bufferevent *bev);
/** Return the most recent OpenSSL error reported on an SSL bufferevent. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
unsigned long bufferevent_get_openssl_error(struct bufferevent *bev);
#endif
@@ -131,4 +131,4 @@ unsigned long bufferevent_get_openssl_error(struct bufferevent *bev);
}
#endif
-#endif /* EVENT2_BUFFEREVENT_SSL_H_INCLUDED_ */
+#endif /* EVENT2_BUFFEREVENT_SSL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/bufferevent_struct.h b/contrib/libs/libevent/include/event2/bufferevent_struct.h
index e84c082c30..862f1d75f3 100644
--- a/contrib/libs/libevent/include/event2/bufferevent_struct.h
+++ b/contrib/libs/libevent/include/event2/bufferevent_struct.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_
-#define EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_
+#ifndef EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_
+#define EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_
/** @file event2/bufferevent_struct.h
@@ -42,10 +42,10 @@ extern "C" {
#endif
#include <event2/event-config.h>
-#ifdef EVENT__HAVE_SYS_TYPES_H
+#ifdef EVENT__HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -113,4 +113,4 @@ struct bufferevent {
}
#endif
-#endif /* EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_ */
+#endif /* EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/dns.h b/contrib/libs/libevent/include/event2/dns.h
index 13ce027e4a..1a59fad056 100644
--- a/contrib/libs/libevent/include/event2/dns.h
+++ b/contrib/libs/libevent/include/event2/dns.h
@@ -132,11 +132,11 @@
* with the next probe.
*/
-#ifndef EVENT2_DNS_H_INCLUDED_
-#define EVENT2_DNS_H_INCLUDED_
-
-#include <event2/visibility.h>
+#ifndef EVENT2_DNS_H_INCLUDED_
+#define EVENT2_DNS_H_INCLUDED_
+#include <event2/visibility.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -179,39 +179,39 @@ extern "C" {
#define DNS_QUERY_NO_SEARCH 1
-/* Allow searching */
+/* Allow searching */
#define DNS_OPTION_SEARCH 1
-/* Parse "nameserver" and add default if no such section */
+/* Parse "nameserver" and add default if no such section */
#define DNS_OPTION_NAMESERVERS 2
-/* Parse additional options like:
- * - timeout:
- * - getaddrinfo-allow-skew:
- * - max-timeouts:
- * - max-inflight:
- * - attempts:
- * - randomize-case:
- * - initial-probe-timeout:
- */
+/* Parse additional options like:
+ * - timeout:
+ * - getaddrinfo-allow-skew:
+ * - max-timeouts:
+ * - max-inflight:
+ * - attempts:
+ * - randomize-case:
+ * - initial-probe-timeout:
+ */
#define DNS_OPTION_MISC 4
-/* Load hosts file (i.e. "/etc/hosts") */
+/* Load hosts file (i.e. "/etc/hosts") */
#define DNS_OPTION_HOSTSFILE 8
-/**
- * All above:
- * - DNS_OPTION_SEARCH
- * - DNS_OPTION_NAMESERVERS
- * - DNS_OPTION_MISC
- * - DNS_OPTION_HOSTSFILE
- */
-#define DNS_OPTIONS_ALL ( \
- DNS_OPTION_SEARCH | \
- DNS_OPTION_NAMESERVERS | \
- DNS_OPTION_MISC | \
- DNS_OPTION_HOSTSFILE | \
- 0 \
-)
-/* Do not "default" nameserver (i.e. "127.0.0.1:53") if there is no nameservers
- * in resolv.conf, (iff DNS_OPTION_NAMESERVERS is set) */
-#define DNS_OPTION_NAMESERVERS_NO_DEFAULT 16
+/**
+ * All above:
+ * - DNS_OPTION_SEARCH
+ * - DNS_OPTION_NAMESERVERS
+ * - DNS_OPTION_MISC
+ * - DNS_OPTION_HOSTSFILE
+ */
+#define DNS_OPTIONS_ALL ( \
+ DNS_OPTION_SEARCH | \
+ DNS_OPTION_NAMESERVERS | \
+ DNS_OPTION_MISC | \
+ DNS_OPTION_HOSTSFILE | \
+ 0 \
+)
+/* Do not "default" nameserver (i.e. "127.0.0.1:53") if there is no nameservers
+ * in resolv.conf, (iff DNS_OPTION_NAMESERVERS is set) */
+#define DNS_OPTION_NAMESERVERS_NO_DEFAULT 16
/* Obsolete name for DNS_QUERY_NO_SEARCH */
#define DNS_NO_SEARCH DNS_QUERY_NO_SEARCH
@@ -231,16 +231,16 @@ typedef void (*evdns_callback_type) (int result, char type, int count, int ttl,
struct evdns_base;
struct event_base;
-/** Flag for evdns_base_new: process resolv.conf. */
-#define EVDNS_BASE_INITIALIZE_NAMESERVERS 1
-/** Flag for evdns_base_new: Do not prevent the libevent event loop from
- * exiting when we have no active dns requests. */
-#define EVDNS_BASE_DISABLE_WHEN_INACTIVE 0x8000
-/** Flag for evdns_base_new: If EVDNS_BASE_INITIALIZE_NAMESERVERS isset, do not
- * add default nameserver if there are no nameservers in resolv.conf
- * @see DNS_OPTION_NAMESERVERS_NO_DEFAULT */
-#define EVDNS_BASE_NAMESERVERS_NO_DEFAULT 0x10000
-
+/** Flag for evdns_base_new: process resolv.conf. */
+#define EVDNS_BASE_INITIALIZE_NAMESERVERS 1
+/** Flag for evdns_base_new: Do not prevent the libevent event loop from
+ * exiting when we have no active dns requests. */
+#define EVDNS_BASE_DISABLE_WHEN_INACTIVE 0x8000
+/** Flag for evdns_base_new: If EVDNS_BASE_INITIALIZE_NAMESERVERS isset, do not
+ * add default nameserver if there are no nameservers in resolv.conf
+ * @see DNS_OPTION_NAMESERVERS_NO_DEFAULT */
+#define EVDNS_BASE_NAMESERVERS_NO_DEFAULT 0x10000
+
/**
Initialize the asynchronous DNS library.
@@ -249,12 +249,12 @@ struct event_base;
evdns_config_windows_nameservers() on Windows.
@param event_base the event base to associate the dns client with
- @param flags any of EVDNS_BASE_INITIALIZE_NAMESERVERS|
- EVDNS_BASE_DISABLE_WHEN_INACTIVE|EVDNS_BASE_NAMESERVERS_NO_DEFAULT
+ @param flags any of EVDNS_BASE_INITIALIZE_NAMESERVERS|
+ EVDNS_BASE_DISABLE_WHEN_INACTIVE|EVDNS_BASE_NAMESERVERS_NO_DEFAULT
@return evdns_base object if successful, or NULL if an error occurred.
@see evdns_base_free()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evdns_base * evdns_base_new(struct event_base *event_base, int initialize_nameservers);
@@ -270,25 +270,25 @@ struct evdns_base * evdns_base_new(struct event_base *event_base, int initialize
active requests will return DNS_ERR_SHUTDOWN.
@see evdns_base_new()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_base_free(struct evdns_base *base, int fail_requests);
/**
- Remove all hosts entries that have been loaded into the event_base via
- evdns_base_load_hosts or via event_base_resolv_conf_parse.
-
- @param evdns_base the evdns base to remove outdated host addresses from
- */
-EVENT2_EXPORT_SYMBOL
-void evdns_base_clear_host_addresses(struct evdns_base *base);
-
-/**
+ Remove all hosts entries that have been loaded into the event_base via
+ evdns_base_load_hosts or via event_base_resolv_conf_parse.
+
+ @param evdns_base the evdns base to remove outdated host addresses from
+ */
+EVENT2_EXPORT_SYMBOL
+void evdns_base_clear_host_addresses(struct evdns_base *base);
+
+/**
Convert a DNS error code to a string.
@param err the DNS error code
@return a string containing an explanation of the error code
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *evdns_err_to_string(int err);
@@ -303,7 +303,7 @@ const char *evdns_err_to_string(int err);
@return 0 if successful, or -1 if an error occurred
@see evdns_base_nameserver_ip_add()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_base_nameserver_add(struct evdns_base *base,
unsigned long int address);
@@ -319,7 +319,7 @@ int evdns_base_nameserver_add(struct evdns_base *base,
@return the number of configured nameservers
@see evdns_base_nameserver_add()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_base_count_nameservers(struct evdns_base *base);
/**
@@ -331,7 +331,7 @@ int evdns_base_count_nameservers(struct evdns_base *base);
@return 0 if successful, or -1 if an error occurred
@see evdns_base_resume()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_base_clear_nameservers_and_suspend(struct evdns_base *base);
@@ -345,7 +345,7 @@ int evdns_base_clear_nameservers_and_suspend(struct evdns_base *base);
@return 0 if successful, or -1 if an error occurred
@see evdns_base_clear_nameservers_and_suspend()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_base_resume(struct evdns_base *base);
/**
@@ -365,14 +365,14 @@ int evdns_base_resume(struct evdns_base *base);
@return 0 if successful, or -1 if an error occurred
@see evdns_base_nameserver_add()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_base_nameserver_ip_add(struct evdns_base *base,
const char *ip_as_string);
/**
Add a nameserver by sockaddr.
**/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int
evdns_base_nameserver_sockaddr_add(struct evdns_base *base,
const struct sockaddr *sa, ev_socklen_t len, unsigned flags);
@@ -390,7 +390,7 @@ struct evdns_request;
@return an evdns_request object if successful, or NULL if an error occurred.
@see evdns_resolve_ipv6(), evdns_resolve_reverse(), evdns_resolve_reverse_ipv6(), evdns_cancel_request()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evdns_request *evdns_base_resolve_ipv4(struct evdns_base *base, const char *name, int flags, evdns_callback_type callback, void *ptr);
/**
@@ -404,7 +404,7 @@ struct evdns_request *evdns_base_resolve_ipv4(struct evdns_base *base, const cha
@return an evdns_request object if successful, or NULL if an error occurred.
@see evdns_resolve_ipv4(), evdns_resolve_reverse(), evdns_resolve_reverse_ipv6(), evdns_cancel_request()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evdns_request *evdns_base_resolve_ipv6(struct evdns_base *base, const char *name, int flags, evdns_callback_type callback, void *ptr);
struct in_addr;
@@ -421,7 +421,7 @@ struct in6_addr;
@return an evdns_request object if successful, or NULL if an error occurred.
@see evdns_resolve_reverse_ipv6(), evdns_cancel_request()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evdns_request *evdns_base_resolve_reverse(struct evdns_base *base, const struct in_addr *in, int flags, evdns_callback_type callback, void *ptr);
@@ -436,7 +436,7 @@ struct evdns_request *evdns_base_resolve_reverse(struct evdns_base *base, const
@return an evdns_request object if successful, or NULL if an error occurred.
@see evdns_resolve_reverse_ipv6(), evdns_cancel_request()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evdns_request *evdns_base_resolve_reverse_ipv6(struct evdns_base *base, const struct in6_addr *in, int flags, evdns_callback_type callback, void *ptr);
/**
@@ -446,7 +446,7 @@ struct evdns_request *evdns_base_resolve_reverse_ipv6(struct evdns_base *base, c
@param req the evdns_request that was returned by calling a resolve function
@see evdns_base_resolve_ipv4(), evdns_base_resolve_ipv6, evdns_base_resolve_reverse
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_cancel_request(struct evdns_base *base, struct evdns_request *req);
/**
@@ -455,8 +455,8 @@ void evdns_cancel_request(struct evdns_base *base, struct evdns_request *req);
The currently available configuration options are:
ndots, timeout, max-timeouts, max-inflight, attempts, randomize-case,
- bind-to, initial-probe-timeout, getaddrinfo-allow-skew,
- so-rcvbuf, so-sndbuf.
+ bind-to, initial-probe-timeout, getaddrinfo-allow-skew,
+ so-rcvbuf, so-sndbuf.
In versions before Libevent 2.0.3-alpha, the option name needed to end with
a colon.
@@ -466,7 +466,7 @@ void evdns_cancel_request(struct evdns_base *base, struct evdns_request *req);
@param val the value to be set
@return 0 if successful, or -1 if an error occurred
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_base_set_option(struct evdns_base *base, const char *option, const char *val);
@@ -486,13 +486,13 @@ int evdns_base_set_option(struct evdns_base *base, const char *option, const cha
@param base the evdns_base to which to apply this operation
@param flags any of DNS_OPTION_NAMESERVERS|DNS_OPTION_SEARCH|DNS_OPTION_MISC|
- DNS_OPTION_HOSTSFILE|DNS_OPTIONS_ALL|DNS_OPTION_NAMESERVERS_NO_DEFAULT
+ DNS_OPTION_HOSTSFILE|DNS_OPTIONS_ALL|DNS_OPTION_NAMESERVERS_NO_DEFAULT
@param filename the path to the resolv.conf file
@return 0 if successful, or various positive error codes if an error
occurred (see above)
@see resolv.conf(3), evdns_config_windows_nameservers()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_base_resolv_conf_parse(struct evdns_base *base, int flags, const char *const filename);
/**
@@ -503,15 +503,15 @@ int evdns_base_resolv_conf_parse(struct evdns_base *base, int flags, const char
Note that only evdns_getaddrinfo uses the /etc/hosts entries.
- This function does not replace previously loaded hosts entries; to do that,
- call evdns_base_clear_host_addresses first.
-
+ This function does not replace previously loaded hosts entries; to do that,
+ call evdns_base_clear_host_addresses first.
+
Return 0 on success, negative on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_base_load_hosts(struct evdns_base *base, const char *hosts_fname);
-#if defined(EVENT_IN_DOXYGEN_) || defined(_WIN32)
+#if defined(EVENT_IN_DOXYGEN_) || defined(_WIN32)
/**
Obtain nameserver information using the Windows API.
@@ -522,7 +522,7 @@ int evdns_base_load_hosts(struct evdns_base *base, const char *hosts_fname);
@return 0 if successful, or -1 if an error occurred
@see evdns_resolv_conf_parse()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_base_config_windows_nameservers(struct evdns_base *);
#define EVDNS_BASE_CONFIG_WINDOWS_NAMESERVERS_IMPLEMENTED
#endif
@@ -531,7 +531,7 @@ int evdns_base_config_windows_nameservers(struct evdns_base *);
/**
Clear the list of search domains.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_base_search_clear(struct evdns_base *base);
@@ -540,7 +540,7 @@ void evdns_base_search_clear(struct evdns_base *base);
@param domain the domain to be added to the search list
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_base_search_add(struct evdns_base *base, const char *domain);
@@ -552,7 +552,7 @@ void evdns_base_search_add(struct evdns_base *base, const char *domain);
@param ndots the new ndots parameter
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_base_search_ndots_set(struct evdns_base *base, const int ndots);
/**
@@ -571,7 +571,7 @@ typedef void (*evdns_debug_log_fn_type)(int is_warning, const char *msg);
@param fn the callback to be invoked when a log message is generated
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_set_log_fn(evdns_debug_log_fn_type fn);
/**
@@ -584,7 +584,7 @@ void evdns_set_log_fn(evdns_debug_log_fn_type fn);
NOTE: This function has no effect in Libevent 2.0.4-alpha and later,
since Libevent now provides its own secure RNG.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_set_transaction_id_fn(ev_uint16_t (*fn)(void));
/**
@@ -596,7 +596,7 @@ void evdns_set_transaction_id_fn(ev_uint16_t (*fn)(void));
NOTE: This function has no effect in Libevent 2.0.4-alpha and later,
since Libevent now provides its own secure RNG.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_set_random_bytes_fn(void (*fn)(char *, size_t));
/*
@@ -648,50 +648,50 @@ typedef void (*evdns_request_callback_fn_type)(struct evdns_server_request *, vo
@param callback A function to invoke whenever we get a DNS request
on the socket.
@param user_data Data to pass to the callback.
- @return an evdns_server_port structure for this server port or NULL if
- an error occurred.
+ @return an evdns_server_port structure for this server port or NULL if
+ an error occurred.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evdns_server_port *evdns_add_server_port_with_base(struct event_base *base, evutil_socket_t socket, int flags, evdns_request_callback_fn_type callback, void *user_data);
/** Close down a DNS server port, and free associated structures. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_close_server_port(struct evdns_server_port *port);
/** Sets some flags in a reply we're building.
Allows setting of the AA or RD flags
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_server_request_set_flags(struct evdns_server_request *req, int flags);
/* Functions to add an answer to an in-progress DNS reply.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_server_request_add_reply(struct evdns_server_request *req, int section, const char *name, int type, int dns_class, int ttl, int datalen, int is_name, const char *data);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_server_request_add_a_reply(struct evdns_server_request *req, const char *name, int n, const void *addrs, int ttl);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_server_request_add_aaaa_reply(struct evdns_server_request *req, const char *name, int n, const void *addrs, int ttl);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_server_request_add_ptr_reply(struct evdns_server_request *req, struct in_addr *in, const char *inaddr_name, const char *hostname, int ttl);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_server_request_add_cname_reply(struct evdns_server_request *req, const char *name, const char *cname, int ttl);
/**
Send back a response to a DNS request, and free the request structure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_server_request_respond(struct evdns_server_request *req, int err);
/**
Free a DNS request without sending back a reply.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_server_request_drop(struct evdns_server_request *req);
struct sockaddr;
/**
Get the address that made a DNS request.
*/
-EVENT2_EXPORT_SYMBOL
-int evdns_server_request_get_requesting_addr(struct evdns_server_request *req, struct sockaddr *sa, int addr_len);
+EVENT2_EXPORT_SYMBOL
+int evdns_server_request_get_requesting_addr(struct evdns_server_request *req, struct sockaddr *sa, int addr_len);
/** Callback for evdns_getaddrinfo. */
typedef void (*evdns_getaddrinfo_cb)(int result, struct evutil_addrinfo *res, void *arg);
@@ -715,7 +715,7 @@ struct evdns_getaddrinfo_request;
* - For ai_socktype, we only handle SOCKTYPE_STREAM, SOCKTYPE_UDP, and 0.
* - For ai_protocol, we only handle IPPROTO_TCP, IPPROTO_UDP, and 0.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evdns_getaddrinfo_request *evdns_getaddrinfo(
struct evdns_base *dns_base,
const char *nodename, const char *servname,
@@ -725,27 +725,27 @@ struct evdns_getaddrinfo_request *evdns_getaddrinfo(
/* Cancel an in-progress evdns_getaddrinfo. This MUST NOT be called after the
* getaddrinfo's callback has been invoked. The resolves will be canceled,
* and the callback will be invoked with the error EVUTIL_EAI_CANCEL. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_getaddrinfo_cancel(struct evdns_getaddrinfo_request *req);
-/**
- Retrieve the address of the 'idx'th configured nameserver.
-
- @param base The evdns_base to examine.
- @param idx The index of the nameserver to get the address of.
- @param sa A location to receive the server's address.
- @param len The number of bytes available at sa.
-
- @return the number of bytes written into sa on success. On failure, returns
- -1 if idx is greater than the number of configured nameservers, or a
- value greater than 'len' if len was not high enough.
- */
-EVENT2_EXPORT_SYMBOL
-int evdns_base_get_nameserver_addr(struct evdns_base *base, int idx,
- struct sockaddr *sa, ev_socklen_t len);
-
+/**
+ Retrieve the address of the 'idx'th configured nameserver.
+
+ @param base The evdns_base to examine.
+ @param idx The index of the nameserver to get the address of.
+ @param sa A location to receive the server's address.
+ @param len The number of bytes available at sa.
+
+ @return the number of bytes written into sa on success. On failure, returns
+ -1 if idx is greater than the number of configured nameservers, or a
+ value greater than 'len' if len was not high enough.
+ */
+EVENT2_EXPORT_SYMBOL
+int evdns_base_get_nameserver_addr(struct evdns_base *base, int idx,
+ struct sockaddr *sa, ev_socklen_t len);
+
#ifdef __cplusplus
}
#endif
-#endif /* !EVENT2_DNS_H_INCLUDED_ */
+#endif /* !EVENT2_DNS_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/dns_compat.h b/contrib/libs/libevent/include/event2/dns_compat.h
index a58c4b2937..433607220d 100644
--- a/contrib/libs/libevent/include/event2/dns_compat.h
+++ b/contrib/libs/libevent/include/event2/dns_compat.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_DNS_COMPAT_H_INCLUDED_
-#define EVENT2_DNS_COMPAT_H_INCLUDED_
+#ifndef EVENT2_DNS_COMPAT_H_INCLUDED_
+#define EVENT2_DNS_COMPAT_H_INCLUDED_
/** @file event2/dns_compat.h
@@ -40,16 +40,16 @@ extern "C" {
#endif
#include <event2/event-config.h>
-#ifdef EVENT__HAVE_SYS_TYPES_H
+#ifdef EVENT__HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
/* For int types. */
#include <event2/util.h>
-#include <event2/visibility.h>
+#include <event2/visibility.h>
/**
Initialize the asynchronous DNS library.
@@ -67,7 +67,7 @@ extern "C" {
@return 0 if successful, or -1 if an error occurred
@see evdns_shutdown()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_init(void);
struct evdns_base;
@@ -78,7 +78,7 @@ struct evdns_base;
@deprecated This function is deprecated because use of the global
evdns_base is error-prone.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evdns_base *evdns_get_global_base(void);
/**
@@ -96,7 +96,7 @@ struct evdns_base *evdns_get_global_base(void);
active requests will return DNS_ERR_SHUTDOWN.
@see evdns_init()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_shutdown(int fail_requests);
/**
@@ -113,7 +113,7 @@ void evdns_shutdown(int fail_requests);
@return 0 if successful, or -1 if an error occurred
@see evdns_nameserver_ip_add()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_nameserver_add(unsigned long int address);
/**
@@ -131,7 +131,7 @@ int evdns_nameserver_add(unsigned long int address);
@return the number of configured nameservers
@see evdns_nameserver_add()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_count_nameservers(void);
/**
@@ -146,7 +146,7 @@ int evdns_count_nameservers(void);
@return 0 if successful, or -1 if an error occurred
@see evdns_resume()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_clear_nameservers_and_suspend(void);
/**
@@ -162,7 +162,7 @@ int evdns_clear_nameservers_and_suspend(void);
@return 0 if successful, or -1 if an error occurred
@see evdns_clear_nameservers_and_suspend()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_resume(void);
/**
@@ -178,7 +178,7 @@ int evdns_resume(void);
@return 0 if successful, or -1 if an error occurred
@see evdns_nameserver_add()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_nameserver_ip_add(const char *ip_as_string);
/**
@@ -195,7 +195,7 @@ int evdns_nameserver_ip_add(const char *ip_as_string);
@return 0 if successful, or -1 if an error occurred
@see evdns_resolve_ipv6(), evdns_resolve_reverse(), evdns_resolve_reverse_ipv6()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_resolve_ipv4(const char *name, int flags, evdns_callback_type callback, void *ptr);
/**
@@ -208,7 +208,7 @@ int evdns_resolve_ipv4(const char *name, int flags, evdns_callback_type callback
@return 0 if successful, or -1 if an error occurred
@see evdns_resolve_ipv4(), evdns_resolve_reverse(), evdns_resolve_reverse_ipv6()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_resolve_ipv6(const char *name, int flags, evdns_callback_type callback, void *ptr);
struct in_addr;
@@ -228,7 +228,7 @@ struct in6_addr;
@return 0 if successful, or -1 if an error occurred
@see evdns_resolve_reverse_ipv6()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_resolve_reverse(const struct in_addr *in, int flags, evdns_callback_type callback, void *ptr);
/**
@@ -245,7 +245,7 @@ int evdns_resolve_reverse(const struct in_addr *in, int flags, evdns_callback_ty
@return 0 if successful, or -1 if an error occurred
@see evdns_resolve_reverse_ipv6()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_resolve_reverse_ipv6(const struct in6_addr *in, int flags, evdns_callback_type callback, void *ptr);
/**
@@ -264,7 +264,7 @@ int evdns_resolve_reverse_ipv6(const struct in6_addr *in, int flags, evdns_callb
@param flags Ignored.
@return 0 if successful, or -1 if an error occurred
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_set_option(const char *option, const char *val, int flags);
/**
@@ -292,7 +292,7 @@ int evdns_set_option(const char *option, const char *val, int flags);
occurred (see above)
@see resolv.conf(3), evdns_config_windows_nameservers()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evdns_resolv_conf_parse(int flags, const char *const filename);
/**
@@ -302,7 +302,7 @@ int evdns_resolv_conf_parse(int flags, const char *const filename);
caller to specify which evdns_base it applies to. The recommended
function is evdns_base_search_clear().
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_search_clear(void);
/**
@@ -314,7 +314,7 @@ void evdns_search_clear(void);
@param domain the domain to be added to the search list
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_search_add(const char *domain);
/**
@@ -329,7 +329,7 @@ void evdns_search_add(const char *domain);
@param ndots the new ndots parameter
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evdns_search_ndots_set(const int ndots);
/**
@@ -340,13 +340,13 @@ void evdns_search_ndots_set(const int ndots);
function is evdns_add_server_port_with_base().
*/
-EVENT2_EXPORT_SYMBOL
-struct evdns_server_port *
-evdns_add_server_port(evutil_socket_t socket, int flags,
- evdns_request_callback_fn_type callback, void *user_data);
+EVENT2_EXPORT_SYMBOL
+struct evdns_server_port *
+evdns_add_server_port(evutil_socket_t socket, int flags,
+ evdns_request_callback_fn_type callback, void *user_data);
-#ifdef _WIN32
-EVENT2_EXPORT_SYMBOL
+#ifdef _WIN32
+EVENT2_EXPORT_SYMBOL
int evdns_config_windows_nameservers(void);
#define EVDNS_CONFIG_WINDOWS_NAMESERVERS_IMPLEMENTED
#endif
@@ -355,4 +355,4 @@ int evdns_config_windows_nameservers(void);
}
#endif
-#endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
+#endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/dns_struct.h b/contrib/libs/libevent/include/event2/dns_struct.h
index 593a8a70b6..18d7196d2f 100644
--- a/contrib/libs/libevent/include/event2/dns_struct.h
+++ b/contrib/libs/libevent/include/event2/dns_struct.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_DNS_STRUCT_H_INCLUDED_
-#define EVENT2_DNS_STRUCT_H_INCLUDED_
+#ifndef EVENT2_DNS_STRUCT_H_INCLUDED_
+#define EVENT2_DNS_STRUCT_H_INCLUDED_
/** @file event2/dns_struct.h
@@ -39,10 +39,10 @@ extern "C" {
#endif
#include <event2/event-config.h>
-#ifdef EVENT__HAVE_SYS_TYPES_H
+#ifdef EVENT__HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -76,5 +76,5 @@ struct evdns_server_question {
}
#endif
-#endif /* EVENT2_DNS_STRUCT_H_INCLUDED_ */
+#endif /* EVENT2_DNS_STRUCT_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/event-config-linux.h b/contrib/libs/libevent/include/event2/event-config-linux.h
index f8fbfe5c8b..775a2d2171 100644
--- a/contrib/libs/libevent/include/event2/event-config-linux.h
+++ b/contrib/libs/libevent/include/event2/event-config-linux.h
@@ -8,41 +8,41 @@
* Do not rely on macros in this file existing in later versions.
*/
-#ifndef EVENT2_EVENT_CONFIG_H_INCLUDED_
-#define EVENT2_EVENT_CONFIG_H_INCLUDED_
+#ifndef EVENT2_EVENT_CONFIG_H_INCLUDED_
+#define EVENT2_EVENT_CONFIG_H_INCLUDED_
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if libevent should build without support for a debug mode */
-/* #undef EVENT__DISABLE_DEBUG_MODE */
+/* #undef EVENT__DISABLE_DEBUG_MODE */
/* Define if libevent should not allow replacing the mm functions */
-/* #undef EVENT__DISABLE_MM_REPLACEMENT */
+/* #undef EVENT__DISABLE_MM_REPLACEMENT */
/* Define if libevent should not be compiled with thread support */
-/* #undef EVENT__DISABLE_THREAD_SUPPORT */
-
-/* Define to 1 if you have the `accept4' function. */
-#define EVENT__HAVE_ACCEPT4 1
+/* #undef EVENT__DISABLE_THREAD_SUPPORT */
+/* Define to 1 if you have the `accept4' function. */
+#define EVENT__HAVE_ACCEPT4 1
+
/* Define to 1 if you have the <afunix.h> header file. */
/* #undef EVENT__HAVE_AFUNIX_H */
/* Define to 1 if you have the `arc4random' function. */
-/* #undef EVENT__HAVE_ARC4RANDOM */
-
-/* Define to 1 if you have the `arc4random_addrandom' function. */
-/* #undef EVENT__HAVE_ARC4RANDOM_ADDRANDOM */
+/* #undef EVENT__HAVE_ARC4RANDOM */
+/* Define to 1 if you have the `arc4random_addrandom' function. */
+/* #undef EVENT__HAVE_ARC4RANDOM_ADDRANDOM */
+
/* Define to 1 if you have the `arc4random_buf' function. */
-/* #undef EVENT__HAVE_ARC4RANDOM_BUF */
+/* #undef EVENT__HAVE_ARC4RANDOM_BUF */
/* Define to 1 if you have the <arpa/inet.h> header file. */
-#define EVENT__HAVE_ARPA_INET_H 1
+#define EVENT__HAVE_ARPA_INET_H 1
/* Define to 1 if you have the `clock_gettime' function. */
-#define EVENT__HAVE_CLOCK_GETTIME 1
+#define EVENT__HAVE_CLOCK_GETTIME 1
/* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you
don't. */
@@ -53,376 +53,376 @@
/* #undef EVENT__HAVE_DECL_KERN_ARND */
/* Define if /dev/poll is available */
-/* #undef EVENT__HAVE_DEVPOLL */
+/* #undef EVENT__HAVE_DEVPOLL */
/* Define to 1 if you have the <dlfcn.h> header file. */
-#define EVENT__HAVE_DLFCN_H 1
+#define EVENT__HAVE_DLFCN_H 1
/* Define if your system supports the epoll system calls */
-#define EVENT__HAVE_EPOLL 1
-
-/* Define to 1 if you have the `epoll_create1' function. */
-#define EVENT__HAVE_EPOLL_CREATE1 1
+#define EVENT__HAVE_EPOLL 1
+/* Define to 1 if you have the `epoll_create1' function. */
+#define EVENT__HAVE_EPOLL_CREATE1 1
+
/* Define to 1 if you have the `epoll_ctl' function. */
-#define EVENT__HAVE_EPOLL_CTL 1
-
-/* Define to 1 if you have the <errno.h> header file. */
-#define EVENT__HAVE_ERRNO_H 1
+#define EVENT__HAVE_EPOLL_CTL 1
+/* Define to 1 if you have the <errno.h> header file. */
+#define EVENT__HAVE_ERRNO_H 1
+
/* Define to 1 if you have the `eventfd' function. */
-#define EVENT__HAVE_EVENTFD 1
+#define EVENT__HAVE_EVENTFD 1
/* Define if your system supports event ports */
-/* #undef EVENT__HAVE_EVENT_PORTS */
+/* #undef EVENT__HAVE_EVENT_PORTS */
/* Define to 1 if you have the `fcntl' function. */
-#define EVENT__HAVE_FCNTL 1
+#define EVENT__HAVE_FCNTL 1
/* Define to 1 if you have the <fcntl.h> header file. */
-#define EVENT__HAVE_FCNTL_H 1
+#define EVENT__HAVE_FCNTL_H 1
/* Define to 1 if the system has the type `fd_mask'. */
-#define EVENT__HAVE_FD_MASK 1
+#define EVENT__HAVE_FD_MASK 1
/* Do we have getaddrinfo()? */
-#define EVENT__HAVE_GETADDRINFO 1
+#define EVENT__HAVE_GETADDRINFO 1
/* Define to 1 if you have the `getegid' function. */
-#define EVENT__HAVE_GETEGID 1
+#define EVENT__HAVE_GETEGID 1
/* Define to 1 if you have the `geteuid' function. */
-#define EVENT__HAVE_GETEUID 1
+#define EVENT__HAVE_GETEUID 1
/* Define this if you have any gethostbyname_r() */
-/* #undef EVENT__HAVE_GETHOSTBYNAME_R */
+/* #undef EVENT__HAVE_GETHOSTBYNAME_R */
/* Define this if gethostbyname_r takes 3 arguments */
-/* #undef EVENT__HAVE_GETHOSTBYNAME_R_3_ARG */
+/* #undef EVENT__HAVE_GETHOSTBYNAME_R_3_ARG */
/* Define this if gethostbyname_r takes 5 arguments */
-/* #undef EVENT__HAVE_GETHOSTBYNAME_R_5_ARG */
+/* #undef EVENT__HAVE_GETHOSTBYNAME_R_5_ARG */
/* Define this if gethostbyname_r takes 6 arguments */
-/* #undef EVENT__HAVE_GETHOSTBYNAME_R_6_ARG */
-
-/* Define to 1 if you have the `getifaddrs' function. */
-#define EVENT__HAVE_GETIFADDRS 1
+/* #undef EVENT__HAVE_GETHOSTBYNAME_R_6_ARG */
+/* Define to 1 if you have the `getifaddrs' function. */
+#define EVENT__HAVE_GETIFADDRS 1
+
/* Define to 1 if you have the `getnameinfo' function. */
-#define EVENT__HAVE_GETNAMEINFO 1
+#define EVENT__HAVE_GETNAMEINFO 1
/* Define to 1 if you have the `getprotobynumber' function. */
-#define EVENT__HAVE_GETPROTOBYNUMBER 1
+#define EVENT__HAVE_GETPROTOBYNUMBER 1
/* Define to 1 if you have the `getrandom' function. */
#define EVENT__HAVE_GETRANDOM 1
/* Define to 1 if you have the `getservbyname' function. */
-#define EVENT__HAVE_GETSERVBYNAME 1
+#define EVENT__HAVE_GETSERVBYNAME 1
/* Define to 1 if you have the `gettimeofday' function. */
-#define EVENT__HAVE_GETTIMEOFDAY 1
+#define EVENT__HAVE_GETTIMEOFDAY 1
-/* Define to 1 if you have the <ifaddrs.h> header file. */
-#define EVENT__HAVE_IFADDRS_H 1
+/* Define to 1 if you have the <ifaddrs.h> header file. */
+#define EVENT__HAVE_IFADDRS_H 1
/* Define to 1 if you have the `inet_ntop' function. */
-#define EVENT__HAVE_INET_NTOP 1
+#define EVENT__HAVE_INET_NTOP 1
/* Define to 1 if you have the `inet_pton' function. */
-#define EVENT__HAVE_INET_PTON 1
+#define EVENT__HAVE_INET_PTON 1
/* Define to 1 if you have the <inttypes.h> header file. */
-#define EVENT__HAVE_INTTYPES_H 1
+#define EVENT__HAVE_INTTYPES_H 1
/* Define to 1 if you have the `issetugid' function. */
-/* #undef EVENT__HAVE_ISSETUGID */
+/* #undef EVENT__HAVE_ISSETUGID */
/* Define to 1 if you have the `kqueue' function. */
-/* #undef EVENT__HAVE_KQUEUE */
+/* #undef EVENT__HAVE_KQUEUE */
/* Define to 1 if you have the `ws2_32' library (-lws2_32). */
/* #undef EVENT__HAVE_LIBWS2_32 */
/* Define if the system has zlib */
-#define EVENT__HAVE_LIBZ 1
-
-/* Define to 1 if you have the `mach_absolute_time' function. */
-/* #undef EVENT__HAVE_MACH_ABSOLUTE_TIME */
+#define EVENT__HAVE_LIBZ 1
+/* Define to 1 if you have the `mach_absolute_time' function. */
+/* #undef EVENT__HAVE_MACH_ABSOLUTE_TIME */
+
/* Define to 1 if you have the <mach/mach.h> header file. */
/* #undef EVENT__HAVE_MACH_MACH_H */
-/* Define to 1 if you have the <mach/mach_time.h> header file. */
-/* #undef EVENT__HAVE_MACH_MACH_TIME_H */
-
+/* Define to 1 if you have the <mach/mach_time.h> header file. */
+/* #undef EVENT__HAVE_MACH_MACH_TIME_H */
+
/* Define to 1 if you have the <memory.h> header file. */
-#define EVENT__HAVE_MEMORY_H 1
+#define EVENT__HAVE_MEMORY_H 1
/* Define to 1 if you have the `mmap' function. */
-#define EVENT__HAVE_MMAP 1
-
-/* Define to 1 if you have the `nanosleep' function. */
-#define EVENT__HAVE_NANOSLEEP 1
+#define EVENT__HAVE_MMAP 1
+/* Define to 1 if you have the `nanosleep' function. */
+#define EVENT__HAVE_NANOSLEEP 1
+
/* Define to 1 if you have the <netdb.h> header file. */
-#define EVENT__HAVE_NETDB_H 1
+#define EVENT__HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in6.h> header file. */
-/* #undef EVENT__HAVE_NETINET_IN6_H */
+/* #undef EVENT__HAVE_NETINET_IN6_H */
/* Define to 1 if you have the <netinet/in.h> header file. */
-#define EVENT__HAVE_NETINET_IN_H 1
-
-/* Define to 1 if you have the <netinet/tcp.h> header file. */
-#define EVENT__HAVE_NETINET_TCP_H 1
+#define EVENT__HAVE_NETINET_IN_H 1
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+#define EVENT__HAVE_NETINET_TCP_H 1
+
/* Define if the system has openssl */
-#define EVENT__HAVE_OPENSSL 1
+#define EVENT__HAVE_OPENSSL 1
-/* Define to 1 if you have the <openssl/ssl.h> header file. */
-#define EVENT__HAVE_OPENSSL_SSL_H 1
+/* Define to 1 if you have the <openssl/ssl.h> header file. */
+#define EVENT__HAVE_OPENSSL_SSL_H 1
/* Define to 1 if you have the `pipe' function. */
-#define EVENT__HAVE_PIPE 1
-
-/* Define to 1 if you have the `pipe2' function. */
-#define EVENT__HAVE_PIPE2 1
+#define EVENT__HAVE_PIPE 1
+/* Define to 1 if you have the `pipe2' function. */
+#define EVENT__HAVE_PIPE2 1
+
/* Define to 1 if you have the `poll' function. */
-#define EVENT__HAVE_POLL 1
+#define EVENT__HAVE_POLL 1
/* Define to 1 if you have the <poll.h> header file. */
-#define EVENT__HAVE_POLL_H 1
+#define EVENT__HAVE_POLL_H 1
/* Define to 1 if you have the `port_create' function. */
-/* #undef EVENT__HAVE_PORT_CREATE */
+/* #undef EVENT__HAVE_PORT_CREATE */
/* Define to 1 if you have the <port.h> header file. */
-/* #undef EVENT__HAVE_PORT_H */
+/* #undef EVENT__HAVE_PORT_H */
/* Define if you have POSIX threads libraries and header files. */
-/* #undef EVENT__HAVE_PTHREAD */
+/* #undef EVENT__HAVE_PTHREAD */
/* Define if we have pthreads on this system */
-#define EVENT__HAVE_PTHREADS 1
+#define EVENT__HAVE_PTHREADS 1
/* Define to 1 if you have the `putenv' function. */
-#define EVENT__HAVE_PUTENV 1
+#define EVENT__HAVE_PUTENV 1
/* Define to 1 if the system has the type `sa_family_t'. */
-#define EVENT__HAVE_SA_FAMILY_T 1
+#define EVENT__HAVE_SA_FAMILY_T 1
/* Define to 1 if you have the `select' function. */
-#define EVENT__HAVE_SELECT 1
+#define EVENT__HAVE_SELECT 1
/* Define to 1 if you have the `sendfile' function. */
-#define EVENT__HAVE_SENDFILE 1
+#define EVENT__HAVE_SENDFILE 1
/* Define to 1 if you have the `setenv' function. */
-#define EVENT__HAVE_SETENV 1
+#define EVENT__HAVE_SETENV 1
/* Define if F_SETFD is defined in <fcntl.h> */
-#define EVENT__HAVE_SETFD 1
-
-/* Define to 1 if you have the `setrlimit' function. */
-#define EVENT__HAVE_SETRLIMIT 1
+#define EVENT__HAVE_SETFD 1
+/* Define to 1 if you have the `setrlimit' function. */
+#define EVENT__HAVE_SETRLIMIT 1
+
/* Define to 1 if you have the `sigaction' function. */
-#define EVENT__HAVE_SIGACTION 1
+#define EVENT__HAVE_SIGACTION 1
/* Define to 1 if you have the `signal' function. */
-#define EVENT__HAVE_SIGNAL 1
+#define EVENT__HAVE_SIGNAL 1
/* Define to 1 if you have the `splice' function. */
-#define EVENT__HAVE_SPLICE 1
+#define EVENT__HAVE_SPLICE 1
/* Define to 1 if you have the <stdarg.h> header file. */
-#define EVENT__HAVE_STDARG_H 1
+#define EVENT__HAVE_STDARG_H 1
/* Define to 1 if you have the <stddef.h> header file. */
-#define EVENT__HAVE_STDDEF_H 1
+#define EVENT__HAVE_STDDEF_H 1
/* Define to 1 if you have the <stdint.h> header file. */
-#define EVENT__HAVE_STDINT_H 1
+#define EVENT__HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
-#define EVENT__HAVE_STDLIB_H 1
+#define EVENT__HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
-#define EVENT__HAVE_STRINGS_H 1
+#define EVENT__HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
-#define EVENT__HAVE_STRING_H 1
+#define EVENT__HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */
-/* #undef EVENT__HAVE_STRLCPY */
+/* #undef EVENT__HAVE_STRLCPY */
/* Define to 1 if you have the `strsep' function. */
-#define EVENT__HAVE_STRSEP 1
+#define EVENT__HAVE_STRSEP 1
/* Define to 1 if you have the `strtok_r' function. */
-#define EVENT__HAVE_STRTOK_R 1
+#define EVENT__HAVE_STRTOK_R 1
/* Define to 1 if you have the `strtoll' function. */
-#define EVENT__HAVE_STRTOLL 1
+#define EVENT__HAVE_STRTOLL 1
/* Define to 1 if the system has the type `struct addrinfo'. */
-#define EVENT__HAVE_STRUCT_ADDRINFO 1
+#define EVENT__HAVE_STRUCT_ADDRINFO 1
/* Define to 1 if the system has the type `struct in6_addr'. */
-#define EVENT__HAVE_STRUCT_IN6_ADDR 1
+#define EVENT__HAVE_STRUCT_IN6_ADDR 1
/* Define to 1 if `s6_addr16' is a member of `struct in6_addr'. */
-#define EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16 1
+#define EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16 1
/* Define to 1 if `s6_addr32' is a member of `struct in6_addr'. */
-#define EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32 1
-
-/* Define to 1 if the system has the type `struct linger'. */
-#define EVENT__HAVE_STRUCT_LINGER 1
+#define EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32 1
+/* Define to 1 if the system has the type `struct linger'. */
+#define EVENT__HAVE_STRUCT_LINGER 1
+
/* Define to 1 if the system has the type `struct sockaddr_in6'. */
-#define EVENT__HAVE_STRUCT_SOCKADDR_IN6 1
+#define EVENT__HAVE_STRUCT_SOCKADDR_IN6 1
/* Define to 1 if `sin6_len' is a member of `struct sockaddr_in6'. */
-/* #undef EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN */
+/* #undef EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN */
/* Define to 1 if `sin_len' is a member of `struct sockaddr_in'. */
-/* #undef EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
+/* #undef EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
-#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE 1
+#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE 1
/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */
-#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
+#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */
-/* #undef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */
-
-/* Define to 1 if the system has the type `struct sockaddr_un'. */
-#define EVENT__HAVE_STRUCT_SOCKADDR_UN 1
+/* #undef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */
+/* Define to 1 if the system has the type `struct sockaddr_un'. */
+#define EVENT__HAVE_STRUCT_SOCKADDR_UN 1
+
/* Define to 1 if you have the `sysctl' function. */
/* #undef EVENT__HAVE_SYSCTL */
/* Define to 1 if you have the <sys/devpoll.h> header file. */
-/* #undef EVENT__HAVE_SYS_DEVPOLL_H */
+/* #undef EVENT__HAVE_SYS_DEVPOLL_H */
/* Define to 1 if you have the <sys/epoll.h> header file. */
-#define EVENT__HAVE_SYS_EPOLL_H 1
+#define EVENT__HAVE_SYS_EPOLL_H 1
/* Define to 1 if you have the <sys/eventfd.h> header file. */
-#define EVENT__HAVE_SYS_EVENTFD_H 1
+#define EVENT__HAVE_SYS_EVENTFD_H 1
/* Define to 1 if you have the <sys/event.h> header file. */
-/* #undef EVENT__HAVE_SYS_EVENT_H */
+/* #undef EVENT__HAVE_SYS_EVENT_H */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
-#define EVENT__HAVE_SYS_IOCTL_H 1
+#define EVENT__HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/mman.h> header file. */
-#define EVENT__HAVE_SYS_MMAN_H 1
+#define EVENT__HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
-#define EVENT__HAVE_SYS_PARAM_H 1
+#define EVENT__HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/queue.h> header file. */
-#define EVENT__HAVE_SYS_QUEUE_H 1
+#define EVENT__HAVE_SYS_QUEUE_H 1
/* Define to 1 if you have the <sys/random.h> header file. */
#define EVENT__HAVE_SYS_RANDOM_H 1
-/* Define to 1 if you have the <sys/resource.h> header file. */
-#define EVENT__HAVE_SYS_RESOURCE_H 1
-
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#define EVENT__HAVE_SYS_RESOURCE_H 1
+
/* Define to 1 if you have the <sys/select.h> header file. */
-#define EVENT__HAVE_SYS_SELECT_H 1
+#define EVENT__HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/sendfile.h> header file. */
-#define EVENT__HAVE_SYS_SENDFILE_H 1
+#define EVENT__HAVE_SYS_SENDFILE_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
-#define EVENT__HAVE_SYS_SOCKET_H 1
+#define EVENT__HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
-#define EVENT__HAVE_SYS_STAT_H 1
+#define EVENT__HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysctl.h> header file. */
/* #undef EVENT__HAVE_SYS_SYSCTL_H */
-/* Define to 1 if you have the <sys/timerfd.h> header file. */
-#define EVENT__HAVE_SYS_TIMERFD_H 1
-
+/* Define to 1 if you have the <sys/timerfd.h> header file. */
+#define EVENT__HAVE_SYS_TIMERFD_H 1
+
/* Define to 1 if you have the <sys/time.h> header file. */
-#define EVENT__HAVE_SYS_TIME_H 1
+#define EVENT__HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
-#define EVENT__HAVE_SYS_TYPES_H 1
+#define EVENT__HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
-#define EVENT__HAVE_SYS_UIO_H 1
-
-/* Define to 1 if you have the <sys/un.h> header file. */
-#define EVENT__HAVE_SYS_UN_H 1
+#define EVENT__HAVE_SYS_UIO_H 1
+/* Define to 1 if you have the <sys/un.h> header file. */
+#define EVENT__HAVE_SYS_UN_H 1
+
/* Define to 1 if you have the <sys/wait.h> header file. */
-#define EVENT__HAVE_SYS_WAIT_H 1
+#define EVENT__HAVE_SYS_WAIT_H 1
/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
-#define EVENT__HAVE_TAILQFOREACH 1
+#define EVENT__HAVE_TAILQFOREACH 1
/* Define if timeradd is defined in <sys/time.h> */
-#define EVENT__HAVE_TIMERADD 1
+#define EVENT__HAVE_TIMERADD 1
/* Define if timerclear is defined in <sys/time.h> */
-#define EVENT__HAVE_TIMERCLEAR 1
+#define EVENT__HAVE_TIMERCLEAR 1
/* Define if timercmp is defined in <sys/time.h> */
-#define EVENT__HAVE_TIMERCMP 1
-
-/* Define to 1 if you have the `timerfd_create' function. */
-#define EVENT__HAVE_TIMERFD_CREATE 1
+#define EVENT__HAVE_TIMERCMP 1
+/* Define to 1 if you have the `timerfd_create' function. */
+#define EVENT__HAVE_TIMERFD_CREATE 1
+
/* Define if timerisset is defined in <sys/time.h> */
-#define EVENT__HAVE_TIMERISSET 1
+#define EVENT__HAVE_TIMERISSET 1
/* Define to 1 if the system has the type `uint16_t'. */
-#define EVENT__HAVE_UINT16_T 1
+#define EVENT__HAVE_UINT16_T 1
/* Define to 1 if the system has the type `uint32_t'. */
-#define EVENT__HAVE_UINT32_T 1
+#define EVENT__HAVE_UINT32_T 1
/* Define to 1 if the system has the type `uint64_t'. */
-#define EVENT__HAVE_UINT64_T 1
+#define EVENT__HAVE_UINT64_T 1
/* Define to 1 if the system has the type `uint8_t'. */
-#define EVENT__HAVE_UINT8_T 1
+#define EVENT__HAVE_UINT8_T 1
/* Define to 1 if the system has the type `uintptr_t'. */
-#define EVENT__HAVE_UINTPTR_T 1
+#define EVENT__HAVE_UINTPTR_T 1
/* Define to 1 if you have the `umask' function. */
-#define EVENT__HAVE_UMASK 1
+#define EVENT__HAVE_UMASK 1
/* Define to 1 if you have the <unistd.h> header file. */
-#define EVENT__HAVE_UNISTD_H 1
+#define EVENT__HAVE_UNISTD_H 1
/* Define to 1 if you have the `unsetenv' function. */
-#define EVENT__HAVE_UNSETENV 1
-
-/* Define to 1 if you have the `usleep' function. */
-#define EVENT__HAVE_USLEEP 1
+#define EVENT__HAVE_UNSETENV 1
+/* Define to 1 if you have the `usleep' function. */
+#define EVENT__HAVE_USLEEP 1
+
/* Define to 1 if you have the `vasprintf' function. */
-#define EVENT__HAVE_VASPRINTF 1
+#define EVENT__HAVE_VASPRINTF 1
/* Define if kqueue works correctly with pipes */
-/* #undef EVENT__HAVE_WORKING_KQUEUE */
+/* #undef EVENT__HAVE_WORKING_KQUEUE */
/* Define to 1 if you have the <zlib.h> header file. */
-#define EVENT__HAVE_ZLIB_H 1
+#define EVENT__HAVE_ZLIB_H 1
/* Define to 1 if you have the `_gmtime64' function. */
/* #undef EVENT__HAVE__GMTIME64 */
@@ -430,141 +430,141 @@
/* Define to 1 if you have the `_gmtime64_s' function. */
/* #undef EVENT__HAVE__GMTIME64_S */
-/* Define to 1 if compiler have __FUNCTION__ */
-#define EVENT__HAVE___FUNCTION__ 1
+/* Define to 1 if compiler have __FUNCTION__ */
+#define EVENT__HAVE___FUNCTION__ 1
-/* Define to 1 if compiler have __func__ */
-#define EVENT__HAVE___func__ 1
-
-/* Define to the sub-directory where libtool stores uninstalled libraries. */
-#define EVENT__LT_OBJDIR ".libs/"
+/* Define to 1 if compiler have __func__ */
+#define EVENT__HAVE___func__ 1
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define EVENT__LT_OBJDIR ".libs/"
+
/* Numeric representation of the version */
#define EVENT__NUMERIC_VERSION 0x02010c00
/* Name of package */
-#define EVENT__PACKAGE "libevent"
+#define EVENT__PACKAGE "libevent"
/* Define to the address where bug reports for this package should be sent. */
-#define EVENT__PACKAGE_BUGREPORT ""
+#define EVENT__PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
-#define EVENT__PACKAGE_NAME "libevent"
+#define EVENT__PACKAGE_NAME "libevent"
/* Define to the full name and version of this package. */
#define EVENT__PACKAGE_STRING "libevent 2.1.12-stable"
/* Define to the one symbol short name of this package. */
-#define EVENT__PACKAGE_TARNAME "libevent"
+#define EVENT__PACKAGE_TARNAME "libevent"
/* Define to the home page for this package. */
-#define EVENT__PACKAGE_URL ""
+#define EVENT__PACKAGE_URL ""
/* Define to the version of this package. */
#define EVENT__PACKAGE_VERSION "2.1.12-stable"
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
-/* #undef EVENT__PTHREAD_CREATE_JOINABLE */
+/* #undef EVENT__PTHREAD_CREATE_JOINABLE */
/* The size of `int', as computed by sizeof. */
-#define EVENT__SIZEOF_INT 4
+#define EVENT__SIZEOF_INT 4
/* The size of `long', as computed by sizeof. */
-#define EVENT__SIZEOF_LONG 8
+#define EVENT__SIZEOF_LONG 8
/* The size of `long long', as computed by sizeof. */
-#define EVENT__SIZEOF_LONG_LONG 8
+#define EVENT__SIZEOF_LONG_LONG 8
/* The size of `off_t', as computed by sizeof. */
-#define EVENT__SIZEOF_OFF_T 8
+#define EVENT__SIZEOF_OFF_T 8
/* The size of `pthread_t', as computed by sizeof. */
-#define EVENT__SIZEOF_PTHREAD_T 8
+#define EVENT__SIZEOF_PTHREAD_T 8
/* The size of `short', as computed by sizeof. */
-#define EVENT__SIZEOF_SHORT 2
+#define EVENT__SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */
-#define EVENT__SIZEOF_SIZE_T 8
-
-/* The size of `time_t', as computed by sizeof. */
-#define EVENT__SIZEOF_TIME_T 8
+#define EVENT__SIZEOF_SIZE_T 8
+/* The size of `time_t', as computed by sizeof. */
+#define EVENT__SIZEOF_TIME_T 8
+
/* The size of `void *', as computed by sizeof. */
-#define EVENT__SIZEOF_VOID_P 8
+#define EVENT__SIZEOF_VOID_P 8
/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
+#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#define EVENT__TIME_WITH_SYS_TIME 1
-
-/* Enable extensions on AIX 3, Interix. */
-#ifndef _ALL_SOURCE
-# define _ALL_SOURCE 1
-#endif
-/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-#endif
-/* Enable threading extensions on Solaris. */
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# define _POSIX_PTHREAD_SEMANTICS 1
-#endif
-/* Enable extensions on HP NonStop. */
-#ifndef _TANDEM_SOURCE
-# define _TANDEM_SOURCE 1
-#endif
-/* Enable general extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# define __EXTENSIONS__ 1
-#endif
-
-
+#define EVENT__TIME_WITH_SYS_TIME 1
+
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+
/* Version number of package */
#define EVENT__VERSION "2.1.12-stable"
-/* Enable large inode numbers on Mac OS X 10.5. */
-#ifndef _DARWIN_USE_64_BIT_INODE
-# define _DARWIN_USE_64_BIT_INODE 1
-#endif
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-/* #undef _FILE_OFFSET_BITS */
-
-/* Define for large files, on AIX-style hosts. */
-/* #undef _LARGE_FILES */
-
-/* Define to 1 if on MINIX. */
-/* #undef _MINIX */
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
- this defined. */
-/* #undef _POSIX_1_SOURCE */
-
-/* Define to 1 if you need to in order for `stat' and other things to work. */
-/* #undef _POSIX_SOURCE */
-
+/* Enable large inode numbers on Mac OS X 10.5. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
/* Define to empty if `const' does not conform to ANSI C. */
-/* #undef const */
+/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef __cplusplus
-/* #undef inline */
+#ifndef __cplusplus
+/* #undef inline */
#endif
/* Define to `int' if <sys/types.h> does not define. */
-/* #undef pid_t */
+/* #undef pid_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */
-/* #undef size_t */
+/* #undef size_t */
/* Define to unsigned int if you dont have it */
-/* #undef socklen_t */
+/* #undef socklen_t */
/* Define to `int' if <sys/types.h> does not define. */
-/* #undef ssize_t */
+/* #undef ssize_t */
#endif /* event2/event-config.h */
diff --git a/contrib/libs/libevent/include/event2/event-config-musl.h b/contrib/libs/libevent/include/event2/event-config-musl.h
index 7b4fabd32d..de6930948e 100644
--- a/contrib/libs/libevent/include/event2/event-config-musl.h
+++ b/contrib/libs/libevent/include/event2/event-config-musl.h
@@ -2,6 +2,6 @@
#include "event-config-linux.h"
-#undef EVENT__HAVE_DECL_CTL_KERN
-#undef EVENT__HAVE_DECL_KERN_RANDOM
-#undef EVENT__HAVE_DECL_RANDOM_UUID
+#undef EVENT__HAVE_DECL_CTL_KERN
+#undef EVENT__HAVE_DECL_KERN_RANDOM
+#undef EVENT__HAVE_DECL_RANDOM_UUID
diff --git a/contrib/libs/libevent/include/event2/event-config-osx.h b/contrib/libs/libevent/include/event2/event-config-osx.h
index 8e6c4f7ea0..1798ec2d5b 100644
--- a/contrib/libs/libevent/include/event2/event-config-osx.h
+++ b/contrib/libs/libevent/include/event2/event-config-osx.h
@@ -8,446 +8,446 @@
* Do not rely on macros in this file existing in later versions.
*/
-#ifndef _EVENT2EVENT__CONFIG_H_
-#define _EVENT2EVENT__CONFIG_H_
+#ifndef _EVENT2EVENT__CONFIG_H_
+#define _EVENT2EVENT__CONFIG_H_
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if libevent should build without support for a debug mode */
-/* #undef EVENT__DISABLE_DEBUG_MODE */
+/* #undef EVENT__DISABLE_DEBUG_MODE */
/* Define if libevent should not allow replacing the mm functions */
-/* #undef EVENT__DISABLE_MM_REPLACEMENT */
+/* #undef EVENT__DISABLE_MM_REPLACEMENT */
/* Define if libevent should not be compiled with thread support */
-/* #undef EVENT__DISABLE_THREAD_SUPPORT */
+/* #undef EVENT__DISABLE_THREAD_SUPPORT */
/* Define to 1 if you have the `arc4random' function. */
-#define EVENT__HAVE_ARC4RANDOM 1
+#define EVENT__HAVE_ARC4RANDOM 1
/* Define to 1 if you have the `arc4random_buf' function. */
-#define EVENT__HAVE_ARC4RANDOM_BUF 1
+#define EVENT__HAVE_ARC4RANDOM_BUF 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
-#define EVENT__HAVE_ARPA_INET_H 1
+#define EVENT__HAVE_ARPA_INET_H 1
/* Define to 1 if you have the `clock_gettime' function. */
-/* #undef EVENT__HAVE_CLOCK_GETTIME */
+/* #undef EVENT__HAVE_CLOCK_GETTIME */
/* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you
don't. */
-#define EVENT__HAVE_DECL_CTL_KERN 1
+#define EVENT__HAVE_DECL_CTL_KERN 1
/* Define to 1 if you have the declaration of `KERN_ARND', and to 0 if you
don't. */
-#define EVENT__HAVE_DECL_KERN_ARND 0
+#define EVENT__HAVE_DECL_KERN_ARND 0
/* Define to 1 if you have the declaration of `KERN_RANDOM', and to 0 if you
don't. */
-#define EVENT__HAVE_DECL_KERN_RANDOM 0
+#define EVENT__HAVE_DECL_KERN_RANDOM 0
/* Define to 1 if you have the declaration of `RANDOM_UUID', and to 0 if you
don't. */
-#define EVENT__HAVE_DECL_RANDOM_UUID 0
+#define EVENT__HAVE_DECL_RANDOM_UUID 0
/* Define if /dev/poll is available */
-/* #undef EVENT__HAVE_DEVPOLL */
+/* #undef EVENT__HAVE_DEVPOLL */
/* Define to 1 if you have the <dlfcn.h> header file. */
-#define EVENT__HAVE_DLFCN_H 1
+#define EVENT__HAVE_DLFCN_H 1
/* Define if your system supports the epoll system calls */
-/* #undef EVENT__HAVE_EPOLL */
+/* #undef EVENT__HAVE_EPOLL */
/* Define to 1 if you have the `epoll_ctl' function. */
-/* #undef EVENT__HAVE_EPOLL_CTL */
+/* #undef EVENT__HAVE_EPOLL_CTL */
/* Define to 1 if you have the `eventfd' function. */
-/* #undef EVENT__HAVE_EVENTFD */
+/* #undef EVENT__HAVE_EVENTFD */
/* Define if your system supports event ports */
-/* #undef EVENT__HAVE_EVENT_PORTS */
+/* #undef EVENT__HAVE_EVENT_PORTS */
/* Define to 1 if you have the `fcntl' function. */
-#define EVENT__HAVE_FCNTL 1
+#define EVENT__HAVE_FCNTL 1
/* Define to 1 if you have the <fcntl.h> header file. */
-#define EVENT__HAVE_FCNTL_H 1
+#define EVENT__HAVE_FCNTL_H 1
/* Define to 1 if the system has the type `fd_mask'. */
-#define EVENT__HAVE_FD_MASK 1
+#define EVENT__HAVE_FD_MASK 1
/* Do we have getaddrinfo()? */
-#define EVENT__HAVE_GETADDRINFO 1
+#define EVENT__HAVE_GETADDRINFO 1
/* Define to 1 if you have the `getegid' function. */
-#define EVENT__HAVE_GETEGID 1
+#define EVENT__HAVE_GETEGID 1
/* Define to 1 if you have the `geteuid' function. */
-#define EVENT__HAVE_GETEUID 1
+#define EVENT__HAVE_GETEUID 1
/* Define this if you have any gethostbyname_r() */
-/* #undef EVENT__HAVE_GETHOSTBYNAME_R */
+/* #undef EVENT__HAVE_GETHOSTBYNAME_R */
/* Define this if gethostbyname_r takes 3 arguments */
-/* #undef EVENT__HAVE_GETHOSTBYNAME_R_3_ARG */
+/* #undef EVENT__HAVE_GETHOSTBYNAME_R_3_ARG */
/* Define this if gethostbyname_r takes 5 arguments */
-/* #undef EVENT__HAVE_GETHOSTBYNAME_R_5_ARG */
+/* #undef EVENT__HAVE_GETHOSTBYNAME_R_5_ARG */
/* Define this if gethostbyname_r takes 6 arguments */
-/* #undef EVENT__HAVE_GETHOSTBYNAME_R_6_ARG */
+/* #undef EVENT__HAVE_GETHOSTBYNAME_R_6_ARG */
/* Define to 1 if you have the `getnameinfo' function. */
-#define EVENT__HAVE_GETNAMEINFO 1
+#define EVENT__HAVE_GETNAMEINFO 1
/* Define to 1 if you have the `getprotobynumber' function. */
-#define EVENT__HAVE_GETPROTOBYNUMBER 1
+#define EVENT__HAVE_GETPROTOBYNUMBER 1
/* Define to 1 if you have the `getservbyname' function. */
-/* #undef EVENT__HAVE_GETSERVBYNAME */
+/* #undef EVENT__HAVE_GETSERVBYNAME */
/* Define to 1 if you have the `gettimeofday' function. */
-#define EVENT__HAVE_GETTIMEOFDAY 1
+#define EVENT__HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the `inet_aton' function. */
-#define EVENT__HAVE_INET_ATON 1
+#define EVENT__HAVE_INET_ATON 1
/* Define to 1 if you have the `inet_ntop' function. */
-#define EVENT__HAVE_INET_NTOP 1
+#define EVENT__HAVE_INET_NTOP 1
/* Define to 1 if you have the `inet_pton' function. */
-#define EVENT__HAVE_INET_PTON 1
+#define EVENT__HAVE_INET_PTON 1
/* Define to 1 if you have the <inttypes.h> header file. */
-#define EVENT__HAVE_INTTYPES_H 1
+#define EVENT__HAVE_INTTYPES_H 1
/* Define to 1 if you have the `issetugid' function. */
-#define EVENT__HAVE_ISSETUGID 1
+#define EVENT__HAVE_ISSETUGID 1
/* Define to 1 if you have the `kqueue' function. */
-#define EVENT__HAVE_KQUEUE 1
+#define EVENT__HAVE_KQUEUE 1
/* Define if the system has zlib */
-#define EVENT__HAVE_LIBZ 1
+#define EVENT__HAVE_LIBZ 1
/* Define to 1 if you have the <memory.h> header file. */
-#define EVENT__HAVE_MEMORY_H 1
+#define EVENT__HAVE_MEMORY_H 1
/* Define to 1 if you have the `mmap' function. */
-#define EVENT__HAVE_MMAP 1
+#define EVENT__HAVE_MMAP 1
/* Define to 1 if you have the <netdb.h> header file. */
-#define EVENT__HAVE_NETDB_H 1
+#define EVENT__HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in6.h> header file. */
-/* #undef EVENT__HAVE_NETINET_IN6_H */
+/* #undef EVENT__HAVE_NETINET_IN6_H */
/* Define to 1 if you have the <netinet/in.h> header file. */
-#define EVENT__HAVE_NETINET_IN_H 1
+#define EVENT__HAVE_NETINET_IN_H 1
/* Define if the system has openssl */
-#define EVENT__HAVE_OPENSSL 1
+#define EVENT__HAVE_OPENSSL 1
/* Define to 1 if you have the <openssl/bio.h> header file. */
-#define EVENT__HAVE_OPENSSL_BIO_H 1
+#define EVENT__HAVE_OPENSSL_BIO_H 1
/* Define to 1 if you have the `pipe' function. */
-#define EVENT__HAVE_PIPE 1
+#define EVENT__HAVE_PIPE 1
/* Define to 1 if you have the `poll' function. */
-#define EVENT__HAVE_POLL 1
+#define EVENT__HAVE_POLL 1
/* Define to 1 if you have the <poll.h> header file. */
-#define EVENT__HAVE_POLL_H 1
+#define EVENT__HAVE_POLL_H 1
/* Define to 1 if you have the `port_create' function. */
-/* #undef EVENT__HAVE_PORT_CREATE */
+/* #undef EVENT__HAVE_PORT_CREATE */
/* Define to 1 if you have the <port.h> header file. */
-/* #undef EVENT__HAVE_PORT_H */
+/* #undef EVENT__HAVE_PORT_H */
/* Define if you have POSIX threads libraries and header files. */
-/* #undef EVENT__HAVE_PTHREAD */
+/* #undef EVENT__HAVE_PTHREAD */
/* Define if we have pthreads on this system */
-#define EVENT__HAVE_PTHREADS 1
+#define EVENT__HAVE_PTHREADS 1
/* Define to 1 if you have the `putenv' function. */
-#define EVENT__HAVE_PUTENV 1
+#define EVENT__HAVE_PUTENV 1
/* Define to 1 if the system has the type `sa_family_t'. */
-#define EVENT__HAVE_SA_FAMILY_T 1
+#define EVENT__HAVE_SA_FAMILY_T 1
/* Define to 1 if you have the `select' function. */
-#define EVENT__HAVE_SELECT 1
+#define EVENT__HAVE_SELECT 1
/* Define to 1 if you have the `sendfile' function. */
-#define EVENT__HAVE_SENDFILE 1
+#define EVENT__HAVE_SENDFILE 1
/* Define to 1 if you have the `setenv' function. */
-#define EVENT__HAVE_SETENV 1
+#define EVENT__HAVE_SETENV 1
/* Define if F_SETFD is defined in <fcntl.h> */
-#define EVENT__HAVE_SETFD 1
+#define EVENT__HAVE_SETFD 1
/* Define to 1 if you have the `sigaction' function. */
-#define EVENT__HAVE_SIGACTION 1
+#define EVENT__HAVE_SIGACTION 1
/* Define to 1 if you have the `signal' function. */
-#define EVENT__HAVE_SIGNAL 1
+#define EVENT__HAVE_SIGNAL 1
/* Define to 1 if you have the `splice' function. */
-/* #undef EVENT__HAVE_SPLICE */
+/* #undef EVENT__HAVE_SPLICE */
/* Define to 1 if you have the <stdarg.h> header file. */
-#define EVENT__HAVE_STDARG_H 1
+#define EVENT__HAVE_STDARG_H 1
/* Define to 1 if you have the <stddef.h> header file. */
-#define EVENT__HAVE_STDDEF_H 1
+#define EVENT__HAVE_STDDEF_H 1
/* Define to 1 if you have the <stdint.h> header file. */
-#define EVENT__HAVE_STDINT_H 1
+#define EVENT__HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
-#define EVENT__HAVE_STDLIB_H 1
+#define EVENT__HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
-#define EVENT__HAVE_STRINGS_H 1
+#define EVENT__HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
-#define EVENT__HAVE_STRING_H 1
+#define EVENT__HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */
-#define EVENT__HAVE_STRLCPY 1
+#define EVENT__HAVE_STRLCPY 1
/* Define to 1 if you have the `strsep' function. */
-#define EVENT__HAVE_STRSEP 1
+#define EVENT__HAVE_STRSEP 1
/* Define to 1 if you have the `strtok_r' function. */
-#define EVENT__HAVE_STRTOK_R 1
+#define EVENT__HAVE_STRTOK_R 1
/* Define to 1 if you have the `strtoll' function. */
-#define EVENT__HAVE_STRTOLL 1
+#define EVENT__HAVE_STRTOLL 1
/* Define to 1 if the system has the type `struct addrinfo'. */
-#define EVENT__HAVE_STRUCT_ADDRINFO 1
+#define EVENT__HAVE_STRUCT_ADDRINFO 1
/* Define to 1 if the system has the type `struct in6_addr'. */
-#define EVENT__HAVE_STRUCT_IN6_ADDR 1
+#define EVENT__HAVE_STRUCT_IN6_ADDR 1
/* Define to 1 if `s6_addr16' is a member of `struct in6_addr'. */
-/* #undef EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16 */
+/* #undef EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16 */
/* Define to 1 if `s6_addr32' is a member of `struct in6_addr'. */
-/* #undef EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32 */
+/* #undef EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32 */
/* Define to 1 if the system has the type `struct sockaddr_in6'. */
-#define EVENT__HAVE_STRUCT_SOCKADDR_IN6 1
+#define EVENT__HAVE_STRUCT_SOCKADDR_IN6 1
/* Define to 1 if `sin6_len' is a member of `struct sockaddr_in6'. */
-#define EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN 1
+#define EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN 1
/* Define to 1 if `sin_len' is a member of `struct sockaddr_in'. */
-#define EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1
+#define EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
-#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE 1
+#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE 1
/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */
-#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
+#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */
-/* #undef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */
+/* #undef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */
/* Define to 1 if you have the `sysctl' function. */
-#define EVENT__HAVE_SYSCTL 1
+#define EVENT__HAVE_SYSCTL 1
/* Define to 1 if you have the <sys/devpoll.h> header file. */
-/* #undef EVENT__HAVE_SYS_DEVPOLL_H */
+/* #undef EVENT__HAVE_SYS_DEVPOLL_H */
/* Define to 1 if you have the <sys/epoll.h> header file. */
-/* #undef EVENT__HAVE_SYS_EPOLL_H */
+/* #undef EVENT__HAVE_SYS_EPOLL_H */
/* Define to 1 if you have the <sys/eventfd.h> header file. */
-/* #undef EVENT__HAVE_SYS_EVENTFD_H */
+/* #undef EVENT__HAVE_SYS_EVENTFD_H */
/* Define to 1 if you have the <sys/event.h> header file. */
-#define EVENT__HAVE_SYS_EVENT_H 1
+#define EVENT__HAVE_SYS_EVENT_H 1
/* Define to 1 if you have the <sys/ioctl.h> header file. */
-#define EVENT__HAVE_SYS_IOCTL_H 1
+#define EVENT__HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/mman.h> header file. */
-#define EVENT__HAVE_SYS_MMAN_H 1
+#define EVENT__HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
-#define EVENT__HAVE_SYS_PARAM_H 1
+#define EVENT__HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/queue.h> header file. */
-#define EVENT__HAVE_SYS_QUEUE_H 1
+#define EVENT__HAVE_SYS_QUEUE_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
-#define EVENT__HAVE_SYS_SELECT_H 1
+#define EVENT__HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/sendfile.h> header file. */
-/* #undef EVENT__HAVE_SYS_SENDFILE_H */
+/* #undef EVENT__HAVE_SYS_SENDFILE_H */
/* Define to 1 if you have the <sys/socket.h> header file. */
-#define EVENT__HAVE_SYS_SOCKET_H 1
+#define EVENT__HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
-#define EVENT__HAVE_SYS_STAT_H 1
+#define EVENT__HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysctl.h> header file. */
-#define EVENT__HAVE_SYS_SYSCTL_H 1
+#define EVENT__HAVE_SYS_SYSCTL_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
-#define EVENT__HAVE_SYS_TIME_H 1
+#define EVENT__HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
-#define EVENT__HAVE_SYS_TYPES_H 1
+#define EVENT__HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
-#define EVENT__HAVE_SYS_UIO_H 1
+#define EVENT__HAVE_SYS_UIO_H 1
/* Define to 1 if you have the <sys/wait.h> header file. */
-#define EVENT__HAVE_SYS_WAIT_H 1
+#define EVENT__HAVE_SYS_WAIT_H 1
/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
-#define EVENT__HAVE_TAILQFOREACH 1
+#define EVENT__HAVE_TAILQFOREACH 1
/* Define if timeradd is defined in <sys/time.h> */
-#define EVENT__HAVE_TIMERADD 1
+#define EVENT__HAVE_TIMERADD 1
/* Define if timerclear is defined in <sys/time.h> */
-#define EVENT__HAVE_TIMERCLEAR 1
+#define EVENT__HAVE_TIMERCLEAR 1
/* Define if timercmp is defined in <sys/time.h> */
-#define EVENT__HAVE_TIMERCMP 1
+#define EVENT__HAVE_TIMERCMP 1
/* Define if timerisset is defined in <sys/time.h> */
-#define EVENT__HAVE_TIMERISSET 1
+#define EVENT__HAVE_TIMERISSET 1
/* Define to 1 if the system has the type `uint16_t'. */
-#define EVENT__HAVE_UINT16_T 1
+#define EVENT__HAVE_UINT16_T 1
/* Define to 1 if the system has the type `uint32_t'. */
-#define EVENT__HAVE_UINT32_T 1
+#define EVENT__HAVE_UINT32_T 1
/* Define to 1 if the system has the type `uint64_t'. */
-#define EVENT__HAVE_UINT64_T 1
+#define EVENT__HAVE_UINT64_T 1
/* Define to 1 if the system has the type `uint8_t'. */
-#define EVENT__HAVE_UINT8_T 1
+#define EVENT__HAVE_UINT8_T 1
/* Define to 1 if the system has the type `uintptr_t'. */
-#define EVENT__HAVE_UINTPTR_T 1
+#define EVENT__HAVE_UINTPTR_T 1
/* Define to 1 if you have the `umask' function. */
-#define EVENT__HAVE_UMASK 1
+#define EVENT__HAVE_UMASK 1
/* Define to 1 if you have the <unistd.h> header file. */
-#define EVENT__HAVE_UNISTD_H 1
+#define EVENT__HAVE_UNISTD_H 1
/* Define to 1 if you have the `unsetenv' function. */
-#define EVENT__HAVE_UNSETENV 1
+#define EVENT__HAVE_UNSETENV 1
/* Define to 1 if you have the `vasprintf' function. */
-#define EVENT__HAVE_VASPRINTF 1
+#define EVENT__HAVE_VASPRINTF 1
/* Define if kqueue works correctly with pipes */
-#define EVENT__HAVE_WORKING_KQUEUE 1
+#define EVENT__HAVE_WORKING_KQUEUE 1
/* Define to 1 if you have the <zlib.h> header file. */
-#define EVENT__HAVE_ZLIB_H 1
+#define EVENT__HAVE_ZLIB_H 1
/* Define to the sub-directory where libtool stores uninstalled libraries. */
-#define EVENT__LT_OBJDIR ".libs/"
+#define EVENT__LT_OBJDIR ".libs/"
/* Numeric representation of the version */
#define EVENT__NUMERIC_VERSION 0x02010c00
/* Name of package */
-#define EVENT__PACKAGE "libevent"
+#define EVENT__PACKAGE "libevent"
/* Define to the address where bug reports for this package should be sent. */
-#define EVENT__PACKAGE_BUGREPORT ""
+#define EVENT__PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
-#define EVENT__PACKAGE_NAME ""
+#define EVENT__PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define EVENT__PACKAGE_STRING "libevent 2.1.12-stable"
/* Define to the one symbol short name of this package. */
-#define EVENT__PACKAGE_TARNAME ""
+#define EVENT__PACKAGE_TARNAME ""
/* Define to the home page for this package. */
-#define EVENT__PACKAGE_URL ""
+#define EVENT__PACKAGE_URL ""
/* Define to the version of this package. */
#define EVENT__PACKAGE_VERSION "2.1.12-stable"
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
-/* #undef EVENT__PTHREAD_CREATE_JOINABLE */
+/* #undef EVENT__PTHREAD_CREATE_JOINABLE */
/* The size of `int', as computed by sizeof. */
-#define EVENT__SIZEOF_INT 4
+#define EVENT__SIZEOF_INT 4
/* The size of `long', as computed by sizeof. */
-#define EVENT__SIZEOF_LONG 8
+#define EVENT__SIZEOF_LONG 8
/* The size of `long long', as computed by sizeof. */
-#define EVENT__SIZEOF_LONG_LONG 8
+#define EVENT__SIZEOF_LONG_LONG 8
/* The size of `off_t', as computed by sizeof. */
-#define EVENT__SIZEOF_OFF_T 8
+#define EVENT__SIZEOF_OFF_T 8
/* The size of `pthread_t', as computed by sizeof. */
-#define EVENT__SIZEOF_PTHREAD_T 8
+#define EVENT__SIZEOF_PTHREAD_T 8
/* The size of `short', as computed by sizeof. */
-#define EVENT__SIZEOF_SHORT 2
+#define EVENT__SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */
-#define EVENT__SIZEOF_SIZE_T 8
+#define EVENT__SIZEOF_SIZE_T 8
/* The size of `void *', as computed by sizeof. */
-#define EVENT__SIZEOF_VOID_P 8
+#define EVENT__SIZEOF_VOID_P 8
/* Define to 1 if you have the ANSI C header files. */
-#define EVENT__STDC_HEADERS 1
+#define EVENT__STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#define EVENT__TIME_WITH_SYS_TIME 1
+#define EVENT__TIME_WITH_SYS_TIME 1
/* Version number of package */
#define EVENT__VERSION "2.1.12-stable"
/* Define to appropriate substitue if compiler doesnt have __func__ */
-/* #undef EVENT____func__ */
+/* #undef EVENT____func__ */
/* Define to empty if `const' does not conform to ANSI C. */
-/* #undef EVENT__const */
+/* #undef EVENT__const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef EVENT____cplusplus
-/* #undef EVENT__inline */
+#ifndef EVENT____cplusplus
+/* #undef EVENT__inline */
#endif
/* Define to `int' if <sys/types.h> does not define. */
-/* #undef EVENT__pid_t */
+/* #undef EVENT__pid_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */
-/* #undef EVENT__size_t */
+/* #undef EVENT__size_t */
/* Define to unsigned int if you dont have it */
-/* #undef EVENT__socklen_t */
+/* #undef EVENT__socklen_t */
/* Define to `int' if <sys/types.h> does not define. */
-/* #undef EVENT__ssize_t */
+/* #undef EVENT__ssize_t */
#endif /* event2/event-config.h */
diff --git a/contrib/libs/libevent/include/event2/event-config-win.h b/contrib/libs/libevent/include/event2/event-config-win.h
index ef4141a720..5175bb0ad6 100644
--- a/contrib/libs/libevent/include/event2/event-config-win.h
+++ b/contrib/libs/libevent/include/event2/event-config-win.h
@@ -7,357 +7,357 @@
*
* Do not rely on macros in this file existing in later versions.
*/
-#ifndef EVENT__CONFIG_H_
-#define EVENT__CONFIG_H_
+#ifndef EVENT__CONFIG_H_
+#define EVENT__CONFIG_H_
/* config.h. Generated by configure. */
/* config.h.in. Generated from configure.in by autoheader. */
/* Define if libevent should not allow replacing the mm functions */
-/* #undef EVENT__DISABLE_MM_REPLACEMENT */
+/* #undef EVENT__DISABLE_MM_REPLACEMENT */
/* Define if libevent should not be compiled with thread support */
-/* #undef EVENT__DISABLE_THREAD_SUPPORT */
+/* #undef EVENT__DISABLE_THREAD_SUPPORT */
/* Define if clock_gettime is available in libc */
-/* #undef EVENT__DNS_USE_CPU_CLOCK_FOR_ID */
+/* #undef EVENT__DNS_USE_CPU_CLOCK_FOR_ID */
/* Define is no secure id variant is available */
-/* #define EVENT__DNS_USE_GETTIMEOFDAY_FOR_ID 1 */
-#define EVENT__DNS_USE_FTIME_FOR_ID 1
+/* #define EVENT__DNS_USE_GETTIMEOFDAY_FOR_ID 1 */
+#define EVENT__DNS_USE_FTIME_FOR_ID 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
-/* #undef EVENT__HAVE_ARPA_INET_H */
+/* #undef EVENT__HAVE_ARPA_INET_H */
/* Define to 1 if you have the `clock_gettime' function. */
-/* #undef EVENT__HAVE_CLOCK_GETTIME */
+/* #undef EVENT__HAVE_CLOCK_GETTIME */
/* Define if /dev/poll is available */
-/* #undef EVENT__HAVE_DEVPOLL */
+/* #undef EVENT__HAVE_DEVPOLL */
/* Define to 1 if you have the <dlfcn.h> header file. */
-/* #undef EVENT__HAVE_DLFCN_H */
+/* #undef EVENT__HAVE_DLFCN_H */
/* Define if your system supports the epoll system calls */
-/* #undef EVENT__HAVE_EPOLL */
+/* #undef EVENT__HAVE_EPOLL */
/* Define to 1 if you have the `epoll_ctl' function. */
-/* #undef EVENT__HAVE_EPOLL_CTL */
+/* #undef EVENT__HAVE_EPOLL_CTL */
/* Define to 1 if you have the `eventfd' function. */
-/* #undef EVENT__HAVE_EVENTFD */
+/* #undef EVENT__HAVE_EVENTFD */
/* Define if your system supports event ports */
-/* #undef EVENT__HAVE_EVENT_PORTS */
+/* #undef EVENT__HAVE_EVENT_PORTS */
/* Define to 1 if you have the `fcntl' function. */
-/* #undef EVENT__HAVE_FCNTL */
+/* #undef EVENT__HAVE_FCNTL */
/* Define to 1 if you have the <fcntl.h> header file. */
-#define EVENT__HAVE_FCNTL_H 1
+#define EVENT__HAVE_FCNTL_H 1
/* Define to 1 if you have the `getaddrinfo' function. */
-#define EVENT__HAVE_GETADDRINFO 1
+#define EVENT__HAVE_GETADDRINFO 1
/* Define to 1 if you have the `getnameinfo' function. */
-#define EVENT__HAVE_GETNAMEINFO 1
+#define EVENT__HAVE_GETNAMEINFO 1
/* Define to 1 if you have the `getprotobynumber' function. */
-#define EVENT__HAVE_GETPROTOBYNUMBER 1
+#define EVENT__HAVE_GETPROTOBYNUMBER 1
/* Define to 1 if you have the `getservbyname' function. */
-#define EVENT__HAVE_GETSERVBYNAME 1
+#define EVENT__HAVE_GETSERVBYNAME 1
/* Define to 1 if you have the `gettimeofday' function. */
-/* #define EVENT__HAVE_GETTIMEOFDAY 1 */
+/* #define EVENT__HAVE_GETTIMEOFDAY 1 */
/* Define to 1 if you have the `inet_aton' function. */
-/* #undef EVENT__HAVE_INET_ATON */
+/* #undef EVENT__HAVE_INET_ATON */
/* Define to 1 if you have the `inet_ntop' function. */
-/* #undef EVENT__HAVE_INET_NTOP */
+/* #undef EVENT__HAVE_INET_NTOP */
/* Define to 1 if you have the `inet_pton' function. */
-/* #undef EVENT__HAVE_INET_PTON */
+/* #undef EVENT__HAVE_INET_PTON */
/* Define to 1 if you have the <inttypes.h> header file. */
-/* #define EVENT__HAVE_INTTYPES_H 1 */
+/* #define EVENT__HAVE_INTTYPES_H 1 */
/* Define to 1 if you have the `kqueue' function. */
-/* #undef EVENT__HAVE_KQUEUE */
+/* #undef EVENT__HAVE_KQUEUE */
/* Define if the system has zlib */
-/* #undef EVENT__HAVE_LIBZ */
+/* #undef EVENT__HAVE_LIBZ */
/* Define to 1 if you have the <memory.h> header file. */
-#define EVENT__HAVE_MEMORY_H 1
+#define EVENT__HAVE_MEMORY_H 1
/* Define to 1 if you have the `mmap' function. */
-/* #undef EVENT__HAVE_MMAP */
+/* #undef EVENT__HAVE_MMAP */
/* Define to 1 if you have the <netinet/in6.h> header file. */
-/* #undef EVENT__HAVE_NETINET_IN6_H */
+/* #undef EVENT__HAVE_NETINET_IN6_H */
/* Define to 1 if you have the <netinet/in.h> header file. */
-/* #undef EVENT__HAVE_NETINET_IN_H */
+/* #undef EVENT__HAVE_NETINET_IN_H */
/* Define to 1 if you have the `pipe' function. */
-/* #undef EVENT__HAVE_PIPE */
+/* #undef EVENT__HAVE_PIPE */
/* Define to 1 if you have the `poll' function. */
-/* #undef EVENT__HAVE_POLL */
+/* #undef EVENT__HAVE_POLL */
/* Define to 1 if you have the <poll.h> header file. */
-/* #undef EVENT__HAVE_POLL_H */
+/* #undef EVENT__HAVE_POLL_H */
/* Define to 1 if you have the `port_create' function. */
-/* #undef EVENT__HAVE_PORT_CREATE */
+/* #undef EVENT__HAVE_PORT_CREATE */
/* Define to 1 if you have the <port.h> header file. */
-/* #undef EVENT__HAVE_PORT_H */
+/* #undef EVENT__HAVE_PORT_H */
/* Define if you have POSIX threads libraries and header files. */
-/* #undef EVENT__HAVE_PTHREAD */
+/* #undef EVENT__HAVE_PTHREAD */
/* Define if we have pthreads on this system */
-/* #undef EVENT__HAVE_PTHREADS */
+/* #undef EVENT__HAVE_PTHREADS */
/* Define to 1 if the system has the type `sa_family_t'. */
-/* #undef EVENT__HAVE_SA_FAMILY_T */
+/* #undef EVENT__HAVE_SA_FAMILY_T */
/* Define to 1 if you have the `select' function. */
-/* #undef EVENT__HAVE_SELECT */
+/* #undef EVENT__HAVE_SELECT */
/* Define to 1 if you have the `sendfile' function. */
-/* #undef EVENT__HAVE_SENDFILE */
+/* #undef EVENT__HAVE_SENDFILE */
/* Define if F_SETFD is defined in <fcntl.h> */
-/* #undef EVENT__HAVE_SETFD */
+/* #undef EVENT__HAVE_SETFD */
/* Define to 1 if you have the `sigaction' function. */
-/* #undef EVENT__HAVE_SIGACTION */
+/* #undef EVENT__HAVE_SIGACTION */
/* Define to 1 if you have the `signal' function. */
-#define EVENT__HAVE_SIGNAL 1
+#define EVENT__HAVE_SIGNAL 1
/* Define to 1 if you have the `splice' function. */
-/* #undef EVENT__HAVE_SPLICE */
+/* #undef EVENT__HAVE_SPLICE */
/* Define to 1 if you have the <stdarg.h> header file. */
-#define EVENT__HAVE_STDARG_H 1
+#define EVENT__HAVE_STDARG_H 1
/* Define to 1 if you have the <stddef.h> header file. */
-#define EVENT__HAVE_STDDEF_H 1
+#define EVENT__HAVE_STDDEF_H 1
/* Define to 1 if you have the <stdint.h> header file. */
-#define EVENT__HAVE_STDINT_H 1
+#define EVENT__HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
-#define EVENT__HAVE_STDLIB_H 1
+#define EVENT__HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
-#define EVENT__HAVE_STRINGS_H 1
+#define EVENT__HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
-#define EVENT__HAVE_STRING_H 1
+#define EVENT__HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */
-#define EVENT__HAVE_STRLCPY 1
+#define EVENT__HAVE_STRLCPY 1
/* Define to 1 if you have the `strsep' function. */
-/* #undef EVENT__HAVE_STRSEP */
+/* #undef EVENT__HAVE_STRSEP */
/* Define to 1 if you have the `strtok_r' function. */
-/* #undef EVENT__HAVE_STRTOK_R */
+/* #undef EVENT__HAVE_STRTOK_R */
/* Define to 1 if you have the `strtoll' function. */
-/* #define EVENT__HAVE_STRTOLL 1 */
+/* #define EVENT__HAVE_STRTOLL 1 */
-#define EVENT__HAVE_STRUCT_ADDRINFO 1
+#define EVENT__HAVE_STRUCT_ADDRINFO 1
/* Define to 1 if the system has the type `struct in6_addr'. */
-#define EVENT__HAVE_STRUCT_IN6_ADDR 1
+#define EVENT__HAVE_STRUCT_IN6_ADDR 1
/* Define to 1 if `s6_addr16' is member of `struct in6_addr'. */
-#define EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16 1
+#define EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16 1
/* Define to 1 if `s6_addr32' is member of `struct in6_addr'. */
-#define EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32 1
+#define EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32 1
/* Define to 1 if the system has the type `struct sockaddr_in6'. */
-#define EVENT__HAVE_STRUCT_SOCKADDR_IN6 1
+#define EVENT__HAVE_STRUCT_SOCKADDR_IN6 1
/* Define to 1 if `sin6_len' is member of `struct sockaddr_in6'. */
-/* #undef EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN */
+/* #undef EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN */
/* Define to 1 if `sin_len' is member of `struct sockaddr_in'. */
-/* #undef EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
+/* #undef EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
-#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE 1
+#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE 1
/* Define to 1 if you have the <sys/devpoll.h> header file. */
-/* #undef EVENT__HAVE_SYS_DEVPOLL_H */
+/* #undef EVENT__HAVE_SYS_DEVPOLL_H */
/* Define to 1 if you have the <sys/epoll.h> header file. */
-/* #undef EVENT__HAVE_SYS_EPOLL_H */
+/* #undef EVENT__HAVE_SYS_EPOLL_H */
/* Define to 1 if you have the <sys/eventfd.h> header file. */
-/* #undef EVENT__HAVE_SYS_EVENTFD_H */
+/* #undef EVENT__HAVE_SYS_EVENTFD_H */
/* Define to 1 if you have the <sys/event.h> header file. */
-/* #undef EVENT__HAVE_SYS_EVENT_H */
+/* #undef EVENT__HAVE_SYS_EVENT_H */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
-/* #undef EVENT__HAVE_SYS_IOCTL_H */
+/* #undef EVENT__HAVE_SYS_IOCTL_H */
/* Define to 1 if you have the <sys/mman.h> header file. */
-/* #undef EVENT__HAVE_SYS_MMAN_H */
+/* #undef EVENT__HAVE_SYS_MMAN_H */
/* Define to 1 if you have the <sys/param.h> header file. */
-/* #define EVENT__HAVE_SYS_PARAM_H 1 */
+/* #define EVENT__HAVE_SYS_PARAM_H 1 */
/* Define to 1 if you have the <sys/queue.h> header file. */
-/* #undef EVENT__HAVE_SYS_QUEUE_H */
+/* #undef EVENT__HAVE_SYS_QUEUE_H */
/* Define to 1 if you have the <sys/select.h> header file. */
-/* #undef EVENT__HAVE_SYS_SELECT_H */
+/* #undef EVENT__HAVE_SYS_SELECT_H */
/* Define to 1 if you have the <sys/sendfile.h> header file. */
-/* #undef EVENT__HAVE_SYS_SENDFILE_H */
+/* #undef EVENT__HAVE_SYS_SENDFILE_H */
/* Define to 1 if you have the <sys/socket.h> header file. */
-/* #undef EVENT__HAVE_SYS_SOCKET_H */
+/* #undef EVENT__HAVE_SYS_SOCKET_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
-#define EVENT__HAVE_SYS_STAT_H 1
+#define EVENT__HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
-/* #define EVENT__HAVE_SYS_TIME_H 1 */
+/* #define EVENT__HAVE_SYS_TIME_H 1 */
/* Define to 1 if you have the <sys/types.h> header file. */
-#define EVENT__HAVE_SYS_TYPES_H 1
+#define EVENT__HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
-/* #undef EVENT__HAVE_SYS_UIO_H */
+/* #undef EVENT__HAVE_SYS_UIO_H */
/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
-/* #undef EVENT__HAVE_TAILQFOREACH */
+/* #undef EVENT__HAVE_TAILQFOREACH */
/* Define if timeradd is defined in <sys/time.h> */
-/* #undef EVENT__HAVE_TIMERADD */
+/* #undef EVENT__HAVE_TIMERADD */
/* Define if timerclear is defined in <sys/time.h> */
-#define EVENT__HAVE_TIMERCLEAR 1
+#define EVENT__HAVE_TIMERCLEAR 1
/* Define if timercmp is defined in <sys/time.h> */
-#define EVENT__HAVE_TIMERCMP 1
+#define EVENT__HAVE_TIMERCMP 1
/* Define if timerisset is defined in <sys/time.h> */
-#define EVENT__HAVE_TIMERISSET 1
+#define EVENT__HAVE_TIMERISSET 1
/* Define to 1 if the system has the type `uint16_t'. */
-/* #define EVENT__HAVE_UINT16_T 1 */
+/* #define EVENT__HAVE_UINT16_T 1 */
/* Define to 1 if the system has the type `uint32_t'. */
-/* #define EVENT__HAVE_UINT32_T 1 */
+/* #define EVENT__HAVE_UINT32_T 1 */
/* Define to 1 if the system has the type `uint64_t'. */
-/* #define EVENT__HAVE_UINT64_T 1 */
+/* #define EVENT__HAVE_UINT64_T 1 */
/* Define to 1 if the system has the type `uint8_t'. */
-/* #define EVENT__HAVE_UINT8_T 1 */
+/* #define EVENT__HAVE_UINT8_T 1 */
/* Define to 1 if you have the <unistd.h> header file. */
-/* #define EVENT__HAVE_UNISTD_H 1 */
+/* #define EVENT__HAVE_UNISTD_H 1 */
/* Define to 1 if you have the `vasprintf' function. */
-/* #undef EVENT__HAVE_VASPRINTF */
+/* #undef EVENT__HAVE_VASPRINTF */
/* Define if kqueue works correctly with pipes */
-/* #undef EVENT__HAVE_WORKING_KQUEUE */
+/* #undef EVENT__HAVE_WORKING_KQUEUE */
/* Numeric representation of the version */
#define EVENT__NUMERIC_VERSION 0x02010c00
/* Name of package */
-#define EVENT__PACKAGE "libevent"
+#define EVENT__PACKAGE "libevent"
/* Define to the address where bug reports for this package should be sent. */
-#define EVENT__PACKAGE_BUGREPORT ""
+#define EVENT__PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
-#define EVENT__PACKAGE_NAME ""
+#define EVENT__PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define EVENT__PACKAGE_STRING "libevent 2.1.12-stable"
/* Define to the one symbol short name of this package. */
-#define EVENT__PACKAGE_TARNAME ""
+#define EVENT__PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define EVENT__PACKAGE_VERSION "2.1.12-stable"
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
-/* #undef EVENT__PTHREAD_CREATE_JOINABLE */
+/* #undef EVENT__PTHREAD_CREATE_JOINABLE */
/* The size of a `int', as computed by sizeof. */
-#define EVENT__SIZEOF_INT 4
+#define EVENT__SIZEOF_INT 4
/* The size of a `long', as computed by sizeof. */
-#define EVENT__SIZEOF_LONG 4
+#define EVENT__SIZEOF_LONG 4
/* The size of a `long long', as computed by sizeof. */
-#define EVENT__SIZEOF_LONG_LONG 8
+#define EVENT__SIZEOF_LONG_LONG 8
/* The size of a `short', as computed by sizeof. */
-#define EVENT__SIZEOF_SHORT 2
+#define EVENT__SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */
#ifdef _WIN64
-#define EVENT__SIZEOF_SIZE_T 8
+#define EVENT__SIZEOF_SIZE_T 8
#else
-#define EVENT__SIZEOF_SIZE_T 4
+#define EVENT__SIZEOF_SIZE_T 4
#endif
/* The size of `void *', as computed by sizeof. */
#ifdef _WIN64
-#define EVENT__SIZEOF_VOID_P 8
+#define EVENT__SIZEOF_VOID_P 8
#else
-#define EVENT__SIZEOF_VOID_P 4
+#define EVENT__SIZEOF_VOID_P 4
#endif
/* Define to 1 if you have the ANSI C header files. */
-#define EVENT__STDC_HEADERS 1
+#define EVENT__STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#define EVENT__TIME_WITH_SYS_TIME 1
+#define EVENT__TIME_WITH_SYS_TIME 1
/* Version number of package */
#define EVENT__VERSION "2.1.12-stable"
/* Define to appropriate substitue if compiler doesnt have __func__ */
-#define EVENT____func__ __FUNCTION__
+#define EVENT____func__ __FUNCTION__
/* Define to empty if `const' does not conform to ANSI C. */
-/* #undef EVENT__const */
+/* #undef EVENT__const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef EVENT____cplusplus
-#define EVENT__inline __inline
+#ifndef EVENT____cplusplus
+#define EVENT__inline __inline
#endif
/* Define to `int' if <sys/types.h> does not define. */
-/* #undef EVENT__pid_t */
+/* #undef EVENT__pid_t */
/* Define to `unsigned' if <sys/types.h> does not define. */
-/* #undef EVENT__size_t */
+/* #undef EVENT__size_t */
/* Define to unsigned int if you dont have it */
-#define EVENT__socklen_t unsigned int
+#define EVENT__socklen_t unsigned int
/* Define to `int' if <sys/types.h> does not define. */
-#define EVENT__ssize_t SSIZE_T
+#define EVENT__ssize_t SSIZE_T
#endif
diff --git a/contrib/libs/libevent/include/event2/event-config.h b/contrib/libs/libevent/include/event2/event-config.h
index 8a6043c9ba..44473fab49 100644
--- a/contrib/libs/libevent/include/event2/event-config.h
+++ b/contrib/libs/libevent/include/event2/event-config.h
@@ -1,13 +1,13 @@
#pragma once
-#if defined(__APPLE__)
+#if defined(__APPLE__)
# include "event-config-osx.h"
#elif defined(_MSC_VER)
# include "event-config-win.h"
#else
# include "event-config-linux.h"
-#endif
-
+#endif
+
#if defined(_musl_)
# include "event-config-musl.h"
#endif
diff --git a/contrib/libs/libevent/include/event2/event.h b/contrib/libs/libevent/include/event2/event.h
index a6b6144a92..c432250a24 100644
--- a/contrib/libs/libevent/include/event2/event.h
+++ b/contrib/libs/libevent/include/event2/event.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_EVENT_H_INCLUDED_
-#define EVENT2_EVENT_H_INCLUDED_
+#ifndef EVENT2_EVENT_H_INCLUDED_
+#define EVENT2_EVENT_H_INCLUDED_
/**
@mainpage
@@ -39,7 +39,7 @@
to signals or regular timeouts.
Libevent is meant to replace the event loop found in event driven network
- servers. An application just needs to call event_base_dispatch() and then add or
+ servers. An application just needs to call event_base_dispatch() and then add or
remove events dynamically without having to change the event loop.
@@ -54,7 +54,7 @@
@section usage Standard usage
- Every program that uses Libevent must include the <event2/event.h>
+ Every program that uses Libevent must include the <event2/event.h>
header, and pass the -levent flag to the linker. (You can instead link
-levent_core if you only want the main event and buffered IO-based code,
and don't want to link any protocol code.)
@@ -90,7 +90,7 @@
remain allocated as long as it is active, so it should generally be
allocated on the heap.
- @section loop Dispatching events.
+ @section loop Dispatching events.
Finally, you call event_base_dispatch() to loop and dispatch events.
You can also use event_base_loop() for more fine-grained control.
@@ -124,11 +124,11 @@
@section timers Timers
Libevent can also be used to create timers that invoke a callback after a
- certain amount of time has expired. The evtimer_new() macro returns
+ certain amount of time has expired. The evtimer_new() macro returns
an event struct to use as a timer. To activate the timer, call
evtimer_add(). Timers can be deactivated by calling evtimer_del().
- (These macros are thin wrappers around event_new(), event_add(),
- and event_del(); you can also use those instead.)
+ (These macros are thin wrappers around event_new(), event_add(),
+ and event_del(); you can also use those instead.)
@section evdns Asynchronous DNS resolution
@@ -182,17 +182,17 @@
Core functions for waiting for and receiving events, and using event bases.
*/
-#include <event2/visibility.h>
-
+#include <event2/visibility.h>
+
#ifdef __cplusplus
extern "C" {
#endif
#include <event2/event-config.h>
-#ifdef EVENT__HAVE_SYS_TYPES_H
+#ifdef EVENT__HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -215,7 +215,7 @@ extern "C" {
* event_base_new_with_config()
*/
struct event_base
-#ifdef EVENT_IN_DOXYGEN_
+#ifdef EVENT_IN_DOXYGEN_
{/*Empty body so that doxygen will generate documentation here.*/}
#endif
;
@@ -232,7 +232,7 @@ struct event_base
*
* Generally, you can create events with event_new(), then make them
* pending with event_add(). As your event_base runs, it will run the
- * callbacks of an events whose conditions are triggered. When you no
+ * callbacks of an events whose conditions are triggered. When you no
* longer want the event, free it with event_free().
*
* In more depth:
@@ -274,7 +274,7 @@ struct event_base
* event_priority_set()
*/
struct event
-#ifdef EVENT_IN_DOXYGEN_
+#ifdef EVENT_IN_DOXYGEN_
{/*Empty body so that doxygen will generate documentation here.*/}
#endif
;
@@ -285,7 +285,7 @@ struct event
* There are many options that can be used to alter the behavior and
* implementation of an event_base. To avoid having to pass them all in a
* complex many-argument constructor, we provide an abstract data type
- * where you set up configuration information before passing it to
+ * where you set up configuration information before passing it to
* event_base_new_with_config().
*
* @see event_config_new(), event_config_free(), event_base_new_with_config(),
@@ -293,7 +293,7 @@ struct event
* event_config_set_flag(), event_config_set_num_cpus_hint()
*/
struct event_config
-#ifdef EVENT_IN_DOXYGEN_
+#ifdef EVENT_IN_DOXYGEN_
{/*Empty body so that doxygen will generate documentation here.*/}
#endif
;
@@ -318,7 +318,7 @@ struct event_config
*
* @see event_debug_unassign()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_enable_debug_mode(void);
/**
@@ -330,7 +330,7 @@ void event_enable_debug_mode(void);
*
* @see event_enable_debug_mode()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_debug_unassign(struct event *);
/**
@@ -340,7 +340,7 @@ void event_debug_unassign(struct event *);
*
* @see event_base_free(), event_base_new_with_config()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct event_base *event_base_new(void);
/**
@@ -353,7 +353,7 @@ struct event_base *event_base_new(void);
@return 0 if successful, or -1 if some events could not be re-added.
@see event_base_new()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_reinit(struct event_base *base);
/**
@@ -369,7 +369,7 @@ int event_reinit(struct event_base *base);
no events were pending or active.
@see event_base_loop()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_base_dispatch(struct event_base *);
/**
@@ -378,7 +378,7 @@ int event_base_dispatch(struct event_base *);
@param eb the event_base structure returned by event_base_new()
@return a string identifying the kernel event mechanism (kqueue, epoll, etc.)
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *event_base_get_method(const struct event_base *);
/**
@@ -393,67 +393,67 @@ const char *event_base_get_method(const struct event_base *);
The end of the array is indicated by a NULL pointer. If an
error is encountered NULL is returned.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char **event_get_supported_methods(void);
-/** Query the current monotonic time from a the timer for a struct
- * event_base.
- */
-EVENT2_EXPORT_SYMBOL
-int event_gettime_monotonic(struct event_base *base, struct timeval *tp);
-
-/**
- @name event type flag
-
- Flags to pass to event_base_get_num_events() to specify the kinds of events
- we want to aggregate counts for
-*/
-/**@{*/
-/** count the number of active events, which have been triggered.*/
-#define EVENT_BASE_COUNT_ACTIVE 1U
-/** count the number of virtual events, which is used to represent an internal
- * condition, other than a pending event, that keeps the loop from exiting. */
-#define EVENT_BASE_COUNT_VIRTUAL 2U
-/** count the number of events which have been added to event base, including
- * internal events. */
-#define EVENT_BASE_COUNT_ADDED 4U
-/**@}*/
-
-/**
- Gets the number of events in event_base, as specified in the flags.
-
- Since event base has some internal events added to make some of its
- functionalities work, EVENT_BASE_COUNT_ADDED may return more than the
- number of events you added using event_add().
-
- If you pass EVENT_BASE_COUNT_ACTIVE and EVENT_BASE_COUNT_ADDED together, an
- active event will be counted twice. However, this might not be the case in
- future libevent versions. The return value is an indication of the work
- load, but the user shouldn't rely on the exact value as this may change in
- the future.
-
- @param eb the event_base structure returned by event_base_new()
- @param flags a bitwise combination of the kinds of events to aggregate
- counts for
- @return the number of events specified in the flags
-*/
-EVENT2_EXPORT_SYMBOL
-int event_base_get_num_events(struct event_base *, unsigned int);
-
-/**
- Get the maximum number of events in a given event_base as specified in the
- flags.
-
- @param eb the event_base structure returned by event_base_new()
- @param flags a bitwise combination of the kinds of events to aggregate
- counts for
- @param clear option used to reset the maximum count.
- @return the number of events specified in the flags
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_get_max_events(struct event_base *, unsigned int, int);
-
-/**
+/** Query the current monotonic time from a the timer for a struct
+ * event_base.
+ */
+EVENT2_EXPORT_SYMBOL
+int event_gettime_monotonic(struct event_base *base, struct timeval *tp);
+
+/**
+ @name event type flag
+
+ Flags to pass to event_base_get_num_events() to specify the kinds of events
+ we want to aggregate counts for
+*/
+/**@{*/
+/** count the number of active events, which have been triggered.*/
+#define EVENT_BASE_COUNT_ACTIVE 1U
+/** count the number of virtual events, which is used to represent an internal
+ * condition, other than a pending event, that keeps the loop from exiting. */
+#define EVENT_BASE_COUNT_VIRTUAL 2U
+/** count the number of events which have been added to event base, including
+ * internal events. */
+#define EVENT_BASE_COUNT_ADDED 4U
+/**@}*/
+
+/**
+ Gets the number of events in event_base, as specified in the flags.
+
+ Since event base has some internal events added to make some of its
+ functionalities work, EVENT_BASE_COUNT_ADDED may return more than the
+ number of events you added using event_add().
+
+ If you pass EVENT_BASE_COUNT_ACTIVE and EVENT_BASE_COUNT_ADDED together, an
+ active event will be counted twice. However, this might not be the case in
+ future libevent versions. The return value is an indication of the work
+ load, but the user shouldn't rely on the exact value as this may change in
+ the future.
+
+ @param eb the event_base structure returned by event_base_new()
+ @param flags a bitwise combination of the kinds of events to aggregate
+ counts for
+ @return the number of events specified in the flags
+*/
+EVENT2_EXPORT_SYMBOL
+int event_base_get_num_events(struct event_base *, unsigned int);
+
+/**
+ Get the maximum number of events in a given event_base as specified in the
+ flags.
+
+ @param eb the event_base structure returned by event_base_new()
+ @param flags a bitwise combination of the kinds of events to aggregate
+ counts for
+ @param clear option used to reset the maximum count.
+ @return the number of events specified in the flags
+ */
+EVENT2_EXPORT_SYMBOL
+int event_base_get_max_events(struct event_base *, unsigned int, int);
+
+/**
Allocates a new event configuration object.
The event configuration object can be used to change the behavior of
@@ -463,7 +463,7 @@ int event_base_get_max_events(struct event_base *, unsigned int, int);
NULL if an error is encountered.
@see event_base_new_with_config(), event_config_free(), event_config
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct event_config *event_config_new(void);
/**
@@ -471,7 +471,7 @@ struct event_config *event_config_new(void);
@param cfg the event configuration object to be freed.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_config_free(struct event_config *cfg);
/**
@@ -486,7 +486,7 @@ void event_config_free(struct event_config *cfg);
@param method the name of the event method to avoid
@return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_config_avoid_method(struct event_config *cfg, const char *method);
/**
@@ -508,14 +508,14 @@ enum event_method_feature {
EV_FEATURE_O1 = 0x02,
/** Require an event method that allows file descriptors as well as
* sockets. */
- EV_FEATURE_FDS = 0x04,
- /** Require an event method that allows you to use EV_CLOSED to detect
- * connection close without the necessity of reading all the pending data.
- *
- * Methods that do support EV_CLOSED may not be able to provide support on
- * all kernel versions.
- **/
- EV_FEATURE_EARLY_CLOSE = 0x08
+ EV_FEATURE_FDS = 0x04,
+ /** Require an event method that allows you to use EV_CLOSED to detect
+ * connection close without the necessity of reading all the pending data.
+ *
+ * Methods that do support EV_CLOSED may not be able to provide support on
+ * all kernel versions.
+ **/
+ EV_FEATURE_EARLY_CLOSE = 0x08
};
/**
@@ -528,11 +528,11 @@ enum event_method_feature {
*/
enum event_base_config_flag {
/** Do not allocate a lock for the event base, even if we have
- locking set up.
-
- Setting this option will make it unsafe and nonfunctional to call
- functions on the base concurrently from multiple threads.
- */
+ locking set up.
+
+ Setting this option will make it unsafe and nonfunctional to call
+ functions on the base concurrently from multiple threads.
+ */
EVENT_BASE_FLAG_NOLOCK = 0x01,
/** Do not check the EVENT_* environment variables when configuring
an event_base */
@@ -557,20 +557,20 @@ enum event_base_config_flag {
if you have any fds cloned by dup() or its variants. Doing so
will produce strange and hard-to-diagnose bugs.
- This flag can also be activated by setting the
+ This flag can also be activated by setting the
EVENT_EPOLL_USE_CHANGELIST environment variable.
This flag has no effect if you wind up using a backend other than
epoll.
*/
- EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST = 0x10,
-
- /** Ordinarily, Libevent implements its time and timeout code using
- the fastest monotonic timer that we have. If this flag is set,
- however, we use less efficient more precise timer, assuming one is
- present.
- */
- EVENT_BASE_FLAG_PRECISE_TIMER = 0x20
+ EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST = 0x10,
+
+ /** Ordinarily, Libevent implements its time and timeout code using
+ the fastest monotonic timer that we have. If this flag is set,
+ however, we use less efficient more precise timer, assuming one is
+ present.
+ */
+ EVENT_BASE_FLAG_PRECISE_TIMER = 0x20
};
/**
@@ -580,7 +580,7 @@ enum event_base_config_flag {
@see event_method_feature
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_base_get_features(const struct event_base *base);
/**
@@ -605,7 +605,7 @@ int event_base_get_features(const struct event_base *base);
@return 0 on success, -1 on failure.
@see event_method_feature, event_base_new_with_config()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_config_require_features(struct event_config *cfg, int feature);
/**
@@ -614,7 +614,7 @@ int event_config_require_features(struct event_config *cfg, int feature);
*
* @see event_base_config_flags, event_base_new_with_config()
**/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_config_set_flag(struct event_config *cfg, int flag);
/**
@@ -626,43 +626,43 @@ int event_config_set_flag(struct event_config *cfg, int flag);
* @param cpus the number of cpus
* @return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_config_set_num_cpus_hint(struct event_config *cfg, int cpus);
/**
- * Record an interval and/or a number of callbacks after which the event base
- * should check for new events. By default, the event base will run as many
- * events are as activated at the highest activated priority before checking
- * for new events. If you configure it by setting max_interval, it will check
- * the time after each callback, and not allow more than max_interval to
- * elapse before checking for new events. If you configure it by setting
- * max_callbacks to a value >= 0, it will run no more than max_callbacks
- * callbacks before checking for new events.
- *
- * This option can decrease the latency of high-priority events, and
- * avoid priority inversions where multiple low-priority events keep us from
- * polling for high-priority events, but at the expense of slightly decreasing
- * the throughput. Use it with caution!
- *
- * @param cfg The event_base configuration object.
- * @param max_interval An interval after which Libevent should stop running
- * callbacks and check for more events, or NULL if there should be
- * no such interval.
- * @param max_callbacks A number of callbacks after which Libevent should
- * stop running callbacks and check for more events, or -1 if there
- * should be no such limit.
- * @param min_priority A priority below which max_interval and max_callbacks
- * should not be enforced. If this is set to 0, they are enforced
- * for events of every priority; if it's set to 1, they're enforced
- * for events of priority 1 and above, and so on.
- * @return 0 on success, -1 on failure.
- **/
-EVENT2_EXPORT_SYMBOL
-int event_config_set_max_dispatch_interval(struct event_config *cfg,
- const struct timeval *max_interval, int max_callbacks,
- int min_priority);
-
-/**
+ * Record an interval and/or a number of callbacks after which the event base
+ * should check for new events. By default, the event base will run as many
+ * events are as activated at the highest activated priority before checking
+ * for new events. If you configure it by setting max_interval, it will check
+ * the time after each callback, and not allow more than max_interval to
+ * elapse before checking for new events. If you configure it by setting
+ * max_callbacks to a value >= 0, it will run no more than max_callbacks
+ * callbacks before checking for new events.
+ *
+ * This option can decrease the latency of high-priority events, and
+ * avoid priority inversions where multiple low-priority events keep us from
+ * polling for high-priority events, but at the expense of slightly decreasing
+ * the throughput. Use it with caution!
+ *
+ * @param cfg The event_base configuration object.
+ * @param max_interval An interval after which Libevent should stop running
+ * callbacks and check for more events, or NULL if there should be
+ * no such interval.
+ * @param max_callbacks A number of callbacks after which Libevent should
+ * stop running callbacks and check for more events, or -1 if there
+ * should be no such limit.
+ * @param min_priority A priority below which max_interval and max_callbacks
+ * should not be enforced. If this is set to 0, they are enforced
+ * for events of every priority; if it's set to 1, they're enforced
+ * for events of priority 1 and above, and so on.
+ * @return 0 on success, -1 on failure.
+ **/
+EVENT2_EXPORT_SYMBOL
+int event_config_set_max_dispatch_interval(struct event_config *cfg,
+ const struct timeval *max_interval, int max_callbacks,
+ int min_priority);
+
+/**
Initialize the event API.
Use event_base_new_with_config() to initialize a new event base, taking
@@ -674,7 +674,7 @@ int event_config_set_max_dispatch_interval(struct event_config *cfg,
or NULL if no event base can be created with the requested event_config.
@see event_base_new(), event_base_free(), event_init(), event_assign()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct event_base *event_base_new_with_config(const struct event_config *);
/**
@@ -683,20 +683,20 @@ struct event_base *event_base_new_with_config(const struct event_config *);
Note that this function will not close any fds or free any memory passed
to event_new as the argument to callback.
- If there are any pending finalizer callbacks, this function will invoke
- them.
-
+ If there are any pending finalizer callbacks, this function will invoke
+ them.
+
@param eb an event_base to be freed
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_base_free(struct event_base *);
-/**
- As event_base_free, but do not run finalizers.
- */
-EVENT2_EXPORT_SYMBOL
-void event_base_free_nofinalize(struct event_base *);
-
+/**
+ As event_base_free, but do not run finalizers.
+ */
+EVENT2_EXPORT_SYMBOL
+void event_base_free_nofinalize(struct event_base *);
+
/** @name Log severities
*/
/**@{*/
@@ -723,13 +723,13 @@ typedef void (*event_log_cb)(int severity, const char *msg);
Redirect Libevent's log messages.
@param cb a function taking two arguments: an integer severity between
- EVENT_LOG_DEBUG and EVENT_LOG_ERR, and a string. If cb is NULL,
+ EVENT_LOG_DEBUG and EVENT_LOG_ERR, and a string. If cb is NULL,
then the default log is used.
NOTE: The function you provide *must not* call any other libevent
functionality. Doing so can produce undefined behavior.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_set_log_callback(event_log_cb cb);
/**
@@ -748,33 +748,33 @@ typedef void (*event_fatal_cb)(int err);
something is wrong with your program, or with Libevent: any subsequent calls
to Libevent may result in undefined behavior.
- Libevent will (almost) always log an EVENT_LOG_ERR message before calling
+ Libevent will (almost) always log an EVENT_LOG_ERR message before calling
this function; look at the last log message to see why Libevent has died.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_set_fatal_callback(event_fatal_cb cb);
-#define EVENT_DBG_ALL 0xffffffffu
-#define EVENT_DBG_NONE 0
-
-/**
- Turn on debugging logs and have them sent to the default log handler.
-
- This is a global setting; if you are going to call it, you must call this
- before any calls that create an event-base. You must call it before any
- multithreaded use of Libevent.
-
- Debug logs are verbose.
-
- @param which Controls which debug messages are turned on. This option is
- unused for now; for forward compatibility, you must pass in the constant
- "EVENT_DBG_ALL" to turn debugging logs on, or "EVENT_DBG_NONE" to turn
- debugging logs off.
- */
-EVENT2_EXPORT_SYMBOL
-void event_enable_debug_logging(ev_uint32_t which);
-
-/**
+#define EVENT_DBG_ALL 0xffffffffu
+#define EVENT_DBG_NONE 0
+
+/**
+ Turn on debugging logs and have them sent to the default log handler.
+
+ This is a global setting; if you are going to call it, you must call this
+ before any calls that create an event-base. You must call it before any
+ multithreaded use of Libevent.
+
+ Debug logs are verbose.
+
+ @param which Controls which debug messages are turned on. This option is
+ unused for now; for forward compatibility, you must pass in the constant
+ "EVENT_DBG_ALL" to turn debugging logs on, or "EVENT_DBG_NONE" to turn
+ debugging logs off.
+ */
+EVENT2_EXPORT_SYMBOL
+void event_enable_debug_logging(ev_uint32_t which);
+
+/**
Associate a different event base with an event.
The event to be associated must not be currently active or pending.
@@ -783,7 +783,7 @@ void event_enable_debug_logging(ev_uint32_t which);
@param ev the event
@return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_base_set(struct event_base *, struct event *);
/** @name Loop flags
@@ -797,11 +797,11 @@ int event_base_set(struct event_base *, struct event *);
/** Do not block: see which events are ready now, run the callbacks
* of the highest-priority ones, then exit. */
#define EVLOOP_NONBLOCK 0x02
-/** Do not exit the loop because we have no pending events. Instead, keep
- * running until event_base_loopexit() or event_base_loopbreak() makes us
- * stop.
- */
-#define EVLOOP_NO_EXIT_ON_EMPTY 0x04
+/** Do not exit the loop because we have no pending events. Instead, keep
+ * running until event_base_loopexit() or event_base_loopbreak() makes us
+ * stop.
+ */
+#define EVLOOP_NO_EXIT_ON_EMPTY 0x04
/**@}*/
/**
@@ -822,7 +822,7 @@ int event_base_set(struct event_base *, struct event *);
@see event_base_loopexit(), event_base_dispatch(), EVLOOP_ONCE,
EVLOOP_NONBLOCK
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_base_loop(struct event_base *, int);
/**
@@ -840,7 +840,7 @@ int event_base_loop(struct event_base *, int);
@return 0 if successful, or -1 if an error occurred
@see event_base_loopbreak()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_base_loopexit(struct event_base *, const struct timeval *);
/**
@@ -850,38 +850,38 @@ int event_base_loopexit(struct event_base *, const struct timeval *);
event_base_loopbreak() is typically invoked from this event's callback.
This behavior is analogous to the "break;" statement.
- Subsequent invocations of event_base_loop() will proceed normally.
+ Subsequent invocations of event_base_loop() will proceed normally.
@param eb the event_base structure returned by event_init()
@return 0 if successful, or -1 if an error occurred
@see event_base_loopexit()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_base_loopbreak(struct event_base *);
/**
- Tell the active event_base_loop() to scan for new events immediately.
-
- Calling this function makes the currently active event_base_loop()
- start the loop over again (scanning for new events) after the current
- event callback finishes. If the event loop is not running, this
- function has no effect.
-
- event_base_loopbreak() is typically invoked from this event's callback.
- This behavior is analogous to the "continue;" statement.
-
- Subsequent invocations of event loop will proceed normally.
-
- @param eb the event_base structure returned by event_init()
- @return 0 if successful, or -1 if an error occurred
- @see event_base_loopbreak()
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_loopcontinue(struct event_base *);
-
-/**
- Checks if the event loop was told to exit by event_base_loopexit().
-
+ Tell the active event_base_loop() to scan for new events immediately.
+
+ Calling this function makes the currently active event_base_loop()
+ start the loop over again (scanning for new events) after the current
+ event callback finishes. If the event loop is not running, this
+ function has no effect.
+
+ event_base_loopbreak() is typically invoked from this event's callback.
+ This behavior is analogous to the "continue;" statement.
+
+ Subsequent invocations of event loop will proceed normally.
+
+ @param eb the event_base structure returned by event_init()
+ @return 0 if successful, or -1 if an error occurred
+ @see event_base_loopbreak()
+ */
+EVENT2_EXPORT_SYMBOL
+int event_base_loopcontinue(struct event_base *);
+
+/**
+ Checks if the event loop was told to exit by event_base_loopexit().
+
This function will return true for an event_base at every point after
event_loopexit() is called, until the event loop is next entered.
@@ -891,14 +891,14 @@ int event_base_loopcontinue(struct event_base *);
@see event_base_loopexit()
@see event_base_got_break()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_base_got_exit(struct event_base *);
/**
- Checks if the event loop was told to abort immediately by event_base_loopbreak().
+ Checks if the event loop was told to abort immediately by event_base_loopbreak().
This function will return true for an event_base at every point after
- event_base_loopbreak() is called, until the event loop is next entered.
+ event_base_loopbreak() is called, until the event loop is next entered.
@param eb the event_base structure returned by event_init()
@return true if event_base_loopbreak() was called on this event base,
@@ -906,7 +906,7 @@ int event_base_got_exit(struct event_base *);
@see event_base_loopbreak()
@see event_base_got_exit()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_base_got_break(struct event_base *);
/**
@@ -933,37 +933,37 @@ int event_base_got_break(struct event_base *);
*/
#define EV_PERSIST 0x10
/** Select edge-triggered behavior, if supported by the backend. */
-#define EV_ET 0x20
-/**
- * If this option is provided, then event_del() will not block in one thread
- * while waiting for the event callback to complete in another thread.
- *
- * To use this option safely, you may need to use event_finalize() or
- * event_free_finalize() in order to safely tear down an event in a
- * multithreaded application. See those functions for more information.
- **/
-#define EV_FINALIZE 0x40
-/**
- * Detects connection close events. You can use this to detect when a
- * connection has been closed, without having to read all the pending data
- * from a connection.
- *
- * Not all backends support EV_CLOSED. To detect or require it, use the
- * feature flag EV_FEATURE_EARLY_CLOSE.
- **/
-#define EV_CLOSED 0x80
+#define EV_ET 0x20
+/**
+ * If this option is provided, then event_del() will not block in one thread
+ * while waiting for the event callback to complete in another thread.
+ *
+ * To use this option safely, you may need to use event_finalize() or
+ * event_free_finalize() in order to safely tear down an event in a
+ * multithreaded application. See those functions for more information.
+ **/
+#define EV_FINALIZE 0x40
+/**
+ * Detects connection close events. You can use this to detect when a
+ * connection has been closed, without having to read all the pending data
+ * from a connection.
+ *
+ * Not all backends support EV_CLOSED. To detect or require it, use the
+ * feature flag EV_FEATURE_EARLY_CLOSE.
+ **/
+#define EV_CLOSED 0x80
/**@}*/
/**
@name evtimer_* macros
- Aliases for working with one-shot timer events
- If you need EV_PERSIST timer use event_*() functions.
- */
+ Aliases for working with one-shot timer events
+ If you need EV_PERSIST timer use event_*() functions.
+ */
/**@{*/
#define evtimer_assign(ev, b, cb, arg) \
event_assign((ev), (b), -1, 0, (cb), (arg))
-#define evtimer_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg))
+#define evtimer_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg))
#define evtimer_add(ev, tv) event_add((ev), (tv))
#define evtimer_del(ev) event_del(ev)
#define evtimer_pending(ev, tv) event_pending((ev), EV_TIMEOUT, (tv))
@@ -987,20 +987,20 @@ int event_base_got_break(struct event_base *);
/**@}*/
/**
- @name evuser_* macros
-
- Aliases for working with user-triggered events
- If you need EV_PERSIST event use event_*() functions.
- */
-/**@{*/
-#define evuser_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg))
-#define evuser_del(ev) event_del(ev)
-#define evuser_pending(ev, tv) event_pending((ev), 0, (tv))
-#define evuser_initialized(ev) event_initialized(ev)
-#define evuser_trigger(ev) event_active((ev), 0, 0)
-/**@}*/
-
-/**
+ @name evuser_* macros
+
+ Aliases for working with user-triggered events
+ If you need EV_PERSIST event use event_*() functions.
+ */
+/**@{*/
+#define evuser_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg))
+#define evuser_del(ev) event_del(ev)
+#define evuser_pending(ev, tv) event_pending((ev), 0, (tv))
+#define evuser_initialized(ev) event_initialized(ev)
+#define evuser_trigger(ev) event_active((ev), 0, 0)
+/**@}*/
+
+/**
A callback function for an event.
It receives three arguments:
@@ -1014,33 +1014,33 @@ int event_base_got_break(struct event_base *);
typedef void (*event_callback_fn)(evutil_socket_t, short, void *);
/**
- Return a value used to specify that the event itself must be used as the callback argument.
-
- The function event_new() takes a callback argument which is passed
- to the event's callback function. To specify that the argument to be
- passed to the callback function is the event that event_new() returns,
- pass in the return value of event_self_cbarg() as the callback argument
- for event_new().
-
- For example:
- <pre>
- struct event *ev = event_new(base, sock, events, callback, %event_self_cbarg());
- </pre>
-
- For consistency with event_new(), it is possible to pass the return value
- of this function as the callback argument for event_assign() &ndash; this
- achieves the same result as passing the event in directly.
-
- @return a value to be passed as the callback argument to event_new() or
- event_assign().
- @see event_new(), event_assign()
- */
-EVENT2_EXPORT_SYMBOL
-void *event_self_cbarg(void);
-
-/**
- Allocate and assign a new event structure, ready to be added.
-
+ Return a value used to specify that the event itself must be used as the callback argument.
+
+ The function event_new() takes a callback argument which is passed
+ to the event's callback function. To specify that the argument to be
+ passed to the callback function is the event that event_new() returns,
+ pass in the return value of event_self_cbarg() as the callback argument
+ for event_new().
+
+ For example:
+ <pre>
+ struct event *ev = event_new(base, sock, events, callback, %event_self_cbarg());
+ </pre>
+
+ For consistency with event_new(), it is possible to pass the return value
+ of this function as the callback argument for event_assign() &ndash; this
+ achieves the same result as passing the event in directly.
+
+ @return a value to be passed as the callback argument to event_new() or
+ event_assign().
+ @see event_new(), event_assign()
+ */
+EVENT2_EXPORT_SYMBOL
+void *event_self_cbarg(void);
+
+/**
+ Allocate and assign a new event structure, ready to be added.
+
The function event_new() returns a new event that can be used in
future calls to event_add() and event_del(). The fd and events
arguments determine which conditions will trigger the event; the
@@ -1065,10 +1065,10 @@ void *event_self_cbarg(void);
The EV_TIMEOUT flag has no effect here.
It is okay to have multiple events all listening on the same fds; but
- they must either all be edge-triggered, or all not be edge triggered.
+ they must either all be edge-triggered, or all not be edge triggered.
When the event becomes active, the event loop will run the provided
- callback function, with three arguments. The first will be the provided
+ callback function, with three arguments. The first will be the provided
fd value. The second will be a bitfield of the events that triggered:
EV_READ, EV_WRITE, or EV_SIGNAL. Here the EV_TIMEOUT flag indicates
that a timeout occurred, and EV_ET indicates that an edge-triggered
@@ -1083,10 +1083,10 @@ void *event_self_cbarg(void);
@param callback_arg an argument to be passed to the callback function
@return a newly allocated struct event that must later be freed with
- event_free() or NULL if an error occurred.
+ event_free() or NULL if an error occurred.
@see event_free(), event_add(), event_del(), event_assign()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct event *event_new(struct event_base *, evutil_socket_t, short, event_callback_fn, void *);
@@ -1128,71 +1128,71 @@ struct event *event_new(struct event_base *, evutil_socket_t, short, event_callb
@see event_new(), event_add(), event_del(), event_base_once(),
event_get_struct_event_size()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_assign(struct event *, struct event_base *, evutil_socket_t, short, event_callback_fn, void *);
/**
Deallocate a struct event * returned by event_new().
- If the event is pending or active, this function makes it non-pending
- and non-active first.
+ If the event is pending or active, this function makes it non-pending
+ and non-active first.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_free(struct event *);
/**
- * Callback type for event_finalize and event_free_finalize().
- **/
-typedef void (*event_finalize_callback_fn)(struct event *, void *);
-/**
- @name Finalization functions
-
- These functions are used to safely tear down an event in a multithreaded
- application. If you construct your events with EV_FINALIZE to avoid
- deadlocks, you will need a way to remove an event in the certainty that
- it will definitely not be running its callback when you deallocate it
- and its callback argument.
-
- To do this, call one of event_finalize() or event_free_finalize with
- 0 for its first argument, the event to tear down as its second argument,
- and a callback function as its third argument. The callback will be
- invoked as part of the event loop, with the event's priority.
-
- After you call a finalizer function, event_add() and event_active() will
- no longer work on the event, and event_del() will produce a no-op. You
- must not try to change the event's fields with event_assign() or
- event_set() while the finalize callback is in progress. Once the
- callback has been invoked, you should treat the event structure as
- containing uninitialized memory.
-
- The event_free_finalize() function frees the event after it's finalized;
- event_finalize() does not.
-
- A finalizer callback must not make events pending or active. It must not
- add events, activate events, or attempt to "resuscitate" the event being
- finalized in any way.
-
- @return 0 on success, -1 on failure.
- */
-/**@{*/
-EVENT2_EXPORT_SYMBOL
-int event_finalize(unsigned, struct event *, event_finalize_callback_fn);
-EVENT2_EXPORT_SYMBOL
-int event_free_finalize(unsigned, struct event *, event_finalize_callback_fn);
-/**@}*/
-
-/**
+ * Callback type for event_finalize and event_free_finalize().
+ **/
+typedef void (*event_finalize_callback_fn)(struct event *, void *);
+/**
+ @name Finalization functions
+
+ These functions are used to safely tear down an event in a multithreaded
+ application. If you construct your events with EV_FINALIZE to avoid
+ deadlocks, you will need a way to remove an event in the certainty that
+ it will definitely not be running its callback when you deallocate it
+ and its callback argument.
+
+ To do this, call one of event_finalize() or event_free_finalize with
+ 0 for its first argument, the event to tear down as its second argument,
+ and a callback function as its third argument. The callback will be
+ invoked as part of the event loop, with the event's priority.
+
+ After you call a finalizer function, event_add() and event_active() will
+ no longer work on the event, and event_del() will produce a no-op. You
+ must not try to change the event's fields with event_assign() or
+ event_set() while the finalize callback is in progress. Once the
+ callback has been invoked, you should treat the event structure as
+ containing uninitialized memory.
+
+ The event_free_finalize() function frees the event after it's finalized;
+ event_finalize() does not.
+
+ A finalizer callback must not make events pending or active. It must not
+ add events, activate events, or attempt to "resuscitate" the event being
+ finalized in any way.
+
+ @return 0 on success, -1 on failure.
+ */
+/**@{*/
+EVENT2_EXPORT_SYMBOL
+int event_finalize(unsigned, struct event *, event_finalize_callback_fn);
+EVENT2_EXPORT_SYMBOL
+int event_free_finalize(unsigned, struct event *, event_finalize_callback_fn);
+/**@}*/
+
+/**
Schedule a one-time event
- The function event_base_once() is similar to event_new(). However, it
+ The function event_base_once() is similar to event_new(). However, it
schedules a callback to be called exactly once, and does not require the
caller to prepare an event structure.
- Note that in Libevent 2.0 and earlier, if the event is never triggered, the
- internal memory used to hold it will never be freed. In Libevent 2.1,
- the internal memory will get freed by event_base_free() if the event
- is never triggered. The 'arg' value, however, will not get freed in either
- case--you'll need to free that on your own if you want it to go away.
+ Note that in Libevent 2.0 and earlier, if the event is never triggered, the
+ internal memory used to hold it will never be freed. In Libevent 2.1,
+ the internal memory will get freed by event_base_free() if the event
+ is never triggered. The 'arg' value, however, will not get freed in either
+ case--you'll need to free that on your own if you want it to go away.
@param base an event_base
@param fd a file descriptor to monitor, or -1 for no fd.
@@ -1202,18 +1202,18 @@ int event_free_finalize(unsigned, struct event *, event_finalize_callback_fn);
@param arg an argument to be passed to the callback function
@param timeout the maximum amount of time to wait for the event. NULL
makes an EV_READ/EV_WRITE event make forever; NULL makes an
- EV_TIMEOUT event success immediately.
+ EV_TIMEOUT event success immediately.
@return 0 if successful, or -1 if an error occurred
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_base_once(struct event_base *, evutil_socket_t, short, event_callback_fn, void *, const struct timeval *);
/**
Add an event to the set of pending events.
- The function event_add() schedules the execution of the event 'ev' when the
- condition specified by event_assign() or event_new() occurs, or when the time
- specified in timeout has elapsed. If a timeout is NULL, no timeout
+ The function event_add() schedules the execution of the event 'ev' when the
+ condition specified by event_assign() or event_new() occurs, or when the time
+ specified in timeout has elapsed. If a timeout is NULL, no timeout
occurs and the function will only be
called if a matching event occurs. The event in the
ev argument must be already initialized by event_assign() or event_new()
@@ -1221,30 +1221,30 @@ int event_base_once(struct event_base *, evutil_socket_t, short, event_callback_
in calls to event_assign() until it is no longer pending.
If the event in the ev argument already has a scheduled timeout, calling
- event_add() replaces the old timeout with the new one if tv is non-NULL.
+ event_add() replaces the old timeout with the new one if tv is non-NULL.
- @param ev an event struct initialized via event_assign() or event_new()
+ @param ev an event struct initialized via event_assign() or event_new()
@param timeout the maximum amount of time to wait for the event, or NULL
to wait forever
@return 0 if successful, or -1 if an error occurred
@see event_del(), event_assign(), event_new()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_add(struct event *ev, const struct timeval *timeout);
/**
- Remove a timer from a pending event without removing the event itself.
-
- If the event has a scheduled timeout, this function unschedules it but
- leaves the event otherwise pending.
-
- @param ev an event struct initialized via event_assign() or event_new()
- @return 0 on success, or -1 if an error occurred.
-*/
-EVENT2_EXPORT_SYMBOL
-int event_remove_timer(struct event *ev);
-
-/**
+ Remove a timer from a pending event without removing the event itself.
+
+ If the event has a scheduled timeout, this function unschedules it but
+ leaves the event otherwise pending.
+
+ @param ev an event struct initialized via event_assign() or event_new()
+ @return 0 on success, or -1 if an error occurred.
+*/
+EVENT2_EXPORT_SYMBOL
+int event_remove_timer(struct event *ev);
+
+/**
Remove an event from the set of monitored events.
The function event_del() will cancel the event in the argument ev. If the
@@ -1255,23 +1255,23 @@ int event_remove_timer(struct event *ev);
@return 0 if successful, or -1 if an error occurred
@see event_add()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_del(struct event *);
-/**
- As event_del(), but never blocks while the event's callback is running
- in another thread, even if the event was constructed without the
- EV_FINALIZE flag.
- */
-EVENT2_EXPORT_SYMBOL
-int event_del_noblock(struct event *ev);
-/**
- As event_del(), but always blocks while the event's callback is running
- in another thread, even if the event was constructed with the
- EV_FINALIZE flag.
- */
-EVENT2_EXPORT_SYMBOL
-int event_del_block(struct event *ev);
+/**
+ As event_del(), but never blocks while the event's callback is running
+ in another thread, even if the event was constructed without the
+ EV_FINALIZE flag.
+ */
+EVENT2_EXPORT_SYMBOL
+int event_del_noblock(struct event *ev);
+/**
+ As event_del(), but always blocks while the event's callback is running
+ in another thread, even if the event was constructed with the
+ EV_FINALIZE flag.
+ */
+EVENT2_EXPORT_SYMBOL
+int event_del_block(struct event *ev);
/**
Make an event active.
@@ -1287,7 +1287,7 @@ int event_del_block(struct event *ev);
@param res a set of flags to pass to the event's callback.
@param ncalls an obsolete argument: this is ignored.
**/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_active(struct event *ev, int res, short ncalls);
/**
@@ -1303,25 +1303,25 @@ void event_active(struct event *ev, int res, short ncalls);
@return true if the event is pending on any of the events in 'what', (that
is to say, it has been added), or 0 if the event is not added.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_pending(const struct event *ev, short events, struct timeval *tv);
-/**
- If called from within the callback for an event, returns that event.
-
- The behavior of this function is not defined when called from outside the
- callback function for an event.
- */
-EVENT2_EXPORT_SYMBOL
-struct event *event_base_get_running_event(struct event_base *base);
+/**
+ If called from within the callback for an event, returns that event.
+ The behavior of this function is not defined when called from outside the
+ callback function for an event.
+ */
+EVENT2_EXPORT_SYMBOL
+struct event *event_base_get_running_event(struct event_base *base);
+
/**
Test if an event structure might be initialized.
The event_initialized() function can be used to check if an event has been
initialized.
- Warning: This function is only useful for distinguishing a zeroed-out
+ Warning: This function is only useful for distinguishing a zeroed-out
piece of memory from an initialized event, it can easily be confused by
uninitialized memory. Thus, it should ONLY be used to distinguish an
initialized event from zero.
@@ -1330,7 +1330,7 @@ struct event *event_base_get_running_event(struct event_base *base);
@return 1 if the structure might be initialized, or 0 if it has not been
initialized
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_initialized(const struct event *ev);
/**
@@ -1342,48 +1342,48 @@ int event_initialized(const struct event *ev);
Get the socket or signal assigned to an event, or -1 if the event has
no socket.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
evutil_socket_t event_get_fd(const struct event *ev);
/**
Get the event_base associated with an event.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct event_base *event_get_base(const struct event *ev);
/**
Return the events (EV_READ, EV_WRITE, etc) assigned to an event.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
short event_get_events(const struct event *ev);
/**
Return the callback assigned to an event.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
event_callback_fn event_get_callback(const struct event *ev);
/**
Return the callback argument assigned to an event.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void *event_get_callback_arg(const struct event *ev);
/**
- Return the priority of an event.
- @see event_priority_init(), event_get_priority()
-*/
-EVENT2_EXPORT_SYMBOL
-int event_get_priority(const struct event *ev);
-
-/**
+ Return the priority of an event.
+ @see event_priority_init(), event_get_priority()
+*/
+EVENT2_EXPORT_SYMBOL
+int event_get_priority(const struct event *ev);
+
+/**
Extract _all_ of arguments given to construct a given event. The
event_base is copied into *base_out, the fd is copied into *fd_out, and so
on.
If any of the "_out" arguments is NULL, it will be ignored.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_get_assignment(const struct event *event,
struct event_base **base_out, evutil_socket_t *fd_out, short *events_out,
event_callback_fn *callback_out, void **arg_out);
@@ -1401,7 +1401,7 @@ void event_get_assignment(const struct event *event,
We might do this to help ensure ABI-compatibility between different
versions of Libevent.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
size_t event_get_struct_event_size(void);
/**
@@ -1413,7 +1413,7 @@ size_t event_get_struct_event_size(void);
@return a string containing the version number of Libevent
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *event_get_version(void);
/**
@@ -1427,14 +1427,14 @@ const char *event_get_version(void);
the version number. The low-order byte is unused. For example, version
2.0.1-alpha has a numeric representation of 0x02000100
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
ev_uint32_t event_get_version_number(void);
/** As event_get_version, but gives the version of Libevent's headers. */
-#define LIBEVENT_VERSION EVENT__VERSION
+#define LIBEVENT_VERSION EVENT__VERSION
/** As event_get_version_number, but gives the version number of Libevent's
* headers. */
-#define LIBEVENT_VERSION_NUMBER EVENT__NUMERIC_VERSION
+#define LIBEVENT_VERSION_NUMBER EVENT__NUMERIC_VERSION
/** Largest number of priorities that Libevent can support. */
#define EVENT_MAX_PRIORITIES 256
@@ -1465,28 +1465,28 @@ ev_uint32_t event_get_version_number(void);
@return 0 if successful, or -1 if an error occurred
@see event_priority_set()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_base_priority_init(struct event_base *, int);
/**
- Get the number of different event priorities.
-
- @param eb the event_base structure returned by event_base_new()
- @return Number of different event priorities
- @see event_base_priority_init()
-*/
-EVENT2_EXPORT_SYMBOL
-int event_base_get_npriorities(struct event_base *eb);
-
-/**
+ Get the number of different event priorities.
+
+ @param eb the event_base structure returned by event_base_new()
+ @return Number of different event priorities
+ @see event_base_priority_init()
+*/
+EVENT2_EXPORT_SYMBOL
+int event_base_get_npriorities(struct event_base *eb);
+
+/**
Assign a priority to an event.
@param ev an event struct
@param priority the new priority to be assigned
@return 0 if successful, or -1 if an error occurred
- @see event_priority_init(), event_get_priority()
+ @see event_priority_init(), event_get_priority()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_priority_set(struct event *, int);
/**
@@ -1508,11 +1508,11 @@ int event_priority_set(struct event *, int);
(This optimization probably will not be worthwhile until you have thousands
or tens of thousands of events with the same timeout.)
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const struct timeval *event_base_init_common_timeout(struct event_base *base,
const struct timeval *duration);
-#if !defined(EVENT__DISABLE_MM_REPLACEMENT) || defined(EVENT_IN_DOXYGEN_)
+#if !defined(EVENT__DISABLE_MM_REPLACEMENT) || defined(EVENT_IN_DOXYGEN_)
/**
Override the functions that Libevent uses for memory management.
@@ -1528,14 +1528,14 @@ const struct timeval *event_base_init_common_timeout(struct event_base *base,
Note also that if you are going to call this function, you should do so
before any call to any Libevent function that does allocation.
- Otherwise, those functions will allocate their memory using malloc(), but
+ Otherwise, those functions will allocate their memory using malloc(), but
then later free it using your provided free_fn.
@param malloc_fn A replacement for malloc.
@param realloc_fn A replacement for realloc
@param free_fn A replacement for free.
**/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_set_mem_functions(
void *(*malloc_fn)(size_t sz),
void *(*realloc_fn)(void *ptr, size_t sz),
@@ -1545,128 +1545,128 @@ void event_set_mem_functions(
#define EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
#endif
-/**
- Writes a human-readable description of all inserted and/or active
- events to a provided stdio stream.
-
- This is intended for debugging; its format is not guaranteed to be the same
- between libevent versions.
-
- @param base An event_base on which to scan the events.
- @param output A stdio file to write on.
- */
-EVENT2_EXPORT_SYMBOL
+/**
+ Writes a human-readable description of all inserted and/or active
+ events to a provided stdio stream.
+
+ This is intended for debugging; its format is not guaranteed to be the same
+ between libevent versions.
+
+ @param base An event_base on which to scan the events.
+ @param output A stdio file to write on.
+ */
+EVENT2_EXPORT_SYMBOL
void event_base_dump_events(struct event_base *, FILE *);
-
-/**
- Activates all pending events for the given fd and event mask.
-
- This function activates pending events only. Events which have not been
- added will not become active.
-
- @param base the event_base on which to activate the events.
- @param fd An fd to active events on.
- @param events One or more of EV_{READ,WRITE,TIMEOUT}.
- */
-EVENT2_EXPORT_SYMBOL
-void event_base_active_by_fd(struct event_base *base, evutil_socket_t fd, short events);
-
-/**
- Activates all pending signals with a given signal number
-
- This function activates pending events only. Events which have not been
- added will not become active.
-
- @param base the event_base on which to activate the events.
- @param fd The signal to active events on.
- */
-EVENT2_EXPORT_SYMBOL
-void event_base_active_by_signal(struct event_base *base, int sig);
-
-/**
- * Callback for iterating events in an event base via event_base_foreach_event
- */
-typedef int (*event_base_foreach_event_cb)(const struct event_base *, const struct event *, void *);
-
-/**
- Iterate over all added or active events events in an event loop, and invoke
- a given callback on each one.
-
- The callback must not call any function that modifies the event base, that
- modifies any event in the event base, or that adds or removes any event to
- the event base. Doing so is unsupported and will lead to undefined
- behavior -- likely, to crashes.
-
- event_base_foreach_event() holds a lock on the event_base() for the whole
- time it's running: slow callbacks are not advisable.
-
- Note that Libevent adds some events of its own to make pieces of its
- functionality work. You must not assume that the only events you'll
- encounter will be the ones you added yourself.
-
- The callback function must return 0 to continue iteration, or some other
- integer to stop iterating.
-
- @param base An event_base on which to scan the events.
- @param fn A callback function to receive the events.
- @param arg An argument passed to the callback function.
- @return 0 if we iterated over every event, or the value returned by the
- callback function if the loop exited early.
-*/
-EVENT2_EXPORT_SYMBOL
-int event_base_foreach_event(struct event_base *base, event_base_foreach_event_cb fn, void *arg);
-
-
+
+/**
+ Activates all pending events for the given fd and event mask.
+
+ This function activates pending events only. Events which have not been
+ added will not become active.
+
+ @param base the event_base on which to activate the events.
+ @param fd An fd to active events on.
+ @param events One or more of EV_{READ,WRITE,TIMEOUT}.
+ */
+EVENT2_EXPORT_SYMBOL
+void event_base_active_by_fd(struct event_base *base, evutil_socket_t fd, short events);
+
+/**
+ Activates all pending signals with a given signal number
+
+ This function activates pending events only. Events which have not been
+ added will not become active.
+
+ @param base the event_base on which to activate the events.
+ @param fd The signal to active events on.
+ */
+EVENT2_EXPORT_SYMBOL
+void event_base_active_by_signal(struct event_base *base, int sig);
+
+/**
+ * Callback for iterating events in an event base via event_base_foreach_event
+ */
+typedef int (*event_base_foreach_event_cb)(const struct event_base *, const struct event *, void *);
+
+/**
+ Iterate over all added or active events events in an event loop, and invoke
+ a given callback on each one.
+
+ The callback must not call any function that modifies the event base, that
+ modifies any event in the event base, or that adds or removes any event to
+ the event base. Doing so is unsupported and will lead to undefined
+ behavior -- likely, to crashes.
+
+ event_base_foreach_event() holds a lock on the event_base() for the whole
+ time it's running: slow callbacks are not advisable.
+
+ Note that Libevent adds some events of its own to make pieces of its
+ functionality work. You must not assume that the only events you'll
+ encounter will be the ones you added yourself.
+
+ The callback function must return 0 to continue iteration, or some other
+ integer to stop iterating.
+
+ @param base An event_base on which to scan the events.
+ @param fn A callback function to receive the events.
+ @param arg An argument passed to the callback function.
+ @return 0 if we iterated over every event, or the value returned by the
+ callback function if the loop exited early.
+*/
+EVENT2_EXPORT_SYMBOL
+int event_base_foreach_event(struct event_base *base, event_base_foreach_event_cb fn, void *arg);
+
+
/** Sets 'tv' to the current time (as returned by gettimeofday()),
looking at the cached value in 'base' if possible, and calling
gettimeofday() or clock_gettime() as appropriate if there is no
cached time.
Generally, this value will only be cached while actually
- processing event callbacks, and may be very inaccurate if your
+ processing event callbacks, and may be very inaccurate if your
callbacks take a long time to execute.
Returns 0 on success, negative on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_base_gettimeofday_cached(struct event_base *base,
struct timeval *tv);
-/** Update cached_tv in the 'base' to the current time
- *
- * You can use this function is useful for selectively increasing
- * the accuracy of the cached time value in 'base' during callbacks
- * that take a long time to execute.
- *
- * This function has no effect if the base is currently not in its
- * event loop, or if timeval caching is disabled via
- * EVENT_BASE_FLAG_NO_CACHE_TIME.
- *
- * @return 0 on success, -1 on failure
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_update_cache_time(struct event_base *base);
-
-/** Release up all globally-allocated resources allocated by Libevent.
-
- This function does not free developer-controlled resources like
- event_bases, events, bufferevents, listeners, and so on. It only releases
- resources like global locks that there is no other way to free.
-
- It is not actually necessary to call this function before exit: every
- resource that it frees would be released anyway on exit. It mainly exists
- so that resource-leak debugging tools don't see Libevent as holding
- resources at exit.
-
- You should only call this function when no other Libevent functions will
- be invoked -- e.g., when cleanly exiting a program.
- */
-EVENT2_EXPORT_SYMBOL
-void libevent_global_shutdown(void);
-
+/** Update cached_tv in the 'base' to the current time
+ *
+ * You can use this function is useful for selectively increasing
+ * the accuracy of the cached time value in 'base' during callbacks
+ * that take a long time to execute.
+ *
+ * This function has no effect if the base is currently not in its
+ * event loop, or if timeval caching is disabled via
+ * EVENT_BASE_FLAG_NO_CACHE_TIME.
+ *
+ * @return 0 on success, -1 on failure
+ */
+EVENT2_EXPORT_SYMBOL
+int event_base_update_cache_time(struct event_base *base);
+
+/** Release up all globally-allocated resources allocated by Libevent.
+
+ This function does not free developer-controlled resources like
+ event_bases, events, bufferevents, listeners, and so on. It only releases
+ resources like global locks that there is no other way to free.
+
+ It is not actually necessary to call this function before exit: every
+ resource that it frees would be released anyway on exit. It mainly exists
+ so that resource-leak debugging tools don't see Libevent as holding
+ resources at exit.
+
+ You should only call this function when no other Libevent functions will
+ be invoked -- e.g., when cleanly exiting a program.
+ */
+EVENT2_EXPORT_SYMBOL
+void libevent_global_shutdown(void);
+
#ifdef __cplusplus
}
#endif
-#endif /* EVENT2_EVENT_H_INCLUDED_ */
+#endif /* EVENT2_EVENT_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/event_compat.h b/contrib/libs/libevent/include/event2/event_compat.h
index 5110175a1b..67612da65b 100644
--- a/contrib/libs/libevent/include/event2/event_compat.h
+++ b/contrib/libs/libevent/include/event2/event_compat.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_EVENT_COMPAT_H_INCLUDED_
-#define EVENT2_EVENT_COMPAT_H_INCLUDED_
+#ifndef EVENT2_EVENT_COMPAT_H_INCLUDED_
+#define EVENT2_EVENT_COMPAT_H_INCLUDED_
/** @file event2/event_compat.h
@@ -41,17 +41,17 @@
@deprecated All functions in this file are by definition deprecated.
*/
-#include <event2/visibility.h>
+#include <event2/visibility.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <event2/event-config.h>
-#ifdef EVENT__HAVE_SYS_TYPES_H
+#ifdef EVENT__HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -71,7 +71,7 @@ extern "C" {
@see event_base_set(), event_base_new()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct event_base *event_init(void);
/**
@@ -85,7 +85,7 @@ struct event_base *event_init(void);
@see event_base_dispatch(), event_init()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_dispatch(void);
/**
@@ -99,7 +99,7 @@ int event_dispatch(void);
@see event_base_loop(), event_init()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_loop(int);
@@ -115,7 +115,7 @@ int event_loop(int);
@see event_init, event_base_loopexit()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_loopexit(const struct timeval *);
@@ -131,7 +131,7 @@ int event_loopexit(const struct timeval *);
@see event_base_loopbreak(), event_init()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_loopbreak(void);
/**
@@ -143,7 +143,7 @@ int event_loopbreak(void);
@see event_base_once()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_once(evutil_socket_t , short,
void (*)(evutil_socket_t, short, void *), void *, const struct timeval *);
@@ -157,7 +157,7 @@ int event_once(evutil_socket_t , short,
@see event_base_get_method()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *event_get_method(void);
@@ -170,7 +170,7 @@ const char *event_get_method(void);
@see event_base_priority_init()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int event_priority_init(int);
/**
@@ -180,7 +180,7 @@ int event_priority_init(int);
a subsequent call to event_base_set() to be safe under most circumstances.
Use event_assign() or event_new() instead.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_set(struct event *, evutil_socket_t, short, void (*)(evutil_socket_t, short, void *), void *);
#define evtimer_set(ev, cb, arg) event_set((ev), -1, 0, (cb), (arg))
@@ -227,4 +227,4 @@ void event_set(struct event *, evutil_socket_t, short, void (*)(evutil_socket_t,
}
#endif
-#endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
+#endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/event_struct.h b/contrib/libs/libevent/include/event2/event_struct.h
index 1c8b71b6b0..d6b5a5b56a 100644
--- a/contrib/libs/libevent/include/event2/event_struct.h
+++ b/contrib/libs/libevent/include/event2/event_struct.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_EVENT_STRUCT_H_INCLUDED_
-#define EVENT2_EVENT_STRUCT_H_INCLUDED_
+#ifndef EVENT2_EVENT_STRUCT_H_INCLUDED_
+#define EVENT2_EVENT_STRUCT_H_INCLUDED_
/** @file event2/event_struct.h
@@ -41,10 +41,10 @@ extern "C" {
#endif
#include <event2/event-config.h>
-#ifdef EVENT__HAVE_SYS_TYPES_H
+#ifdef EVENT__HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -54,20 +54,20 @@ extern "C" {
/* For evkeyvalq */
#include <event2/keyvalq_struct.h>
-#define EVLIST_TIMEOUT 0x01
-#define EVLIST_INSERTED 0x02
-#define EVLIST_SIGNAL 0x04
-#define EVLIST_ACTIVE 0x08
-#define EVLIST_INTERNAL 0x10
-#define EVLIST_ACTIVE_LATER 0x20
-#define EVLIST_FINALIZING 0x40
-#define EVLIST_INIT 0x80
+#define EVLIST_TIMEOUT 0x01
+#define EVLIST_INSERTED 0x02
+#define EVLIST_SIGNAL 0x04
+#define EVLIST_ACTIVE 0x08
+#define EVLIST_INTERNAL 0x10
+#define EVLIST_ACTIVE_LATER 0x20
+#define EVLIST_FINALIZING 0x40
+#define EVLIST_INIT 0x80
-#define EVLIST_ALL 0xff
+#define EVLIST_ALL 0xff
/* Fix so that people don't have to run with <sys/queue.h> */
#ifndef TAILQ_ENTRY
-#define EVENT_DEFINED_TQENTRY_
+#define EVENT_DEFINED_TQENTRY_
#define TAILQ_ENTRY(type) \
struct { \
struct type *tqe_next; /* next element */ \
@@ -76,7 +76,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; \
@@ -84,45 +84,45 @@ struct name { \
}
#endif
-/* Fix so that people don't have to run with <sys/queue.h> */
-#ifndef LIST_ENTRY
-#define EVENT_DEFINED_LISTENTRY_
-#define LIST_ENTRY(type) \
-struct { \
- struct type *le_next; /* next element */ \
- struct type **le_prev; /* address of previous next element */ \
-}
-#endif /* !LIST_ENTRY */
-
-#ifndef LIST_HEAD
-#define EVENT_DEFINED_LISTHEAD_
-#define LIST_HEAD(name, type) \
-struct name { \
- struct type *lh_first; /* first element */ \
- }
-#endif /* !LIST_HEAD */
-
-struct event;
-
-struct event_callback {
- TAILQ_ENTRY(event_callback) evcb_active_next;
- short evcb_flags;
- ev_uint8_t evcb_pri; /* smaller numbers are higher priority */
- ev_uint8_t evcb_closure;
- /* allows us to adopt for different types of events */
- union {
- void (*evcb_callback)(evutil_socket_t, short, void *);
- void (*evcb_selfcb)(struct event_callback *, void *);
- void (*evcb_evfinalize)(struct event *, void *);
- void (*evcb_cbfinalize)(struct event_callback *, void *);
- } evcb_cb_union;
- void *evcb_arg;
-};
-
+/* Fix so that people don't have to run with <sys/queue.h> */
+#ifndef LIST_ENTRY
+#define EVENT_DEFINED_LISTENTRY_
+#define LIST_ENTRY(type) \
+struct { \
+ struct type *le_next; /* next element */ \
+ struct type **le_prev; /* address of previous next element */ \
+}
+#endif /* !LIST_ENTRY */
+
+#ifndef LIST_HEAD
+#define EVENT_DEFINED_LISTHEAD_
+#define LIST_HEAD(name, type) \
+struct name { \
+ struct type *lh_first; /* first element */ \
+ }
+#endif /* !LIST_HEAD */
+
+struct event;
+
+struct event_callback {
+ TAILQ_ENTRY(event_callback) evcb_active_next;
+ short evcb_flags;
+ ev_uint8_t evcb_pri; /* smaller numbers are higher priority */
+ ev_uint8_t evcb_closure;
+ /* allows us to adopt for different types of events */
+ union {
+ void (*evcb_callback)(evutil_socket_t, short, void *);
+ void (*evcb_selfcb)(struct event_callback *, void *);
+ void (*evcb_evfinalize)(struct event *, void *);
+ void (*evcb_cbfinalize)(struct event_callback *, void *);
+ } evcb_cb_union;
+ void *evcb_arg;
+};
+
struct event_base;
struct event {
- struct event_callback ev_evcallback;
-
+ struct event_callback ev_evcallback;
+
/* for managing timeouts */
union {
TAILQ_ENTRY(event) ev_next_with_common_timeout;
@@ -135,18 +135,18 @@ struct event {
union {
/* used for io events */
struct {
- LIST_ENTRY (event) ev_io_next;
+ LIST_ENTRY (event) ev_io_next;
struct timeval ev_timeout;
} ev_io;
/* used by signal events */
struct {
- LIST_ENTRY (event) ev_signal_next;
+ LIST_ENTRY (event) ev_signal_next;
short ev_ncalls;
/* Allows deletes in callback */
short *ev_pncalls;
} ev_signal;
- } ev_;
+ } ev_;
short ev_events;
short ev_res; /* result passed to event callback */
@@ -155,26 +155,26 @@ 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
-LIST_HEAD (event_dlist, event);
-
-#ifdef EVENT_DEFINED_LISTENTRY_
-#undef LIST_ENTRY
-#endif
-
-#ifdef EVENT_DEFINED_LISTHEAD_
-#undef LIST_HEAD
-#endif
-
+LIST_HEAD (event_dlist, event);
+
+#ifdef EVENT_DEFINED_LISTENTRY_
+#undef LIST_ENTRY
+#endif
+
+#ifdef EVENT_DEFINED_LISTHEAD_
+#undef LIST_HEAD
+#endif
+
#ifdef __cplusplus
}
#endif
-#endif /* EVENT2_EVENT_STRUCT_H_INCLUDED_ */
+#endif /* EVENT2_EVENT_STRUCT_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/http.h b/contrib/libs/libevent/include/event2/http.h
index 40d411ddd2..cfb0c2c404 100644
--- a/contrib/libs/libevent/include/event2/http.h
+++ b/contrib/libs/libevent/include/event2/http.h
@@ -24,12 +24,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_HTTP_H_INCLUDED_
-#define EVENT2_HTTP_H_INCLUDED_
+#ifndef EVENT2_HTTP_H_INCLUDED_
+#define EVENT2_HTTP_H_INCLUDED_
/* For int types. */
#include <event2/util.h>
-#include <event2/visibility.h>
+#include <event2/visibility.h>
#ifdef __cplusplus
extern "C" {
@@ -39,7 +39,7 @@ extern "C" {
struct evbuffer;
struct event_base;
struct bufferevent;
-struct evhttp_connection;
+struct evhttp_connection;
/** @file event2/http.h
*
@@ -78,11 +78,11 @@ struct evdns_base;
* Create a new HTTP server.
*
* @param base (optional) the event base to receive the HTTP events
- * @return a pointer to a newly initialized evhttp server structure or NULL
- * on error
+ * @return a pointer to a newly initialized evhttp server structure or NULL
+ * on error
* @see evhttp_free()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evhttp *evhttp_new(struct event_base *base);
/**
@@ -97,7 +97,7 @@ struct evhttp *evhttp_new(struct event_base *base);
* @return 0 on success, -1 on failure.
* @see evhttp_accept_socket()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_bind_socket(struct evhttp *http, const char *address, ev_uint16_t port);
/**
@@ -111,7 +111,7 @@ int evhttp_bind_socket(struct evhttp *http, const char *address, ev_uint16_t por
* @return Handle for the socket on success, NULL on failure.
* @see evhttp_bind_socket(), evhttp_del_accept_socket()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evhttp_bound_socket *evhttp_bind_socket_with_handle(struct evhttp *http, const char *address, ev_uint16_t port);
/**
@@ -130,7 +130,7 @@ struct evhttp_bound_socket *evhttp_bind_socket_with_handle(struct evhttp *http,
* @return 0 on success, -1 on failure.
* @see evhttp_bind_socket()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_accept_socket(struct evhttp *http, evutil_socket_t fd);
/**
@@ -143,7 +143,7 @@ int evhttp_accept_socket(struct evhttp *http, evutil_socket_t fd);
* @return Handle for the socket on success, NULL on failure.
* @see evhttp_accept_socket(), evhttp_del_accept_socket()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evhttp_bound_socket *evhttp_accept_socket_with_handle(struct evhttp *http, evutil_socket_t fd);
/**
@@ -151,30 +151,30 @@ struct evhttp_bound_socket *evhttp_accept_socket_with_handle(struct evhttp *http
* returns an evhttp_bound_socket. The listener will be freed when the bound
* socket is freed.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evhttp_bound_socket *evhttp_bind_listener(struct evhttp *http, struct evconnlistener *listener);
/**
* Return the listener used to implement a bound socket.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evconnlistener *evhttp_bound_socket_get_listener(struct evhttp_bound_socket *bound);
-typedef void evhttp_bound_socket_foreach_fn(struct evhttp_bound_socket *, void *);
-/**
- * Applies the function specified in the first argument to all
- * evhttp_bound_sockets associated with "http". The user must not
- * attempt to free or remove any connections, sockets or listeners
- * in the callback "function".
- *
- * @param http pointer to an evhttp object
- * @param function function to apply to every bound socket
- * @param argument pointer value passed to function for every socket iterated
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_foreach_bound_socket(struct evhttp *http, evhttp_bound_socket_foreach_fn *function, void *argument);
-
-/**
+typedef void evhttp_bound_socket_foreach_fn(struct evhttp_bound_socket *, void *);
+/**
+ * Applies the function specified in the first argument to all
+ * evhttp_bound_sockets associated with "http". The user must not
+ * attempt to free or remove any connections, sockets or listeners
+ * in the callback "function".
+ *
+ * @param http pointer to an evhttp object
+ * @param function function to apply to every bound socket
+ * @param argument pointer value passed to function for every socket iterated
+ */
+EVENT2_EXPORT_SYMBOL
+void evhttp_foreach_bound_socket(struct evhttp *http, evhttp_bound_socket_foreach_fn *function, void *argument);
+
+/**
* Makes an HTTP server stop accepting connections on the specified socket
*
* This may be useful when a socket has been sent via file descriptor passing
@@ -191,7 +191,7 @@ void evhttp_foreach_bound_socket(struct evhttp *http, evhttp_bound_socket_foreac
* @param bound_socket a handle returned by evhttp_{bind,accept}_socket_with_handle
* @see evhttp_bind_socket_with_handle(), evhttp_accept_socket_with_handle()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_del_accept_socket(struct evhttp *http, struct evhttp_bound_socket *bound_socket);
/**
@@ -201,7 +201,7 @@ void evhttp_del_accept_socket(struct evhttp *http, struct evhttp_bound_socket *b
* @return the file descriptor used by the bound socket
* @see evhttp_bind_socket_with_handle(), evhttp_accept_socket_with_handle()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
evutil_socket_t evhttp_bound_socket_get_fd(struct evhttp_bound_socket *bound_socket);
/**
@@ -212,32 +212,32 @@ evutil_socket_t evhttp_bound_socket_get_fd(struct evhttp_bound_socket *bound_soc
* @param http the evhttp server object to be freed
* @see evhttp_start()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_free(struct evhttp* http);
/** XXX Document. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_set_max_headers_size(struct evhttp* http, ev_ssize_t max_headers_size);
/** XXX Document. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_set_max_body_size(struct evhttp* http, ev_ssize_t max_body_size);
/**
- Set the value to use for the Content-Type header when none was provided. If
- the content type string is NULL, the Content-Type header will not be
- automatically added.
-
- @param http the http server on which to set the default content type
- @param content_type the value for the Content-Type header
-*/
-EVENT2_EXPORT_SYMBOL
-void evhttp_set_default_content_type(struct evhttp *http,
- const char *content_type);
-
-void evhttp_set_bevcb(struct evhttp *http,
- struct bufferevent* (*cb)(struct event_base *, void *), void *arg);
-
-/**
+ Set the value to use for the Content-Type header when none was provided. If
+ the content type string is NULL, the Content-Type header will not be
+ automatically added.
+
+ @param http the http server on which to set the default content type
+ @param content_type the value for the Content-Type header
+*/
+EVENT2_EXPORT_SYMBOL
+void evhttp_set_default_content_type(struct evhttp *http,
+ const char *content_type);
+
+void evhttp_set_bevcb(struct evhttp *http,
+ struct bufferevent* (*cb)(struct event_base *, void *), void *arg);
+
+/**
Sets the what HTTP methods are supported in requests accepted by this
server, and passed to user callbacks.
@@ -248,7 +248,7 @@ void evhttp_set_bevcb(struct evhttp *http,
@param http the http server on which to set the methods
@param methods bit mask constructed from evhttp_cmd_type values
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_set_allowed_methods(struct evhttp* http, ev_uint16_t methods);
/**
@@ -260,16 +260,16 @@ void evhttp_set_allowed_methods(struct evhttp* http, ev_uint16_t methods);
@param cb_arg an additional context argument for the callback
@return 0 on success, -1 if the callback existed already, -2 on failure
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_set_cb(struct evhttp *http, const char *path,
void (*cb)(struct evhttp_request *, void *), void *cb_arg);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_set_chunk_cb(struct evhttp *http, const char *path,
void (*chunk_cb)(struct evhttp_request *, void *), void *cb_arg);
/** Removes the callback for a specified URI */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_del_cb(struct evhttp *, const char *);
/**
@@ -283,27 +283,27 @@ int evhttp_del_cb(struct evhttp *, const char *);
@param cb the callback to invoke for any unmatched requests
@param arg an context argument for the callback
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_set_gencb(struct evhttp *http,
void (*cb)(struct evhttp_request *, void *), void *arg);
-/**
- Set a callback used to create new bufferevents for connections
- to a given evhttp object.
-
- You can use this to override the default bufferevent type -- for example,
- to make this evhttp object use SSL bufferevents rather than unencrypted
- ones.
-
- New bufferevents must be allocated with no fd set on them.
-
- @param http the evhttp server object for which to set the callback
- @param cb the callback to invoke for incoming connections
- @param arg an context argument for the callback
- */
-EVENT2_EXPORT_SYMBOL
+/**
+ Set a callback used to create new bufferevents for connections
+ to a given evhttp object.
+
+ You can use this to override the default bufferevent type -- for example,
+ to make this evhttp object use SSL bufferevents rather than unencrypted
+ ones.
+
+ New bufferevents must be allocated with no fd set on them.
+
+ @param http the evhttp server object for which to set the callback
+ @param cb the callback to invoke for incoming connections
+ @param arg an context argument for the callback
+ */
+EVENT2_EXPORT_SYMBOL
void evhttp_set_bevcb(struct evhttp *http,
- struct bufferevent *(*cb)(struct event_base *, void *), void *arg);
+ struct bufferevent *(*cb)(struct event_base *, void *), void *arg);
/**
Adds a virtual host to the http server.
@@ -327,7 +327,7 @@ void evhttp_set_bevcb(struct evhttp *http,
@return 0 on success, -1 on failure
@see evhttp_remove_virtual_host()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_add_virtual_host(struct evhttp* http, const char *pattern,
struct evhttp* vhost);
@@ -339,7 +339,7 @@ int evhttp_add_virtual_host(struct evhttp* http, const char *pattern,
@return 0 on success, -1 on failure
@see evhttp_add_virtual_host()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_remove_virtual_host(struct evhttp* http, struct evhttp* vhost);
/**
@@ -350,7 +350,7 @@ int evhttp_remove_virtual_host(struct evhttp* http, struct evhttp* vhost);
@param alias the alias to add
@see evhttp_add_remove_alias()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_add_server_alias(struct evhttp *http, const char *alias);
/**
@@ -360,7 +360,7 @@ int evhttp_add_server_alias(struct evhttp *http, const char *alias);
@param alias the alias to remove
@see evhttp_add_server_alias()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_remove_server_alias(struct evhttp *http, const char *alias);
/**
@@ -369,38 +369,38 @@ int evhttp_remove_server_alias(struct evhttp *http, const char *alias);
* @param http an evhttp object
* @param timeout_in_secs the timeout, in seconds
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_set_timeout(struct evhttp *http, int timeout_in_secs);
-/**
- * Set the timeout for an HTTP request.
- *
- * @param http an evhttp object
- * @param tv the timeout, or NULL
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_set_timeout_tv(struct evhttp *http, const struct timeval* tv);
-
-/* Read all the clients body, and only after this respond with an error if the
- * clients body exceed max_body_size */
-#define EVHTTP_SERVER_LINGERING_CLOSE 0x0001
-/**
- * Set connection flags for HTTP server.
- *
- * @see EVHTTP_SERVER_*
- * @return 0 on success, otherwise non zero (for example if flag doesn't
- * supported).
- */
-EVENT2_EXPORT_SYMBOL
-int evhttp_set_flags(struct evhttp *http, int flags);
-
+/**
+ * Set the timeout for an HTTP request.
+ *
+ * @param http an evhttp object
+ * @param tv the timeout, or NULL
+ */
+EVENT2_EXPORT_SYMBOL
+void evhttp_set_timeout_tv(struct evhttp *http, const struct timeval* tv);
+
+/* Read all the clients body, and only after this respond with an error if the
+ * clients body exceed max_body_size */
+#define EVHTTP_SERVER_LINGERING_CLOSE 0x0001
+/**
+ * Set connection flags for HTTP server.
+ *
+ * @see EVHTTP_SERVER_*
+ * @return 0 on success, otherwise non zero (for example if flag doesn't
+ * supported).
+ */
+EVENT2_EXPORT_SYMBOL
+int evhttp_set_flags(struct evhttp *http, int flags);
+
/* Request/Response functionality */
-struct evhttp_connection *evhttp_connection_base_bufferevent_new(
- struct event_base *base, struct evdns_base *dnsbase, struct bufferevent* bev, const char *address, unsigned short port);
-
-struct bufferevent* evhttp_connection_get_bufferevent(struct evhttp_connection *evcon);
-
+struct evhttp_connection *evhttp_connection_base_bufferevent_new(
+ struct event_base *base, struct evdns_base *dnsbase, struct bufferevent* bev, const char *address, unsigned short port);
+
+struct bufferevent* evhttp_connection_get_bufferevent(struct evhttp_connection *evcon);
+
/**
* Send an HTML error message to the client.
*
@@ -409,7 +409,7 @@ struct bufferevent* evhttp_connection_get_bufferevent(struct evhttp_connection *
* @param reason a brief explanation of the error. If this is NULL, we'll
* just use the standard meaning of the error code.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_send_error(struct evhttp_request *req, int error,
const char *reason);
@@ -426,7 +426,7 @@ void evhttp_send_error(struct evhttp_request *req, int error,
* @param reason a brief message to send with the response code
* @param databuf the body of the response
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_send_reply(struct evhttp_request *req, int code,
const char *reason, struct evbuffer *databuf);
@@ -446,7 +446,7 @@ void evhttp_send_reply(struct evhttp_request *req, int code,
@param code the HTTP response code to send
@param reason a brief message to send with the response code
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_send_reply_start(struct evhttp_request *req, int code,
const char *reason);
@@ -461,33 +461,33 @@ void evhttp_send_reply_start(struct evhttp_request *req, int code,
@param req a request object
@param databuf the data chunk to send as part of the reply.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_send_reply_chunk(struct evhttp_request *req,
struct evbuffer *databuf);
-
-/**
- Send another data chunk as part of an ongoing chunked reply.
-
- The reply chunk consists of the data in databuf. After calling
- evhttp_send_reply_chunk() databuf will be empty, but the buffer is
- still owned by the caller and needs to be deallocated by the caller
- if necessary.
-
- @param req a request object
- @param databuf the data chunk to send as part of the reply.
- @param cb callback funcion
- @param call back's argument.
-*/
-EVENT2_EXPORT_SYMBOL
-void evhttp_send_reply_chunk_with_cb(struct evhttp_request *, struct evbuffer *,
- void (*cb)(struct evhttp_connection *, void *), void *arg);
-
-/**
+
+/**
+ Send another data chunk as part of an ongoing chunked reply.
+
+ The reply chunk consists of the data in databuf. After calling
+ evhttp_send_reply_chunk() databuf will be empty, but the buffer is
+ still owned by the caller and needs to be deallocated by the caller
+ if necessary.
+
+ @param req a request object
+ @param databuf the data chunk to send as part of the reply.
+ @param cb callback funcion
+ @param call back's argument.
+*/
+EVENT2_EXPORT_SYMBOL
+void evhttp_send_reply_chunk_with_cb(struct evhttp_request *, struct evbuffer *,
+ void (*cb)(struct evhttp_connection *, void *), void *arg);
+
+/**
Complete a chunked reply, freeing the request as appropriate.
@param req a request object
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_send_reply_end(struct evhttp_request *req);
/*
@@ -517,24 +517,24 @@ enum evhttp_cmd_type {
enum evhttp_request_kind { EVHTTP_REQUEST, EVHTTP_RESPONSE };
/**
- * Create and return a connection object that can be used to for making HTTP
- * requests. The connection object tries to resolve address and establish the
- * connection when it is given an http request object.
+ * Create and return a connection object that can be used to for making HTTP
+ * requests. The connection object tries to resolve address and establish the
+ * connection when it is given an http request object.
*
* @param base the event_base to use for handling the connection
* @param dnsbase the dns_base to use for resolving host names; if not
* specified host name resolution will block.
- * @param bev a bufferevent to use for connecting to the server; if NULL, a
- * socket-based bufferevent will be created. This buffrevent will be freed
- * when the connection closes. It must have no fd set on it.
+ * @param bev a bufferevent to use for connecting to the server; if NULL, a
+ * socket-based bufferevent will be created. This buffrevent will be freed
+ * when the connection closes. It must have no fd set on it.
* @param address the address to which to connect
* @param port the port to connect to
- * @return an evhttp_connection object that can be used for making requests or
- * NULL on error
+ * @return an evhttp_connection object that can be used for making requests or
+ * NULL on error
*/
-EVENT2_EXPORT_SYMBOL
-struct evhttp_connection *evhttp_connection_base_bufferevent_new(
- struct event_base *base, struct evdns_base *dnsbase, struct bufferevent* bev, const char *address, ev_uint16_t port);
+EVENT2_EXPORT_SYMBOL
+struct evhttp_connection *evhttp_connection_base_bufferevent_new(
+ struct event_base *base, struct evdns_base *dnsbase, struct bufferevent* bev, const char *address, ev_uint16_t port);
/**
* Creates and returns a new bufferevent object.
@@ -571,163 +571,163 @@ struct evhttp_connection *evhttp_connection_base_bufferevent_factory_new(
/**
* Return the bufferevent that an evhttp_connection is using.
*/
-EVENT2_EXPORT_SYMBOL
-struct bufferevent* evhttp_connection_get_bufferevent(struct evhttp_connection *evcon);
-
-/**
- * Return the HTTP server associated with this connection, or NULL.
- */
-EVENT2_EXPORT_SYMBOL
-struct evhttp *evhttp_connection_get_server(struct evhttp_connection *evcon);
-
-/**
- * Creates a new request object that needs to be filled in with the request
- * parameters. The callback is executed when the request completed or an
- * error occurred.
- */
-EVENT2_EXPORT_SYMBOL
-struct evhttp_request *evhttp_request_new(
- void (*cb)(struct evhttp_request *, void *), void *arg);
-
-/**
- * Enable delivery of chunks to requestor.
- * @param cb will be called after every read of data with the same argument
- * as the completion callback. Will never be called on an empty
- * response. May drain the input buffer; it will be drained
- * automatically on return.
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_request_set_chunked_cb(struct evhttp_request *,
- void (*cb)(struct evhttp_request *, void *), void *arg);
-
-/**
- * Register callback for additional parsing of request headers.
- * @param cb will be called after receiving and parsing the full header.
- * It allows analyzing the header and possibly closing the connection
- * by returning a value < 0.
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_request_set_header_cb(struct evhttp_request *,
- int (*cb)(struct evhttp_request *, void *));
-
-/**
- * The different error types supported by evhttp
- *
- * @see evhttp_request_set_error_cb()
- */
-enum evhttp_request_error {
- /**
- * Timeout reached, also @see evhttp_connection_set_timeout()
- */
- EVREQ_HTTP_TIMEOUT,
- /**
- * EOF reached
- */
- EVREQ_HTTP_EOF,
- /**
- * Error while reading header, or invalid header
- */
- EVREQ_HTTP_INVALID_HEADER,
- /**
- * Error encountered while reading or writing
- */
- EVREQ_HTTP_BUFFER_ERROR,
- /**
- * The evhttp_cancel_request() called on this request.
- */
- EVREQ_HTTP_REQUEST_CANCEL,
- /**
- * Body is greater then evhttp_connection_set_max_body_size()
- */
- EVREQ_HTTP_DATA_TOO_LONG
-};
-/**
- * Set a callback for errors
- * @see evhttp_request_error for error types.
- *
- * On error, both the error callback and the regular callback will be called,
- * error callback is called before the regular callback.
- **/
-EVENT2_EXPORT_SYMBOL
-void evhttp_request_set_error_cb(struct evhttp_request *,
- void (*)(enum evhttp_request_error, void *));
-
-/**
- * Set a callback to be called on request completion of evhttp_send_* function.
- *
- * The callback function will be called on the completion of the request after
- * the output data has been written and before the evhttp_request object
- * is destroyed. This can be useful for tracking resources associated with a
- * request (ex: timing metrics).
- *
- * @param req a request object
- * @param cb callback function that will be called on request completion
- * @param cb_arg an additional context argument for the callback
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_request_set_on_complete_cb(struct evhttp_request *req,
- void (*cb)(struct evhttp_request *, void *), void *cb_arg);
-
-/** Frees the request object and removes associated events. */
-EVENT2_EXPORT_SYMBOL
-void evhttp_request_free(struct evhttp_request *req);
-
-/**
- * Create and return a connection object that can be used to for making HTTP
- * requests. The connection object tries to resolve address and establish the
- * connection when it is given an http request object.
- *
- * @param base the event_base to use for handling the connection
- * @param dnsbase the dns_base to use for resolving host names; if not
- * specified host name resolution will block.
- * @param address the address to which to connect
- * @param port the port to connect to
- * @return an evhttp_connection object that can be used for making requests or
- * NULL on error
- */
-EVENT2_EXPORT_SYMBOL
-struct evhttp_connection *evhttp_connection_base_new(
- struct event_base *base, struct evdns_base *dnsbase,
- const char *address, ev_uint16_t port);
-
-/**
- * Set family hint for DNS requests.
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_set_family(struct evhttp_connection *evcon,
- int family);
-
-/* reuse connection address on retry */
-#define EVHTTP_CON_REUSE_CONNECTED_ADDR 0x0008
-/* Try to read error, since server may already send and close
- * connection, but if at that time we have some data to send then we
- * can send get EPIPE and fail, while we can read that HTTP error. */
-#define EVHTTP_CON_READ_ON_WRITE_ERROR 0x0010
-/* @see EVHTTP_SERVER_LINGERING_CLOSE */
-#define EVHTTP_CON_LINGERING_CLOSE 0x0020
-/* Padding for public flags, @see EVHTTP_CON_* in http-internal.h */
-#define EVHTTP_CON_PUBLIC_FLAGS_END 0x100000
-/**
- * Set connection flags.
- *
- * @see EVHTTP_CON_*
- * @return 0 on success, otherwise non zero (for example if flag doesn't
- * supported).
- */
-EVENT2_EXPORT_SYMBOL
-int evhttp_connection_set_flags(struct evhttp_connection *evcon,
- int flags);
-
+EVENT2_EXPORT_SYMBOL
+struct bufferevent* evhttp_connection_get_bufferevent(struct evhttp_connection *evcon);
+
+/**
+ * Return the HTTP server associated with this connection, or NULL.
+ */
+EVENT2_EXPORT_SYMBOL
+struct evhttp *evhttp_connection_get_server(struct evhttp_connection *evcon);
+
+/**
+ * Creates a new request object that needs to be filled in with the request
+ * parameters. The callback is executed when the request completed or an
+ * error occurred.
+ */
+EVENT2_EXPORT_SYMBOL
+struct evhttp_request *evhttp_request_new(
+ void (*cb)(struct evhttp_request *, void *), void *arg);
+
+/**
+ * Enable delivery of chunks to requestor.
+ * @param cb will be called after every read of data with the same argument
+ * as the completion callback. Will never be called on an empty
+ * response. May drain the input buffer; it will be drained
+ * automatically on return.
+ */
+EVENT2_EXPORT_SYMBOL
+void evhttp_request_set_chunked_cb(struct evhttp_request *,
+ void (*cb)(struct evhttp_request *, void *), void *arg);
+
+/**
+ * Register callback for additional parsing of request headers.
+ * @param cb will be called after receiving and parsing the full header.
+ * It allows analyzing the header and possibly closing the connection
+ * by returning a value < 0.
+ */
+EVENT2_EXPORT_SYMBOL
+void evhttp_request_set_header_cb(struct evhttp_request *,
+ int (*cb)(struct evhttp_request *, void *));
+
+/**
+ * The different error types supported by evhttp
+ *
+ * @see evhttp_request_set_error_cb()
+ */
+enum evhttp_request_error {
+ /**
+ * Timeout reached, also @see evhttp_connection_set_timeout()
+ */
+ EVREQ_HTTP_TIMEOUT,
+ /**
+ * EOF reached
+ */
+ EVREQ_HTTP_EOF,
+ /**
+ * Error while reading header, or invalid header
+ */
+ EVREQ_HTTP_INVALID_HEADER,
+ /**
+ * Error encountered while reading or writing
+ */
+ EVREQ_HTTP_BUFFER_ERROR,
+ /**
+ * The evhttp_cancel_request() called on this request.
+ */
+ EVREQ_HTTP_REQUEST_CANCEL,
+ /**
+ * Body is greater then evhttp_connection_set_max_body_size()
+ */
+ EVREQ_HTTP_DATA_TOO_LONG
+};
+/**
+ * Set a callback for errors
+ * @see evhttp_request_error for error types.
+ *
+ * On error, both the error callback and the regular callback will be called,
+ * error callback is called before the regular callback.
+ **/
+EVENT2_EXPORT_SYMBOL
+void evhttp_request_set_error_cb(struct evhttp_request *,
+ void (*)(enum evhttp_request_error, void *));
+
+/**
+ * Set a callback to be called on request completion of evhttp_send_* function.
+ *
+ * The callback function will be called on the completion of the request after
+ * the output data has been written and before the evhttp_request object
+ * is destroyed. This can be useful for tracking resources associated with a
+ * request (ex: timing metrics).
+ *
+ * @param req a request object
+ * @param cb callback function that will be called on request completion
+ * @param cb_arg an additional context argument for the callback
+ */
+EVENT2_EXPORT_SYMBOL
+void evhttp_request_set_on_complete_cb(struct evhttp_request *req,
+ void (*cb)(struct evhttp_request *, void *), void *cb_arg);
+
+/** Frees the request object and removes associated events. */
+EVENT2_EXPORT_SYMBOL
+void evhttp_request_free(struct evhttp_request *req);
+
+/**
+ * Create and return a connection object that can be used to for making HTTP
+ * requests. The connection object tries to resolve address and establish the
+ * connection when it is given an http request object.
+ *
+ * @param base the event_base to use for handling the connection
+ * @param dnsbase the dns_base to use for resolving host names; if not
+ * specified host name resolution will block.
+ * @param address the address to which to connect
+ * @param port the port to connect to
+ * @return an evhttp_connection object that can be used for making requests or
+ * NULL on error
+ */
+EVENT2_EXPORT_SYMBOL
+struct evhttp_connection *evhttp_connection_base_new(
+ struct event_base *base, struct evdns_base *dnsbase,
+ const char *address, ev_uint16_t port);
+
+/**
+ * Set family hint for DNS requests.
+ */
+EVENT2_EXPORT_SYMBOL
+void evhttp_connection_set_family(struct evhttp_connection *evcon,
+ int family);
+
+/* reuse connection address on retry */
+#define EVHTTP_CON_REUSE_CONNECTED_ADDR 0x0008
+/* Try to read error, since server may already send and close
+ * connection, but if at that time we have some data to send then we
+ * can send get EPIPE and fail, while we can read that HTTP error. */
+#define EVHTTP_CON_READ_ON_WRITE_ERROR 0x0010
+/* @see EVHTTP_SERVER_LINGERING_CLOSE */
+#define EVHTTP_CON_LINGERING_CLOSE 0x0020
+/* Padding for public flags, @see EVHTTP_CON_* in http-internal.h */
+#define EVHTTP_CON_PUBLIC_FLAGS_END 0x100000
+/**
+ * Set connection flags.
+ *
+ * @see EVHTTP_CON_*
+ * @return 0 on success, otherwise non zero (for example if flag doesn't
+ * supported).
+ */
+EVENT2_EXPORT_SYMBOL
+int evhttp_connection_set_flags(struct evhttp_connection *evcon,
+ int flags);
+
/** Takes ownership of the request object
*
* Can be used in a request callback to keep onto the request until
* evhttp_request_free() is explicitly called by the user.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_request_own(struct evhttp_request *req);
/** Returns 1 if the request is owned by the user */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_request_is_owned(struct evhttp_request *req);
/**
@@ -736,89 +736,89 @@ int evhttp_request_is_owned(struct evhttp_request *req);
* The user needs to either free the request explicitly or call
* evhttp_send_reply_end().
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evhttp_connection *evhttp_request_get_connection(struct evhttp_request *req);
/**
* Returns the underlying event_base for this connection
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct event_base *evhttp_connection_get_base(struct evhttp_connection *req);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_max_headers_size(struct evhttp_connection *evcon,
ev_ssize_t new_max_headers_size);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_max_body_size(struct evhttp_connection* evcon,
ev_ssize_t new_max_body_size);
/** Frees an http connection */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_connection_free(struct evhttp_connection *evcon);
-/** Disowns a given connection object
- *
- * Can be used to tell libevent to free the connection object after
- * the last request has completed or failed.
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_free_on_completion(struct evhttp_connection *evcon);
-
+/** Disowns a given connection object
+ *
+ * Can be used to tell libevent to free the connection object after
+ * the last request has completed or failed.
+ */
+EVENT2_EXPORT_SYMBOL
+void evhttp_connection_free_on_completion(struct evhttp_connection *evcon);
+
/** sets the ip address from which http connections are made */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_local_address(struct evhttp_connection *evcon,
const char *address);
/** sets the local port from which http connections are made */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_local_port(struct evhttp_connection *evcon,
ev_uint16_t port);
-/** Sets the timeout in seconds for events related to this connection */
-EVENT2_EXPORT_SYMBOL
+/** Sets the timeout in seconds for events related to this connection */
+EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_timeout(struct evhttp_connection *evcon,
int timeout_in_secs);
-/** Sets the timeout for events related to this connection. Takes a struct
- * timeval. */
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_set_timeout_tv(struct evhttp_connection *evcon,
- const struct timeval *tv);
-
-/** Sets the delay before retrying requests on this connection. This is only
- * used if evhttp_connection_set_retries is used to make the number of retries
- * at least one. Each retry after the first is twice as long as the one before
- * it. */
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_set_initial_retry_tv(struct evhttp_connection *evcon,
- const struct timeval *tv);
-
+/** Sets the timeout for events related to this connection. Takes a struct
+ * timeval. */
+EVENT2_EXPORT_SYMBOL
+void evhttp_connection_set_timeout_tv(struct evhttp_connection *evcon,
+ const struct timeval *tv);
+
+/** Sets the delay before retrying requests on this connection. This is only
+ * used if evhttp_connection_set_retries is used to make the number of retries
+ * at least one. Each retry after the first is twice as long as the one before
+ * it. */
+EVENT2_EXPORT_SYMBOL
+void evhttp_connection_set_initial_retry_tv(struct evhttp_connection *evcon,
+ const struct timeval *tv);
+
/** Sets the retry limit for this connection - -1 repeats indefinitely */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_retries(struct evhttp_connection *evcon,
int retry_max);
/** Set a callback for connection close. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_closecb(struct evhttp_connection *evcon,
void (*)(struct evhttp_connection *, void *), void *);
/** Get the remote address and port associated with this connection. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_connection_get_peer(struct evhttp_connection *evcon,
char **address, ev_uint16_t *port);
-/** Get the remote address associated with this connection.
- * extracted from getpeername() OR from nameserver.
- *
- * @return NULL if getpeername() return non success,
- * or connection is not connected,
- * otherwise it return pointer to struct sockaddr_storage */
-EVENT2_EXPORT_SYMBOL
-const struct sockaddr*
-evhttp_connection_get_addr(struct evhttp_connection *evcon);
-
+/** Get the remote address associated with this connection.
+ * extracted from getpeername() OR from nameserver.
+ *
+ * @return NULL if getpeername() return non success,
+ * or connection is not connected,
+ * otherwise it return pointer to struct sockaddr_storage */
+EVENT2_EXPORT_SYMBOL
+const struct sockaddr*
+evhttp_connection_get_addr(struct evhttp_connection *evcon);
+
/**
Make an HTTP request over the specified connection.
@@ -832,7 +832,7 @@ evhttp_connection_get_addr(struct evhttp_connection *evcon);
@return 0 on success, -1 on failure
@see evhttp_cancel_request()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_make_request(struct evhttp_connection *evcon,
struct evhttp_request *req,
enum evhttp_cmd_type type, const char *uri);
@@ -850,7 +850,7 @@ int evhttp_make_request(struct evhttp_connection *evcon,
@param req the evhttp_request to cancel; req becomes invalid after this call.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_cancel_request(struct evhttp_request *req);
/**
@@ -859,37 +859,37 @@ void evhttp_cancel_request(struct evhttp_request *req);
struct evhttp_uri;
/** Returns the request URI */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *evhttp_request_get_uri(const struct evhttp_request *req);
/** Returns the request URI (parsed) */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const struct evhttp_uri *evhttp_request_get_evhttp_uri(const struct evhttp_request *req);
/** Returns the request command */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
enum evhttp_cmd_type evhttp_request_get_command(const struct evhttp_request *req);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_request_get_response_code(const struct evhttp_request *req);
-EVENT2_EXPORT_SYMBOL
-const char * evhttp_request_get_response_code_line(const struct evhttp_request *req);
+EVENT2_EXPORT_SYMBOL
+const char * evhttp_request_get_response_code_line(const struct evhttp_request *req);
/** Returns the input headers */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evkeyvalq *evhttp_request_get_input_headers(struct evhttp_request *req);
/** Returns the output headers */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evkeyvalq *evhttp_request_get_output_headers(struct evhttp_request *req);
/** Returns the input buffer */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evbuffer *evhttp_request_get_input_buffer(struct evhttp_request *req);
/** Returns the output buffer */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evbuffer *evhttp_request_get_output_buffer(struct evhttp_request *req);
/** Returns the host associated with the request. If a client sends an absolute
URI, the host part of that is preferred. Otherwise, the input headers are
searched for a Host: header. NULL is returned if no absolute URI or Host:
header is provided. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *evhttp_request_get_host(struct evhttp_request *req);
/* Interfaces for dealing with HTTP headers */
@@ -900,10 +900,10 @@ const char *evhttp_request_get_host(struct evhttp_request *req);
@param headers the evkeyvalq object in which to find the header
@param key the name of the header to find
@returns a pointer to the value for the header or NULL if the header
- could not be found.
+ could not be found.
@see evhttp_add_header(), evhttp_remove_header()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *evhttp_find_header(const struct evkeyvalq *headers,
const char *key);
@@ -915,7 +915,7 @@ const char *evhttp_find_header(const struct evkeyvalq *headers,
@returns 0 if the header was removed, -1 otherwise.
@see evhttp_find_header(), evhttp_add_header()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_remove_header(struct evkeyvalq *headers, const char *key);
/**
@@ -927,7 +927,7 @@ int evhttp_remove_header(struct evkeyvalq *headers, const char *key);
@returns 0 on success, -1 otherwise.
@see evhttp_find_header(), evhttp_clear_headers()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_add_header(struct evkeyvalq *headers, const char *key, const char *value);
/**
@@ -935,7 +935,7 @@ int evhttp_add_header(struct evkeyvalq *headers, const char *key, const char *va
@param headers the evkeyvalq object from which to remove all headers
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_clear_headers(struct evkeyvalq *headers);
/* Miscellaneous utility functions */
@@ -952,7 +952,7 @@ void evhttp_clear_headers(struct evkeyvalq *headers);
@param str an unencoded string
@return a newly allocated URI-encoded string or NULL on failure
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
char *evhttp_encode_uri(const char *str);
/**
@@ -969,24 +969,24 @@ char *evhttp_encode_uri(const char *str);
as +, not %20.
@return a newly allocate URI-encoded string, or NULL on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
char *evhttp_uriencode(const char *str, ev_ssize_t size, int space_to_plus);
/**
Helper function to sort of decode a URI-encoded string. Unlike
- evhttp_uridecode, it decodes all plus characters that appear
+ evhttp_uridecode, it decodes all plus characters that appear
_after_ the first question mark character, but no plusses that occur
before. This is not a good way to decode URIs in whole or in part.
The returned string must be freed by the caller
@deprecated This function is deprecated; you probably want to use
- evhttp_uridecode instead.
+ evhttp_uridecode instead.
@param uri an encoded URI
@return a newly allocated unencoded URI or NULL on failure
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
char *evhttp_decode_uri(const char *uri);
/**
@@ -999,12 +999,12 @@ char *evhttp_decode_uri(const char *uri);
The returned string must be freed by the caller.
@param uri a URI-encode encoded URI
- @param decode_plus determines whether we convert '+' to space.
+ @param decode_plus determines whether we convert '+' to space.
@param size_out if size_out is not NULL, *size_out is set to the size of the
returned string
@return a newly allocated unencoded URI or NULL on failure
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
char *evhttp_uridecode(const char *uri, int decode_plus,
size_t *size_out);
@@ -1027,7 +1027,7 @@ char *evhttp_uridecode(const char *uri, int decode_plus,
@param headers the head of the evkeyval queue
@return 0 on success, -1 on failure
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_parse_query(const char *uri, struct evkeyvalq *headers);
/**
@@ -1047,7 +1047,7 @@ int evhttp_parse_query(const char *uri, struct evkeyvalq *headers);
@param headers the head of the evkeyval queue
@return 0 on success, -1 on failure
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_parse_query_str(const char *uri, struct evkeyvalq *headers);
/**
@@ -1061,31 +1061,31 @@ int evhttp_parse_query_str(const char *uri, struct evkeyvalq *headers);
* @param html an unescaped HTML string
* @return an escaped HTML string or NULL on error
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
char *evhttp_htmlescape(const char *html);
/**
* Return a new empty evhttp_uri with no fields set.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evhttp_uri *evhttp_uri_new(void);
/**
* Changes the flags set on a given URI. See EVHTTP_URI_* for
* a list of flags.
**/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_uri_set_flags(struct evhttp_uri *uri, unsigned flags);
/** Return the scheme of an evhttp_uri, or NULL if there is no scheme has
* been set and the evhttp_uri contains a Relative-Ref. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *evhttp_uri_get_scheme(const struct evhttp_uri *uri);
/**
* Return the userinfo part of an evhttp_uri, or NULL if it has no userinfo
* set.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *evhttp_uri_get_userinfo(const struct evhttp_uri *uri);
/**
* Return the host part of an evhttp_uri, or NULL if it has no host set.
@@ -1099,52 +1099,52 @@ const char *evhttp_uri_get_userinfo(const struct evhttp_uri *uri);
* "mailto:user@example.com" has a host of NULL, but "file:///etc/motd"
* has a host of "".
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *evhttp_uri_get_host(const struct evhttp_uri *uri);
/** Return the port part of an evhttp_uri, or -1 if there is no port set. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_uri_get_port(const struct evhttp_uri *uri);
/** Return the path part of an evhttp_uri, or NULL if it has no path set */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *evhttp_uri_get_path(const struct evhttp_uri *uri);
/** Return the query part of an evhttp_uri (excluding the leading "?"), or
* NULL if it has no query set */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *evhttp_uri_get_query(const struct evhttp_uri *uri);
/** Return the fragment part of an evhttp_uri (excluding the leading "#"),
* or NULL if it has no fragment set */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *evhttp_uri_get_fragment(const struct evhttp_uri *uri);
/** Set the scheme of an evhttp_uri, or clear the scheme if scheme==NULL.
* Returns 0 on success, -1 if scheme is not well-formed. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_uri_set_scheme(struct evhttp_uri *uri, const char *scheme);
/** Set the userinfo of an evhttp_uri, or clear the userinfo if userinfo==NULL.
* Returns 0 on success, -1 if userinfo is not well-formed. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_uri_set_userinfo(struct evhttp_uri *uri, const char *userinfo);
/** Set the host of an evhttp_uri, or clear the host if host==NULL.
* Returns 0 on success, -1 if host is not well-formed. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_uri_set_host(struct evhttp_uri *uri, const char *host);
/** Set the port of an evhttp_uri, or clear the port if port==-1.
* Returns 0 on success, -1 if port is not well-formed. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_uri_set_port(struct evhttp_uri *uri, int port);
/** Set the path of an evhttp_uri, or clear the path if path==NULL.
* Returns 0 on success, -1 if path is not well-formed. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_uri_set_path(struct evhttp_uri *uri, const char *path);
/** Set the query of an evhttp_uri, or clear the query if query==NULL.
* The query should not include a leading "?".
* Returns 0 on success, -1 if query is not well-formed. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_uri_set_query(struct evhttp_uri *uri, const char *query);
/** Set the fragment of an evhttp_uri, or clear the fragment if fragment==NULL.
* The fragment should not include a leading "#".
* Returns 0 on success, -1 if fragment is not well-formed. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evhttp_uri_set_fragment(struct evhttp_uri *uri, const char *fragment);
/**
@@ -1181,7 +1181,7 @@ int evhttp_uri_set_fragment(struct evhttp_uri *uri, const char *fragment);
* @return uri container to hold parsed data, or NULL if there is error
* @see evhttp_uri_free()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evhttp_uri *evhttp_uri_parse_with_flags(const char *source_uri,
unsigned flags);
@@ -1200,7 +1200,7 @@ struct evhttp_uri *evhttp_uri_parse_with_flags(const char *source_uri,
#define EVHTTP_URI_NONCONFORMANT 0x01
/** Alias for evhttp_uri_parse_with_flags(source_uri, 0) */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evhttp_uri *evhttp_uri_parse(const char *source_uri);
/**
@@ -1210,7 +1210,7 @@ struct evhttp_uri *evhttp_uri_parse(const char *source_uri);
* @param uri container with parsed data
* @see evhttp_uri_parse()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_uri_free(struct evhttp_uri *uri);
/**
@@ -1226,11 +1226,11 @@ void evhttp_uri_free(struct evhttp_uri *uri);
* @return an joined uri as string or NULL on error
* @see evhttp_uri_parse()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
char *evhttp_uri_join(struct evhttp_uri *uri, char *buf, size_t limit);
#ifdef __cplusplus
}
#endif
-#endif /* EVENT2_HTTP_H_INCLUDED_ */
+#endif /* EVENT2_HTTP_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/http_compat.h b/contrib/libs/libevent/include/event2/http_compat.h
index 794a581083..7bad9bf22f 100644
--- a/contrib/libs/libevent/include/event2/http_compat.h
+++ b/contrib/libs/libevent/include/event2/http_compat.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_HTTP_COMPAT_H_INCLUDED_
-#define EVENT2_HTTP_COMPAT_H_INCLUDED_
+#ifndef EVENT2_HTTP_COMPAT_H_INCLUDED_
+#define EVENT2_HTTP_COMPAT_H_INCLUDED_
/** @file event2/http_compat.h
@@ -39,10 +39,10 @@ extern "C" {
#endif
#include <event2/event-config.h>
-#ifdef EVENT__HAVE_SYS_TYPES_H
+#ifdef EVENT__HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -56,11 +56,11 @@ extern "C" {
*
* @param address the address to which the HTTP server should be bound
* @param port the port number on which the HTTP server should listen
- * @return a pointer to a newly initialized evhttp server structure
- * or NULL on error
+ * @return a pointer to a newly initialized evhttp server structure
+ * or NULL on error
*/
-EVENT2_EXPORT_SYMBOL
-struct evhttp *evhttp_start(const char *address, ev_uint16_t port);
+EVENT2_EXPORT_SYMBOL
+struct evhttp *evhttp_start(const char *address, ev_uint16_t port);
/**
* A connection object that can be used to for making HTTP requests. The
@@ -69,9 +69,9 @@ struct evhttp *evhttp_start(const char *address, ev_uint16_t port);
*
* @deprecated It does not allow an event base to be specified
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evhttp_connection *evhttp_connection_new(
- const char *address, ev_uint16_t port);
+ const char *address, ev_uint16_t port);
/**
* Associates an event base with the connection - can only be called
@@ -79,7 +79,7 @@ struct evhttp_connection *evhttp_connection_new(
*
* @deprecated XXXX Why?
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_base(struct evhttp_connection *evcon,
struct event_base *base);
@@ -91,4 +91,4 @@ void evhttp_connection_set_base(struct evhttp_connection *evcon,
}
#endif
-#endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
+#endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/http_struct.h b/contrib/libs/libevent/include/event2/http_struct.h
index 2691c8c037..55d2335dd2 100644
--- a/contrib/libs/libevent/include/event2/http_struct.h
+++ b/contrib/libs/libevent/include/event2/http_struct.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_HTTP_STRUCT_H_INCLUDED_
-#define EVENT2_HTTP_STRUCT_H_INCLUDED_
+#ifndef EVENT2_HTTP_STRUCT_H_INCLUDED_
+#define EVENT2_HTTP_STRUCT_H_INCLUDED_
/** @file event2/http_struct.h
@@ -39,10 +39,10 @@ extern "C" {
#endif
#include <event2/event-config.h>
-#ifdef EVENT__HAVE_SYS_TYPES_H
+#ifdef EVENT__HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -123,33 +123,33 @@ struct {
*/
void (*chunk_cb)(struct evhttp_request *, void *);
void *chunk_cb_arg;
-
- /*
- * Callback added for forked-daapd so they can collect ICY
- * (shoutcast) metadata from the http header. If return
- * int is negative the connection will be closed.
- */
- int (*header_cb)(struct evhttp_request *, void *);
-
- /*
- * Error callback - called when error is occured.
- * @see evhttp_request_error for error types.
- *
- * @see evhttp_request_set_error_cb()
- */
- void (*error_cb)(enum evhttp_request_error, void *);
-
- /*
- * Send complete callback - called when the request is actually
- * sent and completed.
- */
- void (*on_complete_cb)(struct evhttp_request *, void *);
- void *on_complete_cb_arg;
+
+ /*
+ * Callback added for forked-daapd so they can collect ICY
+ * (shoutcast) metadata from the http header. If return
+ * int is negative the connection will be closed.
+ */
+ int (*header_cb)(struct evhttp_request *, void *);
+
+ /*
+ * Error callback - called when error is occured.
+ * @see evhttp_request_error for error types.
+ *
+ * @see evhttp_request_set_error_cb()
+ */
+ void (*error_cb)(enum evhttp_request_error, void *);
+
+ /*
+ * Send complete callback - called when the request is actually
+ * sent and completed.
+ */
+ void (*on_complete_cb)(struct evhttp_request *, void *);
+ void *on_complete_cb_arg;
};
#ifdef __cplusplus
}
#endif
-#endif /* EVENT2_HTTP_STRUCT_H_INCLUDED_ */
+#endif /* EVENT2_HTTP_STRUCT_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/keyvalq_struct.h b/contrib/libs/libevent/include/event2/keyvalq_struct.h
index bffa54b3a7..def0a525fb 100644
--- a/contrib/libs/libevent/include/event2/keyvalq_struct.h
+++ b/contrib/libs/libevent/include/event2/keyvalq_struct.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
-#define EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
+#ifndef EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
+#define EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
@@ -34,7 +34,7 @@ extern "C" {
/* Fix so that people don't have to run with <sys/queue.h> */
/* XXXX This code is duplicated with event_struct.h */
#ifndef TAILQ_ENTRY
-#define EVENT_DEFINED_TQENTRY_
+#define EVENT_DEFINED_TQENTRY_
#define TAILQ_ENTRY(type) \
struct { \
struct type *tqe_next; /* next element */ \
@@ -43,7 +43,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; \
@@ -65,11 +65,11 @@ struct evkeyval {
TAILQ_HEAD (evkeyvalq, evkeyval);
/* XXXX This code is duplicated with event_struct.h */
-#ifdef EVENT_DEFINED_TQENTRY_
+#ifdef EVENT_DEFINED_TQENTRY_
#undef TAILQ_ENTRY
#endif
-#ifdef EVENT_DEFINED_TQHEAD_
+#ifdef EVENT_DEFINED_TQHEAD_
#undef TAILQ_HEAD
#endif
diff --git a/contrib/libs/libevent/include/event2/listener.h b/contrib/libs/libevent/include/event2/listener.h
index 789a27c2aa..b82d6d2c29 100644
--- a/contrib/libs/libevent/include/event2/listener.h
+++ b/contrib/libs/libevent/include/event2/listener.h
@@ -24,11 +24,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_LISTENER_H_INCLUDED_
-#define EVENT2_LISTENER_H_INCLUDED_
-
-#include <event2/visibility.h>
+#ifndef EVENT2_LISTENER_H_INCLUDED_
+#define EVENT2_LISTENER_H_INCLUDED_
+#include <event2/visibility.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -71,44 +71,44 @@ typedef void (*evconnlistener_errorcb)(struct evconnlistener *, void *);
/** Flag: Indicates that the listener should be locked so it's safe to use
* from multiple threadcs at once. */
#define LEV_OPT_THREADSAFE (1u<<4)
-/** Flag: Indicates that the listener should be created in disabled
- * state. Use evconnlistener_enable() to enable it later. */
-#define LEV_OPT_DISABLED (1u<<5)
-/** Flag: Indicates that the listener should defer accept() until data is
- * available, if possible. Ignored on platforms that do not support this.
- *
- * This option can help performance for protocols where the client transmits
- * immediately after connecting. Do not use this option if your protocol
- * _doesn't_ start out with the client transmitting data, since in that case
- * this option will sometimes cause the kernel to never tell you about the
- * connection.
- *
- * This option is only supported by evconnlistener_new_bind(): it can't
- * work with evconnlistener_new_fd(), since the listener needs to be told
- * to use the option before it is actually bound.
- */
-#define LEV_OPT_DEFERRED_ACCEPT (1u<<6)
-/** Flag: Indicates that we ask to allow multiple servers (processes or
- * threads) to bind to the same port if they each set the option.
+/** Flag: Indicates that the listener should be created in disabled
+ * state. Use evconnlistener_enable() to enable it later. */
+#define LEV_OPT_DISABLED (1u<<5)
+/** Flag: Indicates that the listener should defer accept() until data is
+ * available, if possible. Ignored on platforms that do not support this.
*
- * SO_REUSEPORT is what most people would expect SO_REUSEADDR to be, however
- * SO_REUSEPORT does not imply SO_REUSEADDR.
- *
- * This is only available on Linux and kernel 3.9+
- */
-#define LEV_OPT_REUSEABLE_PORT (1u<<7)
-/** Flag: Indicates that the listener wants to work only in IPv6 socket.
- *
- * According to RFC3493 and most Linux distributions, default value is to
- * work in IPv4-mapped mode. If there is a requirement to bind same port
- * on same ip addresses but different handlers for both IPv4 and IPv6,
- * it is required to set IPV6_V6ONLY socket option to be sure that the
- * code works as expected without affected by bindv6only sysctl setting in
- * system.
- *
- * This socket option also supported by Windows.
- */
-#define LEV_OPT_BIND_IPV6ONLY (1u<<8)
+ * This option can help performance for protocols where the client transmits
+ * immediately after connecting. Do not use this option if your protocol
+ * _doesn't_ start out with the client transmitting data, since in that case
+ * this option will sometimes cause the kernel to never tell you about the
+ * connection.
+ *
+ * This option is only supported by evconnlistener_new_bind(): it can't
+ * work with evconnlistener_new_fd(), since the listener needs to be told
+ * to use the option before it is actually bound.
+ */
+#define LEV_OPT_DEFERRED_ACCEPT (1u<<6)
+/** Flag: Indicates that we ask to allow multiple servers (processes or
+ * threads) to bind to the same port if they each set the option.
+ *
+ * SO_REUSEPORT is what most people would expect SO_REUSEADDR to be, however
+ * SO_REUSEPORT does not imply SO_REUSEADDR.
+ *
+ * This is only available on Linux and kernel 3.9+
+ */
+#define LEV_OPT_REUSEABLE_PORT (1u<<7)
+/** Flag: Indicates that the listener wants to work only in IPv6 socket.
+ *
+ * According to RFC3493 and most Linux distributions, default value is to
+ * work in IPv4-mapped mode. If there is a requirement to bind same port
+ * on same ip addresses but different handlers for both IPv4 and IPv6,
+ * it is required to set IPV6_V6ONLY socket option to be sure that the
+ * code works as expected without affected by bindv6only sysctl setting in
+ * system.
+ *
+ * This socket option also supported by Windows.
+ */
+#define LEV_OPT_BIND_IPV6ONLY (1u<<8)
/**
Allocate a new evconnlistener object to listen for incoming TCP connections
@@ -127,7 +127,7 @@ typedef void (*evconnlistener_errorcb)(struct evconnlistener *, void *);
file descriptor, and it should already be bound to an appropriate
port and address.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evconnlistener *evconnlistener_new(struct event_base *base,
evconnlistener_cb cb, void *ptr, unsigned flags, int backlog,
evutil_socket_t fd);
@@ -146,42 +146,42 @@ struct evconnlistener *evconnlistener_new(struct event_base *base,
@param addr The address to listen for connections on.
@param socklen The length of the address.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evconnlistener *evconnlistener_new_bind(struct event_base *base,
evconnlistener_cb cb, void *ptr, unsigned flags, int backlog,
const struct sockaddr *sa, int socklen);
/**
Disable and deallocate an evconnlistener.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evconnlistener_free(struct evconnlistener *lev);
/**
Re-enable an evconnlistener that has been disabled.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evconnlistener_enable(struct evconnlistener *lev);
/**
Stop listening for connections on an evconnlistener.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evconnlistener_disable(struct evconnlistener *lev);
/** Return an evconnlistener's associated event_base. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct event_base *evconnlistener_get_base(struct evconnlistener *lev);
/** Return the socket that an evconnlistner is listening on. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
evutil_socket_t evconnlistener_get_fd(struct evconnlistener *lev);
/** Change the callback on the listener to cb and its user_data to arg.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evconnlistener_set_cb(struct evconnlistener *lev,
evconnlistener_cb cb, void *arg);
/** Set an evconnlistener's error callback. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evconnlistener_set_error_cb(struct evconnlistener *lev,
evconnlistener_errorcb errorcb);
diff --git a/contrib/libs/libevent/include/event2/rpc.h b/contrib/libs/libevent/include/event2/rpc.h
index 1bc31d5711..d59ca3dfe6 100644
--- a/contrib/libs/libevent/include/event2/rpc.h
+++ b/contrib/libs/libevent/include/event2/rpc.h
@@ -24,13 +24,13 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_RPC_H_INCLUDED_
-#define EVENT2_RPC_H_INCLUDED_
-
-/* For int types. */
-#include <event2/util.h>
-#include <event2/visibility.h>
+#ifndef EVENT2_RPC_H_INCLUDED_
+#define EVENT2_RPC_H_INCLUDED_
+/* For int types. */
+#include <event2/util.h>
+#include <event2/visibility.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -80,7 +80,7 @@ extern "C" {
#define EVTAG_HAS(msg, member) \
((msg)->member##_set == 1)
-#ifndef EVENT2_RPC_COMPAT_H_INCLUDED_
+#ifndef EVENT2_RPC_COMPAT_H_INCLUDED_
/**
Assigns a value to the member in the message.
@@ -123,7 +123,7 @@ extern "C" {
#define EVTAG_GET_WITH_LEN(msg, member, pvalue, plen) \
(*(msg)->base->member##_get)((msg), (pvalue), (plen))
-#endif /* EVENT2_RPC_COMPAT_H_INCLUDED_ */
+#endif /* EVENT2_RPC_COMPAT_H_INCLUDED_ */
/**
Adds a value to an array.
@@ -182,7 +182,7 @@ EVRPC_STRUCT(rpcname) { \
struct evhttp_request* http_req; \
struct evbuffer* rpc_data; \
}; \
-EVENT2_EXPORT_SYMBOL \
+EVENT2_EXPORT_SYMBOL \
int evrpc_send_request_##rpcname(struct evrpc_pool *, \
struct reqstruct *, struct rplystruct *, \
void (*)(struct evrpc_status *, \
@@ -192,7 +192,7 @@ int evrpc_send_request_##rpcname(struct evrpc_pool *, \
struct evrpc_pool;
/** use EVRPC_GENERATE instead */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evrpc_request_wrapper *evrpc_make_request_ctx(
struct evrpc_pool *pool, void *request, void *reply,
const char *rpcname,
@@ -263,13 +263,13 @@ struct evrpc_request_wrapper *evrpc_make_request_ctx(
#define EVRPC_REQUEST_HTTP(rpc_req) (rpc_req)->http_req
/** completes the server response to an rpc request */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evrpc_request_done(struct evrpc_req_generic *req);
/** accessors for request and reply */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void *evrpc_get_request(struct evrpc_req_generic *req);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void *evrpc_get_reply(struct evrpc_req_generic *req);
/** Creates the reply to an RPC request
@@ -281,8 +281,8 @@ void *evrpc_get_reply(struct evrpc_req_generic *req);
* @param rpc_req the rpc request structure provided to the server callback
*/
#define EVRPC_REQUEST_DONE(rpc_req) do { \
- struct evrpc_req_generic *req_ = (struct evrpc_req_generic *)(rpc_req); \
- evrpc_request_done(req_); \
+ struct evrpc_req_generic *req_ = (struct evrpc_req_generic *)(rpc_req); \
+ evrpc_request_done(req_); \
} while (0)
@@ -294,10 +294,10 @@ struct evhttp;
/** Creates a new rpc base from which RPC requests can be received
*
* @param server a pointer to an existing HTTP server
- * @return a newly allocated evrpc_base struct or NULL if an error occurred
+ * @return a newly allocated evrpc_base struct or NULL if an error occurred
* @see evrpc_free()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evrpc_base *evrpc_init(struct evhttp *server);
/**
@@ -308,7 +308,7 @@ struct evrpc_base *evrpc_init(struct evhttp *server);
* @param base the evrpc_base object to be freed
* @see evrpc_init
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evrpc_free(struct evrpc_base *base);
/** register RPCs with the HTTP Server
@@ -330,10 +330,10 @@ void evrpc_free(struct evrpc_base *base);
#define EVRPC_REGISTER(base, name, request, reply, callback, cbarg) \
evrpc_register_generic(base, #name, \
(void (*)(struct evrpc_req_generic *, void *))callback, cbarg, \
- (void *(*)(void *))request##_new_with_arg, NULL, \
+ (void *(*)(void *))request##_new_with_arg, NULL, \
(void (*)(void *))request##_free, \
(int (*)(void *, struct evbuffer *))request##_unmarshal, \
- (void *(*)(void *))reply##_new_with_arg, NULL, \
+ (void *(*)(void *))reply##_new_with_arg, NULL, \
(void (*)(void *))reply##_free, \
(int (*)(void *))reply##_complete, \
(void (*)(struct evbuffer *, void *))reply##_marshal)
@@ -345,7 +345,7 @@ void evrpc_free(struct evrpc_base *base);
@see EVRPC_REGISTER()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evrpc_register_rpc(struct evrpc_base *, struct evrpc *,
void (*)(struct evrpc_req_generic*, void *), void *);
@@ -359,7 +359,7 @@ int evrpc_register_rpc(struct evrpc_base *, struct evrpc *,
*/
#define EVRPC_UNREGISTER(base, name) evrpc_unregister_rpc((base), #name)
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evrpc_unregister_rpc(struct evrpc_base *base, const char *name);
/*
@@ -398,7 +398,7 @@ struct evrpc_status;
@returns 0 on success, -1 otherwise.
@see EVRPC_MAKE_REQUEST(), EVRPC_MAKE_CTX()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evrpc_make_request(struct evrpc_request_wrapper *ctx);
/** creates an rpc connection pool
@@ -408,18 +408,18 @@ int evrpc_make_request(struct evrpc_request_wrapper *ctx);
*
* @param base a pointer to an struct event_based object; can be left NULL
* in singled-threaded applications
- * @return a newly allocated struct evrpc_pool object or NULL if an error
- * occurred
+ * @return a newly allocated struct evrpc_pool object or NULL if an error
+ * occurred
* @see evrpc_pool_free()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evrpc_pool *evrpc_pool_new(struct event_base *base);
/** frees an rpc connection pool
*
* @param pool a pointer to an evrpc_pool allocated via evrpc_pool_new()
* @see evrpc_pool_new()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evrpc_pool_free(struct evrpc_pool *pool);
/**
@@ -430,7 +430,7 @@ void evrpc_pool_free(struct evrpc_pool *pool);
* @param pool the pool to which to add the connection
* @param evcon the connection to add to the pool.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evrpc_pool_add_connection(struct evrpc_pool *pool,
struct evhttp_connection *evcon);
@@ -442,7 +442,7 @@ void evrpc_pool_add_connection(struct evrpc_pool *pool,
* @param pool the pool from which to remove the connection
* @param evcon the connection to remove from the pool.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evrpc_pool_remove_connection(struct evrpc_pool *pool,
struct evhttp_connection *evcon);
@@ -461,7 +461,7 @@ void evrpc_pool_remove_connection(struct evrpc_pool *pool,
* @param timeout_in_secs the number of seconds after which a request should
* timeout and a failure be returned to the callback.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evrpc_pool_set_timeout(struct evrpc_pool *pool, int timeout_in_secs);
/**
@@ -474,7 +474,7 @@ enum EVRPC_HOOK_TYPE {
EVRPC_OUTPUT /**< apply the function to an output hook */
};
-#ifndef _WIN32
+#ifndef _WIN32
/** Deprecated alias for EVRPC_INPUT. Not available on windows, where it
* conflicts with platform headers. */
#define INPUT EVRPC_INPUT
@@ -509,7 +509,7 @@ enum EVRPC_HOOK_RESULT {
* @return a handle to the hook so it can be removed later
* @see evrpc_remove_hook()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void *evrpc_add_hook(void *vbase,
enum EVRPC_HOOK_TYPE hook_type,
int (*cb)(void *, struct evhttp_request *, struct evbuffer *, void *),
@@ -523,7 +523,7 @@ void *evrpc_add_hook(void *vbase,
* @return 1 on success or 0 on failure
* @see evrpc_add_hook()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evrpc_remove_hook(void *vbase,
enum EVRPC_HOOK_TYPE hook_type,
void *handle);
@@ -533,8 +533,8 @@ int evrpc_remove_hook(void *vbase,
* @param vbase a pointer to either struct evrpc_base or struct evrpc_pool
* @param ctx the context pointer provided to the original hook call
*/
-EVENT2_EXPORT_SYMBOL
-int evrpc_resume_request(void *vbase, void *ctx, enum EVRPC_HOOK_RESULT res);
+EVENT2_EXPORT_SYMBOL
+int evrpc_resume_request(void *vbase, void *ctx, enum EVRPC_HOOK_RESULT res);
/** adds meta data to request
*
@@ -547,7 +547,7 @@ int evrpc_resume_request(void *vbase, void *ctx, enum EVRPC_HOOK_RESULT res);
* @param data the data to be associated with the key
* @param data_size the size of the data
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evrpc_hook_add_meta(void *ctx, const char *key,
const void *data, size_t data_size);
@@ -561,7 +561,7 @@ void evrpc_hook_add_meta(void *ctx, const char *key,
* @param data_size pointer to the size of the data
* @return 0 on success or -1 on failure
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evrpc_hook_find_meta(void *ctx, const char *key,
void **data, size_t *data_size);
@@ -569,10 +569,10 @@ int evrpc_hook_find_meta(void *ctx, const char *key,
* returns the connection object associated with the request
*
* @param ctx the context provided to the hook call
- * @return a pointer to the evhttp_connection object or NULL if an error
- * occurred
+ * @return a pointer to the evhttp_connection object or NULL if an error
+ * occurred
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evhttp_connection *evrpc_hook_get_connection(void *ctx);
/**
@@ -582,7 +582,7 @@ struct evhttp_connection *evrpc_hook_get_connection(void *ctx);
@see EVRPC_MAKE_REQUEST()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evrpc_send_request_generic(struct evrpc_pool *pool,
void *request, void *reply,
void (*cb)(struct evrpc_status *, void *, void *, void *),
@@ -599,8 +599,8 @@ int evrpc_send_request_generic(struct evrpc_pool *pool,
@see EVRPC_REGISTER()
*/
-EVENT2_EXPORT_SYMBOL
-int evrpc_register_generic(struct evrpc_base *base, const char *name,
+EVENT2_EXPORT_SYMBOL
+int evrpc_register_generic(struct evrpc_base *base, const char *name,
void (*callback)(struct evrpc_req_generic *, void *), void *cbarg,
void *(*req_new)(void *), void *req_new_arg, void (*req_free)(void *),
int (*req_unmarshal)(void *, struct evbuffer *),
@@ -609,12 +609,12 @@ int evrpc_register_generic(struct evrpc_base *base, const char *name,
void (*rpl_marshal)(struct evbuffer *, void *));
/** accessors for obscure and undocumented functionality */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
struct evrpc_pool* evrpc_request_get_pool(struct evrpc_request_wrapper *ctx);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evrpc_request_set_pool(struct evrpc_request_wrapper *ctx,
struct evrpc_pool *pool);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evrpc_request_set_cb(struct evrpc_request_wrapper *ctx,
void (*cb)(struct evrpc_status*, void *request, void *reply, void *arg),
void *cb_arg);
@@ -623,4 +623,4 @@ void evrpc_request_set_cb(struct evrpc_request_wrapper *ctx,
}
#endif
-#endif /* EVENT2_RPC_H_INCLUDED_ */
+#endif /* EVENT2_RPC_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/rpc_compat.h b/contrib/libs/libevent/include/event2/rpc_compat.h
index 8d8334d25f..74634a0d7f 100644
--- a/contrib/libs/libevent/include/event2/rpc_compat.h
+++ b/contrib/libs/libevent/include/event2/rpc_compat.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_RPC_COMPAT_H_INCLUDED_
-#define EVENT2_RPC_COMPAT_H_INCLUDED_
+#ifndef EVENT2_RPC_COMPAT_H_INCLUDED_
+#define EVENT2_RPC_COMPAT_H_INCLUDED_
/** @file event2/rpc_compat.h
@@ -58,4 +58,4 @@ extern "C" {
}
#endif
-#endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
+#endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/rpc_struct.h b/contrib/libs/libevent/include/event2/rpc_struct.h
index f3cb460aed..b60eff2425 100644
--- a/contrib/libs/libevent/include/event2/rpc_struct.h
+++ b/contrib/libs/libevent/include/event2/rpc_struct.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_RPC_STRUCT_H_INCLUDED_
-#define EVENT2_RPC_STRUCT_H_INCLUDED_
+#ifndef EVENT2_RPC_STRUCT_H_INCLUDED_
+#define EVENT2_RPC_STRUCT_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
@@ -38,16 +38,16 @@ extern "C" {
*/
-/* Fix so that people don't have to run with <sys/queue.h> */
-#ifndef TAILQ_ENTRY
-#define EVENT_DEFINED_TQENTRY_
-#define TAILQ_ENTRY(type) \
-struct { \
- struct type *tqe_next; /* next element */ \
- struct type **tqe_prev; /* address of previous next element */ \
-}
-#endif /* !TAILQ_ENTRY */
-
+/* Fix so that people don't have to run with <sys/queue.h> */
+#ifndef TAILQ_ENTRY
+#define EVENT_DEFINED_TQENTRY_
+#define TAILQ_ENTRY(type) \
+struct { \
+ struct type *tqe_next; /* next element */ \
+ struct type **tqe_prev; /* address of previous next element */ \
+}
+#endif /* !TAILQ_ENTRY */
+
/**
* provides information about the completed RPC request.
*/
@@ -103,12 +103,12 @@ struct evrpc {
struct evrpc_base *base;
};
-#ifdef EVENT_DEFINED_TQENTRY_
-#undef TAILQ_ENTRY
-#endif
-
+#ifdef EVENT_DEFINED_TQENTRY_
+#undef TAILQ_ENTRY
+#endif
+
#ifdef __cplusplus
}
#endif
-#endif /* EVENT2_RPC_STRUCT_H_INCLUDED_ */
+#endif /* EVENT2_RPC_STRUCT_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/tag.h b/contrib/libs/libevent/include/event2/tag.h
index 2f73bfc00e..19fc6d56a1 100644
--- a/contrib/libs/libevent/include/event2/tag.h
+++ b/contrib/libs/libevent/include/event2/tag.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_TAG_H_INCLUDED_
-#define EVENT2_TAG_H_INCLUDED_
+#ifndef EVENT2_TAG_H_INCLUDED_
+#define EVENT2_TAG_H_INCLUDED_
/** @file event2/tag.h
@@ -33,17 +33,17 @@
*/
-#include <event2/visibility.h>
-
+#include <event2/visibility.h>
+
#ifdef __cplusplus
extern "C" {
#endif
#include <event2/event-config.h>
-#ifdef EVENT__HAVE_SYS_TYPES_H
+#ifdef EVENT__HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -58,7 +58,7 @@ struct evbuffer;
* known ones - and we can just ignore the end of an event buffer.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evtag_init(void);
/**
@@ -68,13 +68,13 @@ void evtag_init(void);
@param ptag a pointer in which the tag id is being stored
@returns -1 on failure or the number of bytes in the remaining payload.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_unmarshal_header(struct evbuffer *evbuf, ev_uint32_t *ptag);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evtag_marshal(struct evbuffer *evbuf, ev_uint32_t tag, const void *data,
ev_uint32_t len);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evtag_marshal_buffer(struct evbuffer *evbuf, ev_uint32_t tag,
struct evbuffer *data);
@@ -88,54 +88,54 @@ void evtag_marshal_buffer(struct evbuffer *evbuf, ev_uint32_t tag,
@param evbuf evbuffer to store the encoded number
@param number a 32-bit integer
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evtag_encode_int(struct evbuffer *evbuf, ev_uint32_t number);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evtag_encode_int64(struct evbuffer *evbuf, ev_uint64_t number);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evtag_marshal_int(struct evbuffer *evbuf, ev_uint32_t tag,
ev_uint32_t integer);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evtag_marshal_int64(struct evbuffer *evbuf, ev_uint32_t tag,
ev_uint64_t integer);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evtag_marshal_string(struct evbuffer *buf, ev_uint32_t tag,
const char *string);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evtag_marshal_timeval(struct evbuffer *evbuf, ev_uint32_t tag,
struct timeval *tv);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_unmarshal(struct evbuffer *src, ev_uint32_t *ptag,
struct evbuffer *dst);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_peek(struct evbuffer *evbuf, ev_uint32_t *ptag);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_peek_length(struct evbuffer *evbuf, ev_uint32_t *plength);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_payload_length(struct evbuffer *evbuf, ev_uint32_t *plength);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_consume(struct evbuffer *evbuf);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_unmarshal_int(struct evbuffer *evbuf, ev_uint32_t need_tag,
ev_uint32_t *pinteger);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_unmarshal_int64(struct evbuffer *evbuf, ev_uint32_t need_tag,
ev_uint64_t *pinteger);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_unmarshal_fixed(struct evbuffer *src, ev_uint32_t need_tag,
void *data, size_t len);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_unmarshal_string(struct evbuffer *evbuf, ev_uint32_t need_tag,
char **pstring);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evtag_unmarshal_timeval(struct evbuffer *evbuf, ev_uint32_t need_tag,
struct timeval *ptv);
@@ -143,4 +143,4 @@ int evtag_unmarshal_timeval(struct evbuffer *evbuf, ev_uint32_t need_tag,
}
#endif
-#endif /* EVENT2_TAG_H_INCLUDED_ */
+#endif /* EVENT2_TAG_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/tag_compat.h b/contrib/libs/libevent/include/event2/tag_compat.h
index a276c0d35b..8087a2ac45 100644
--- a/contrib/libs/libevent/include/event2/tag_compat.h
+++ b/contrib/libs/libevent/include/event2/tag_compat.h
@@ -24,8 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_TAG_COMPAT_H_INCLUDED_
-#define EVENT2_TAG_COMPAT_H_INCLUDED_
+#ifndef EVENT2_TAG_COMPAT_H_INCLUDED_
+#define EVENT2_TAG_COMPAT_H_INCLUDED_
/** @file event2/tag_compat.h
@@ -46,4 +46,4 @@
#define encode_int64(evbuf, number) evtag_encode_int64((evbuf), (number))
/**@}*/
-#endif /* EVENT2_TAG_H_INCLUDED_ */
+#endif /* EVENT2_TAG_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/thread.h b/contrib/libs/libevent/include/event2/thread.h
index b51998631b..2a1f4c7b95 100644
--- a/contrib/libs/libevent/include/event2/thread.h
+++ b/contrib/libs/libevent/include/event2/thread.h
@@ -23,8 +23,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_THREAD_H_INCLUDED_
-#define EVENT2_THREAD_H_INCLUDED_
+#ifndef EVENT2_THREAD_H_INCLUDED_
+#define EVENT2_THREAD_H_INCLUDED_
/** @file event2/thread.h
@@ -46,8 +46,8 @@
*/
-#include <event2/visibility.h>
-
+#include <event2/visibility.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -71,7 +71,7 @@ extern "C" {
#define EVTHREAD_TRY 0x10
/**@}*/
-#if !defined(EVENT__DISABLE_THREAD_SUPPORT) || defined(EVENT_IN_DOXYGEN_)
+#if !defined(EVENT__DISABLE_THREAD_SUPPORT) || defined(EVENT_IN_DOXYGEN_)
#define EVTHREAD_LOCK_API_VERSION 1
@@ -126,7 +126,7 @@ struct evthread_lock_callbacks {
* probably shouldn't call this function; instead, use
* evthread_use_windows_threads() or evthread_use_posix_threads() if you can.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evthread_set_lock_callbacks(const struct evthread_lock_callbacks *);
#define EVTHREAD_CONDITION_API_VERSION 1
@@ -177,7 +177,7 @@ struct evthread_condition_callbacks {
* probably shouldn't call this function; instead, use
* evthread_use_windows_threads() or evthread_use_pthreads() if you can.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evthread_set_condition_callbacks(
const struct evthread_condition_callbacks *);
@@ -188,16 +188,16 @@ int evthread_set_condition_callbacks(
@param id_fn the identify function Libevent should invoke to
determine the identity of a thread.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evthread_set_id_callback(
unsigned long (*id_fn)(void));
-#if (defined(_WIN32) && !defined(EVENT__DISABLE_THREAD_SUPPORT)) || defined(EVENT_IN_DOXYGEN_)
+#if (defined(_WIN32) && !defined(EVENT__DISABLE_THREAD_SUPPORT)) || defined(EVENT_IN_DOXYGEN_)
/** Sets up Libevent for use with Windows builtin locking and thread ID
functions. Unavailable if Libevent is not built for Windows.
@return 0 on success, -1 on failure. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evthread_use_windows_threads(void);
/**
Defined if Libevent was built with support for evthread_use_windows_threads()
@@ -205,13 +205,13 @@ int evthread_use_windows_threads(void);
#define EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED 1
#endif
-#if defined(EVENT__HAVE_PTHREADS) || defined(EVENT_IN_DOXYGEN_)
+#if defined(EVENT__HAVE_PTHREADS) || defined(EVENT_IN_DOXYGEN_)
/** Sets up Libevent for use with Pthreads locking and thread ID functions.
Unavailable if Libevent is not build for use with pthreads. Requires
libraries to link against Libevent_pthreads as well as Libevent.
@return 0 on success, -1 on failure. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evthread_use_pthreads(void);
/** Defined if Libevent was built with support for evthread_use_pthreads() */
#define EVTHREAD_USE_PTHREADS_IMPLEMENTED 1
@@ -224,30 +224,30 @@ int evthread_use_pthreads(void);
* If you're going to call this function, you must do so before any locks are
* allocated.
**/
-EVENT2_EXPORT_SYMBOL
-void evthread_enable_lock_debugging(void);
-
-/* Old (misspelled) version: This is deprecated; use
- * evthread_enable_log_debugging instead. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
+void evthread_enable_lock_debugging(void);
+
+/* Old (misspelled) version: This is deprecated; use
+ * evthread_enable_log_debugging instead. */
+EVENT2_EXPORT_SYMBOL
void evthread_enable_lock_debuging(void);
-#endif /* EVENT__DISABLE_THREAD_SUPPORT */
+#endif /* EVENT__DISABLE_THREAD_SUPPORT */
struct event_base;
/** Make sure it's safe to tell an event base to wake up from another thread
or a signal handler.
- You shouldn't need to call this by hand; configuring the base with thread
- support should be necessary and sufficient.
-
+ You shouldn't need to call this by hand; configuring the base with thread
+ support should be necessary and sufficient.
+
@return 0 on success, -1 on failure.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evthread_make_base_notifiable(struct event_base *base);
#ifdef __cplusplus
}
#endif
-#endif /* EVENT2_THREAD_H_INCLUDED_ */
+#endif /* EVENT2_THREAD_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/util.h b/contrib/libs/libevent/include/event2/util.h
index 02aa7ba9da..f54f93ef4f 100644
--- a/contrib/libs/libevent/include/event2/util.h
+++ b/contrib/libs/libevent/include/event2/util.h
@@ -23,8 +23,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENT2_UTIL_H_INCLUDED_
-#define EVENT2_UTIL_H_INCLUDED_
+#ifndef EVENT2_UTIL_H_INCLUDED_
+#define EVENT2_UTIL_H_INCLUDED_
/** @file event2/util.h
@@ -32,53 +32,53 @@
related socket manipulations.
*/
-#include <event2/visibility.h>
+#include <event2/visibility.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <event2/event-config.h>
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#ifdef EVENT__HAVE_STDINT_H
+#ifdef EVENT__HAVE_STDINT_H
#include <stdint.h>
-#elif defined(EVENT__HAVE_INTTYPES_H)
+#elif defined(EVENT__HAVE_INTTYPES_H)
#include <inttypes.h>
#endif
-#ifdef EVENT__HAVE_SYS_TYPES_H
+#ifdef EVENT__HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef EVENT__HAVE_STDDEF_H
+#ifdef EVENT__HAVE_STDDEF_H
#include <stddef.h>
#endif
#ifdef _MSC_VER
#include <BaseTsd.h>
#endif
#include <stdarg.h>
-#ifdef EVENT__HAVE_NETDB_H
+#ifdef EVENT__HAVE_NETDB_H
#include <netdb.h>
#endif
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
-#ifdef EVENT__HAVE_GETADDRINFO
-/* for EAI_* definitions. */
-#include <ws2tcpip.h>
-#endif
-#else
-#ifdef EVENT__HAVE_ERRNO_H
-#include <errno.h>
-#endif
+#ifdef EVENT__HAVE_GETADDRINFO
+/* for EAI_* definitions. */
+#include <ws2tcpip.h>
+#endif
+#else
+#ifdef EVENT__HAVE_ERRNO_H
+#include <errno.h>
+#endif
#include <sys/socket.h>
#endif
-#include <time.h>
-
+#include <time.h>
+
/* Some openbsd autoconf versions get the name of this macro wrong. */
-#if defined(EVENT__SIZEOF_VOID__) && !defined(EVENT__SIZEOF_VOID_P)
-#define EVENT__SIZEOF_VOID_P EVENT__SIZEOF_VOID__
+#if defined(EVENT__SIZEOF_VOID__) && !defined(EVENT__SIZEOF_VOID_P)
+#define EVENT__SIZEOF_VOID_P EVENT__SIZEOF_VOID__
#endif
/**
@@ -110,67 +110,67 @@ extern "C" {
*
* @{
*/
-#ifdef EVENT__HAVE_UINT64_T
+#ifdef EVENT__HAVE_UINT64_T
#define ev_uint64_t uint64_t
#define ev_int64_t int64_t
-#elif defined(_WIN32)
+#elif defined(_WIN32)
#define ev_uint64_t unsigned __int64
#define ev_int64_t signed __int64
-#elif EVENT__SIZEOF_LONG_LONG == 8
+#elif EVENT__SIZEOF_LONG_LONG == 8
#define ev_uint64_t unsigned long long
#define ev_int64_t long long
-#elif EVENT__SIZEOF_LONG == 8
+#elif EVENT__SIZEOF_LONG == 8
#define ev_uint64_t unsigned long
#define ev_int64_t long
-#elif defined(EVENT_IN_DOXYGEN_)
+#elif defined(EVENT_IN_DOXYGEN_)
#define ev_uint64_t ...
#define ev_int64_t ...
#else
#error "No way to define ev_uint64_t"
#endif
-#ifdef EVENT__HAVE_UINT32_T
+#ifdef EVENT__HAVE_UINT32_T
#define ev_uint32_t uint32_t
#define ev_int32_t int32_t
-#elif defined(_WIN32)
+#elif defined(_WIN32)
#define ev_uint32_t unsigned int
#define ev_int32_t signed int
-#elif EVENT__SIZEOF_LONG == 4
+#elif EVENT__SIZEOF_LONG == 4
#define ev_uint32_t unsigned long
#define ev_int32_t signed long
-#elif EVENT__SIZEOF_INT == 4
+#elif EVENT__SIZEOF_INT == 4
#define ev_uint32_t unsigned int
#define ev_int32_t signed int
-#elif defined(EVENT_IN_DOXYGEN_)
+#elif defined(EVENT_IN_DOXYGEN_)
#define ev_uint32_t ...
#define ev_int32_t ...
#else
#error "No way to define ev_uint32_t"
#endif
-#ifdef EVENT__HAVE_UINT16_T
+#ifdef EVENT__HAVE_UINT16_T
#define ev_uint16_t uint16_t
#define ev_int16_t int16_t
-#elif defined(_WIN32)
+#elif defined(_WIN32)
#define ev_uint16_t unsigned short
#define ev_int16_t signed short
-#elif EVENT__SIZEOF_INT == 2
+#elif EVENT__SIZEOF_INT == 2
#define ev_uint16_t unsigned int
#define ev_int16_t signed int
-#elif EVENT__SIZEOF_SHORT == 2
+#elif EVENT__SIZEOF_SHORT == 2
#define ev_uint16_t unsigned short
#define ev_int16_t signed short
-#elif defined(EVENT_IN_DOXYGEN_)
+#elif defined(EVENT_IN_DOXYGEN_)
#define ev_uint16_t ...
#define ev_int16_t ...
#else
#error "No way to define ev_uint16_t"
#endif
-#ifdef EVENT__HAVE_UINT8_T
+#ifdef EVENT__HAVE_UINT8_T
#define ev_uint8_t uint8_t
#define ev_int8_t int8_t
-#elif defined(EVENT_IN_DOXYGEN_)
+#elif defined(EVENT_IN_DOXYGEN_)
#define ev_uint8_t ...
#define ev_int8_t ...
#else
@@ -178,43 +178,43 @@ extern "C" {
#define ev_int8_t signed char
#endif
-#ifdef EVENT__HAVE_UINTPTR_T
+#ifdef EVENT__HAVE_UINTPTR_T
#define ev_uintptr_t uintptr_t
#define ev_intptr_t intptr_t
-#elif EVENT__SIZEOF_VOID_P <= 4
+#elif EVENT__SIZEOF_VOID_P <= 4
#define ev_uintptr_t ev_uint32_t
#define ev_intptr_t ev_int32_t
-#elif EVENT__SIZEOF_VOID_P <= 8
+#elif EVENT__SIZEOF_VOID_P <= 8
#define ev_uintptr_t ev_uint64_t
#define ev_intptr_t ev_int64_t
-#elif defined(EVENT_IN_DOXYGEN_)
+#elif defined(EVENT_IN_DOXYGEN_)
#define ev_uintptr_t ...
#define ev_intptr_t ...
#else
#error "No way to define ev_uintptr_t"
#endif
-#ifdef EVENT__ssize_t
-#define ev_ssize_t EVENT__ssize_t
+#ifdef EVENT__ssize_t
+#define ev_ssize_t EVENT__ssize_t
#else
#define ev_ssize_t ssize_t
#endif
-/* Note that we define ev_off_t based on the compile-time size of off_t that
- * we used to build Libevent, and not based on the current size of off_t.
- * (For example, we don't define ev_off_t to off_t.). We do this because
- * some systems let you build your software with different off_t sizes
- * at runtime, and so putting in any dependency on off_t would risk API
- * mismatch.
- */
-#ifdef _WIN32
+/* Note that we define ev_off_t based on the compile-time size of off_t that
+ * we used to build Libevent, and not based on the current size of off_t.
+ * (For example, we don't define ev_off_t to off_t.). We do this because
+ * some systems let you build your software with different off_t sizes
+ * at runtime, and so putting in any dependency on off_t would risk API
+ * mismatch.
+ */
+#ifdef _WIN32
#define ev_off_t ev_int64_t
-#elif EVENT__SIZEOF_OFF_T == 8
-#define ev_off_t ev_int64_t
-#elif EVENT__SIZEOF_OFF_T == 4
-#define ev_off_t ev_int32_t
-#elif defined(EVENT_IN_DOXYGEN_)
-#define ev_off_t ...
+#elif EVENT__SIZEOF_OFF_T == 8
+#define ev_off_t ev_int64_t
+#elif EVENT__SIZEOF_OFF_T == 4
+#define ev_off_t ev_int32_t
+#elif defined(EVENT_IN_DOXYGEN_)
+#define ev_off_t ...
#else
#define ev_off_t off_t
#endif
@@ -235,7 +235,7 @@ extern "C" {
@{
*/
-#ifndef EVENT__HAVE_STDINT_H
+#ifndef EVENT__HAVE_STDINT_H
#define EV_UINT64_MAX ((((ev_uint64_t)0xffffffffUL) << 32) | 0xffffffffUL)
#define EV_INT64_MAX ((((ev_int64_t) 0x7fffffffL) << 32) | 0xffffffffL)
#define EV_INT64_MIN ((-EV_INT64_MAX) - 1)
@@ -248,35 +248,35 @@ extern "C" {
#define EV_UINT8_MAX 255
#define EV_INT8_MAX 127
#define EV_INT8_MIN ((-EV_INT8_MAX) - 1)
-#else
-#define EV_UINT64_MAX UINT64_MAX
-#define EV_INT64_MAX INT64_MAX
-#define EV_INT64_MIN INT64_MIN
-#define EV_UINT32_MAX UINT32_MAX
-#define EV_INT32_MAX INT32_MAX
-#define EV_INT32_MIN INT32_MIN
-#define EV_UINT16_MAX UINT16_MAX
-#define EV_INT16_MIN INT16_MIN
-#define EV_INT16_MAX INT16_MAX
-#define EV_UINT8_MAX UINT8_MAX
-#define EV_INT8_MAX INT8_MAX
-#define EV_INT8_MIN INT8_MIN
+#else
+#define EV_UINT64_MAX UINT64_MAX
+#define EV_INT64_MAX INT64_MAX
+#define EV_INT64_MIN INT64_MIN
+#define EV_UINT32_MAX UINT32_MAX
+#define EV_INT32_MAX INT32_MAX
+#define EV_INT32_MIN INT32_MIN
+#define EV_UINT16_MAX UINT16_MAX
+#define EV_INT16_MIN INT16_MIN
+#define EV_INT16_MAX INT16_MAX
+#define EV_UINT8_MAX UINT8_MAX
+#define EV_INT8_MAX INT8_MAX
+#define EV_INT8_MIN INT8_MIN
/** @} */
-#endif
-
+#endif
+
/**
@name Limits for SIZE_T and SSIZE_T
@{
*/
-#if EVENT__SIZEOF_SIZE_T == 8
+#if EVENT__SIZEOF_SIZE_T == 8
#define EV_SIZE_MAX EV_UINT64_MAX
#define EV_SSIZE_MAX EV_INT64_MAX
-#elif EVENT__SIZEOF_SIZE_T == 4
+#elif EVENT__SIZEOF_SIZE_T == 4
#define EV_SIZE_MAX EV_UINT32_MAX
#define EV_SSIZE_MAX EV_INT32_MAX
-#elif defined(EVENT_IN_DOXYGEN_)
+#elif defined(EVENT_IN_DOXYGEN_)
#define EV_SIZE_MAX ...
#define EV_SSIZE_MAX ...
#else
@@ -286,16 +286,16 @@ extern "C" {
#define EV_SSIZE_MIN ((-EV_SSIZE_MAX) - 1)
/**@}*/
-#ifdef _WIN32
+#ifdef _WIN32
#define ev_socklen_t int
-#elif defined(EVENT__socklen_t)
-#define ev_socklen_t EVENT__socklen_t
+#elif defined(EVENT__socklen_t)
+#define ev_socklen_t EVENT__socklen_t
#else
#define ev_socklen_t socklen_t
#endif
-#ifdef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
-#if !defined(EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY) \
+#ifdef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
+#if !defined(EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY) \
&& !defined(ss_family)
#define ss_family __ss_family
#endif
@@ -304,77 +304,77 @@ extern "C" {
/**
* A type wide enough to hold the output of "socket()" or "accept()". On
* Windows, this is an intptr_t; elsewhere, it is an int. */
-#ifdef _WIN32
+#ifdef _WIN32
#define evutil_socket_t intptr_t
#else
#define evutil_socket_t int
#endif
-/**
- * Structure to hold information about a monotonic timer
- *
- * Use this with evutil_configure_monotonic_time() and
- * evutil_gettime_monotonic().
- *
- * This is an opaque structure; you can allocate one using
- * evutil_monotonic_timer_new().
- *
- * @see evutil_monotonic_timer_new(), evutil_monotonic_timer_free(),
- * evutil_configure_monotonic_time(), evutil_gettime_monotonic()
- */
-struct evutil_monotonic_timer
-#ifdef EVENT_IN_DOXYGEN_
-{/*Empty body so that doxygen will generate documentation here.*/}
-#endif
-;
-
-#define EV_MONOT_PRECISE 1
-#define EV_MONOT_FALLBACK 2
-
-/** Format a date string using RFC 1123 format (used in HTTP).
- * If `tm` is NULL, current system's time will be used.
- * The number of characters written will be returned.
- * One should check if the return value is smaller than `datelen` to check if
- * the result is truncated or not.
- */
-EVENT2_EXPORT_SYMBOL int
-evutil_date_rfc1123(char *date, const size_t datelen, const struct tm *tm);
-
-/** Allocate a new struct evutil_monotonic_timer for use with the
- * evutil_configure_monotonic_time() and evutil_gettime_monotonic()
- * functions. You must configure the timer with
- * evutil_configure_monotonic_time() before using it.
- */
-EVENT2_EXPORT_SYMBOL
-struct evutil_monotonic_timer * evutil_monotonic_timer_new(void);
-
-/** Free a struct evutil_monotonic_timer that was allocated using
- * evutil_monotonic_timer_new().
- */
-EVENT2_EXPORT_SYMBOL
-void evutil_monotonic_timer_free(struct evutil_monotonic_timer *timer);
-
-/** Set up a struct evutil_monotonic_timer; flags can include
- * EV_MONOT_PRECISE and EV_MONOT_FALLBACK.
- */
-EVENT2_EXPORT_SYMBOL
-int evutil_configure_monotonic_time(struct evutil_monotonic_timer *timer,
- int flags);
-
-/** Query the current monotonic time from a struct evutil_monotonic_timer
- * previously configured with evutil_configure_monotonic_time(). Monotonic
- * time is guaranteed never to run in reverse, but is not necessarily epoch-
- * based, or relative to any other definite point. Use it to make reliable
- * measurements of elapsed time between events even when the system time
- * may be changed.
- *
- * It is not safe to use this funtion on the same timer from multiple
- * threads.
- */
-EVENT2_EXPORT_SYMBOL
-int evutil_gettime_monotonic(struct evutil_monotonic_timer *timer,
- struct timeval *tp);
-
+/**
+ * Structure to hold information about a monotonic timer
+ *
+ * Use this with evutil_configure_monotonic_time() and
+ * evutil_gettime_monotonic().
+ *
+ * This is an opaque structure; you can allocate one using
+ * evutil_monotonic_timer_new().
+ *
+ * @see evutil_monotonic_timer_new(), evutil_monotonic_timer_free(),
+ * evutil_configure_monotonic_time(), evutil_gettime_monotonic()
+ */
+struct evutil_monotonic_timer
+#ifdef EVENT_IN_DOXYGEN_
+{/*Empty body so that doxygen will generate documentation here.*/}
+#endif
+;
+
+#define EV_MONOT_PRECISE 1
+#define EV_MONOT_FALLBACK 2
+
+/** Format a date string using RFC 1123 format (used in HTTP).
+ * If `tm` is NULL, current system's time will be used.
+ * The number of characters written will be returned.
+ * One should check if the return value is smaller than `datelen` to check if
+ * the result is truncated or not.
+ */
+EVENT2_EXPORT_SYMBOL int
+evutil_date_rfc1123(char *date, const size_t datelen, const struct tm *tm);
+
+/** Allocate a new struct evutil_monotonic_timer for use with the
+ * evutil_configure_monotonic_time() and evutil_gettime_monotonic()
+ * functions. You must configure the timer with
+ * evutil_configure_monotonic_time() before using it.
+ */
+EVENT2_EXPORT_SYMBOL
+struct evutil_monotonic_timer * evutil_monotonic_timer_new(void);
+
+/** Free a struct evutil_monotonic_timer that was allocated using
+ * evutil_monotonic_timer_new().
+ */
+EVENT2_EXPORT_SYMBOL
+void evutil_monotonic_timer_free(struct evutil_monotonic_timer *timer);
+
+/** Set up a struct evutil_monotonic_timer; flags can include
+ * EV_MONOT_PRECISE and EV_MONOT_FALLBACK.
+ */
+EVENT2_EXPORT_SYMBOL
+int evutil_configure_monotonic_time(struct evutil_monotonic_timer *timer,
+ int flags);
+
+/** Query the current monotonic time from a struct evutil_monotonic_timer
+ * previously configured with evutil_configure_monotonic_time(). Monotonic
+ * time is guaranteed never to run in reverse, but is not necessarily epoch-
+ * based, or relative to any other definite point. Use it to make reliable
+ * measurements of elapsed time between events even when the system time
+ * may be changed.
+ *
+ * It is not safe to use this funtion on the same timer from multiple
+ * threads.
+ */
+EVENT2_EXPORT_SYMBOL
+int evutil_gettime_monotonic(struct evutil_monotonic_timer *timer,
+ struct timeval *tp);
+
/** Create two new sockets that are connected to each other.
On Unix, this simply calls socketpair(). On Windows, it uses the
@@ -386,14 +386,14 @@ int evutil_gettime_monotonic(struct evutil_monotonic_timer *timer,
Parameters and return values are as for socketpair()
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_socketpair(int d, int type, int protocol, evutil_socket_t sv[2]);
/** Do platform-specific operations as needed to make a socket nonblocking.
@param sock The socket to make nonblocking
@return 0 on success, -1 on failure
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_make_socket_nonblocking(evutil_socket_t sock);
/** Do platform-specific operations to make a listener socket reusable.
@@ -407,82 +407,82 @@ int evutil_make_socket_nonblocking(evutil_socket_t sock);
@param sock The socket to make reusable
@return 0 on success, -1 on failure
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_make_listen_socket_reuseable(evutil_socket_t sock);
-/** Do platform-specific operations to make a listener port reusable.
-
- Specifically, we want to make sure that multiple programs which also
- set the same socket option will be able to bind, listen at the same time.
-
- This is a feature available only to Linux 3.9+
-
- @param sock The socket to make reusable
- @return 0 on success, -1 on failure
- */
-EVENT2_EXPORT_SYMBOL
-int evutil_make_listen_socket_reuseable_port(evutil_socket_t sock);
-
-/** Set ipv6 only bind socket option to make listener work only in ipv6 sockets.
-
- According to RFC3493 and most Linux distributions, default value for the
- sockets is to work in IPv4-mapped mode. In IPv4-mapped mode, it is not possible
- to bind same port from different IPv4 and IPv6 handlers.
-
- @param sock The socket to make in ipv6only working mode
- @return 0 on success, -1 on failure
- */
-EVENT2_EXPORT_SYMBOL
-int evutil_make_listen_socket_ipv6only(evutil_socket_t sock);
-
+/** Do platform-specific operations to make a listener port reusable.
+
+ Specifically, we want to make sure that multiple programs which also
+ set the same socket option will be able to bind, listen at the same time.
+
+ This is a feature available only to Linux 3.9+
+
+ @param sock The socket to make reusable
+ @return 0 on success, -1 on failure
+ */
+EVENT2_EXPORT_SYMBOL
+int evutil_make_listen_socket_reuseable_port(evutil_socket_t sock);
+
+/** Set ipv6 only bind socket option to make listener work only in ipv6 sockets.
+
+ According to RFC3493 and most Linux distributions, default value for the
+ sockets is to work in IPv4-mapped mode. In IPv4-mapped mode, it is not possible
+ to bind same port from different IPv4 and IPv6 handlers.
+
+ @param sock The socket to make in ipv6only working mode
+ @return 0 on success, -1 on failure
+ */
+EVENT2_EXPORT_SYMBOL
+int evutil_make_listen_socket_ipv6only(evutil_socket_t sock);
+
/** Do platform-specific operations as needed to close a socket upon a
successful execution of one of the exec*() functions.
@param sock The socket to be closed
@return 0 on success, -1 on failure
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_make_socket_closeonexec(evutil_socket_t sock);
/** Do the platform-specific call needed to close a socket returned from
socket() or accept().
@param sock The socket to be closed
- @return 0 on success (whether the operation is supported or not),
- -1 on failure
+ @return 0 on success (whether the operation is supported or not),
+ -1 on failure
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_closesocket(evutil_socket_t sock);
#define EVUTIL_CLOSESOCKET(s) evutil_closesocket(s)
-/** Do platform-specific operations, if possible, to make a tcp listener
- * socket defer accept()s until there is data to read.
- *
- * Not all platforms support this. You don't want to do this for every
- * listener socket: only the ones that implement a protocol where the
- * client transmits before the server needs to respond.
- *
- * @param sock The listening socket to to make deferred
- * @return 0 on success (whether the operation is supported or not),
- * -1 on failure
-*/
-EVENT2_EXPORT_SYMBOL
-int evutil_make_tcp_listen_socket_deferred(evutil_socket_t sock);
-
-#ifdef _WIN32
+/** Do platform-specific operations, if possible, to make a tcp listener
+ * socket defer accept()s until there is data to read.
+ *
+ * Not all platforms support this. You don't want to do this for every
+ * listener socket: only the ones that implement a protocol where the
+ * client transmits before the server needs to respond.
+ *
+ * @param sock The listening socket to to make deferred
+ * @return 0 on success (whether the operation is supported or not),
+ * -1 on failure
+*/
+EVENT2_EXPORT_SYMBOL
+int evutil_make_tcp_listen_socket_deferred(evutil_socket_t sock);
+
+#ifdef _WIN32
/** Return the most recent socket error. Not idempotent on all platforms. */
#define EVUTIL_SOCKET_ERROR() WSAGetLastError()
/** Replace the most recent socket error with errcode */
#define EVUTIL_SET_SOCKET_ERROR(errcode) \
do { WSASetLastError(errcode); } while (0)
/** Return the most recent socket error to occur on sock. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_socket_geterror(evutil_socket_t sock);
/** Convert a socket error to a string. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *evutil_socket_error_to_string(int errcode);
-#define EVUTIL_INVALID_SOCKET INVALID_SOCKET
-#elif defined(EVENT_IN_DOXYGEN_)
+#define EVUTIL_INVALID_SOCKET INVALID_SOCKET
+#elif defined(EVENT_IN_DOXYGEN_)
/**
@name Socket error functions
@@ -505,16 +505,16 @@ const char *evutil_socket_error_to_string(int errcode);
#define evutil_socket_geterror(sock) ...
/** Convert a socket error to a string. */
#define evutil_socket_error_to_string(errcode) ...
-#define EVUTIL_INVALID_SOCKET -1
+#define EVUTIL_INVALID_SOCKET -1
/**@}*/
-#else /** !EVENT_IN_DOXYGEN_ && !_WIN32 */
+#else /** !EVENT_IN_DOXYGEN_ && !_WIN32 */
#define EVUTIL_SOCKET_ERROR() (errno)
#define EVUTIL_SET_SOCKET_ERROR(errcode) \
do { errno = (errcode); } while (0)
#define evutil_socket_geterror(sock) (errno)
#define evutil_socket_error_to_string(errcode) (strerror(errcode))
-#define EVUTIL_INVALID_SOCKET -1
-#endif /** !_WIN32 */
+#define EVUTIL_INVALID_SOCKET -1
+#endif /** !_WIN32 */
/**
@@ -525,7 +525,7 @@ const char *evutil_socket_error_to_string(int errcode);
*
* @{
*/
-#ifdef EVENT__HAVE_TIMERADD
+#ifdef EVENT__HAVE_TIMERADD
#define evutil_timeradd(tvp, uvp, vvp) timeradd((tvp), (uvp), (vvp))
#define evutil_timersub(tvp, uvp, vvp) timersub((tvp), (uvp), (vvp))
#else
@@ -547,9 +547,9 @@ const char *evutil_socket_error_to_string(int errcode);
(vvp)->tv_usec += 1000000; \
} \
} while (0)
-#endif /* !EVENT__HAVE_TIMERADD */
+#endif /* !EVENT__HAVE_TIMERADD */
-#ifdef EVENT__HAVE_TIMERCLEAR
+#ifdef EVENT__HAVE_TIMERCLEAR
#define evutil_timerclear(tvp) timerclear(tvp)
#else
#define evutil_timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
@@ -563,7 +563,7 @@ const char *evutil_socket_error_to_string(int errcode);
((tvp)->tv_usec cmp (uvp)->tv_usec) : \
((tvp)->tv_sec cmp (uvp)->tv_sec))
-#ifdef EVENT__HAVE_TIMERISSET
+#ifdef EVENT__HAVE_TIMERISSET
#define evutil_timerisset(tvp) timerisset(tvp)
#else
#define evutil_timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
@@ -578,22 +578,22 @@ const char *evutil_socket_error_to_string(int errcode);
/* big-int related functions */
/** Parse a 64-bit value from a string. Arguments are as for strtol. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
ev_int64_t evutil_strtoll(const char *s, char **endptr, int base);
/** Replacement for gettimeofday on platforms that lack it. */
-#ifdef EVENT__HAVE_GETTIMEOFDAY
+#ifdef EVENT__HAVE_GETTIMEOFDAY
#define evutil_gettimeofday(tv, tz) gettimeofday((tv), (tz))
#else
struct timezone;
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_gettimeofday(struct timeval *tv, struct timezone *tz);
#endif
/** Replacement for snprintf to get consistent behavior on platforms for
which the return value of snprintf does not conform to C99.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_snprintf(char *buf, size_t buflen, const char *format, ...)
#ifdef __GNUC__
__attribute__((format(printf, 3, 4)))
@@ -602,7 +602,7 @@ int evutil_snprintf(char *buf, size_t buflen, const char *format, ...)
/** Replacement for vsnprintf to get consistent behavior on platforms for
which the return value of snprintf does not conform to C99.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap)
#ifdef __GNUC__
__attribute__((format(printf, 3, 0)))
@@ -610,7 +610,7 @@ int evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap)
;
/** Replacement for inet_ntop for platforms which lack it. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *evutil_inet_ntop(int af, const void *src, char *dst, size_t len);
/** Variation of inet_pton that also parses IPv6 scopes. Public for
unit tests. No reason to call this directly.
@@ -619,7 +619,7 @@ EVENT2_EXPORT_SYMBOL
int evutil_inet_pton_scope(int af, const char *src, void *dst,
unsigned *indexp);
/** Replacement for inet_pton for platforms which lack it. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_inet_pton(int af, const char *src, void *dst);
struct sockaddr;
@@ -643,7 +643,7 @@ struct sockaddr;
or if out is not large enough to hold the result. Otherwise returns
0 on success.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_parse_sockaddr_port(const char *str, struct sockaddr *out, int *outlen);
/** Compare two sockaddrs; return 0 if they are equal, or less than 0 if sa1
@@ -651,24 +651,24 @@ int evutil_parse_sockaddr_port(const char *str, struct sockaddr *out, int *outle
* true, consider the port as well as the address. Only implemented for
* AF_INET and AF_INET6 addresses. The ordering is not guaranteed to remain
* the same between Libevent versions. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_sockaddr_cmp(const struct sockaddr *sa1, const struct sockaddr *sa2,
int include_port);
/** As strcasecmp, but always compares the characters in locale-independent
ASCII. That's useful if you're handling data in ASCII-based protocols.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_ascii_strcasecmp(const char *str1, const char *str2);
/** As strncasecmp, but always compares the characters in locale-independent
ASCII. That's useful if you're handling data in ASCII-based protocols.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_ascii_strncasecmp(const char *str1, const char *str2, size_t n);
/* Here we define evutil_addrinfo to the native addrinfo type, or redefine it
* if this system has no getaddrinfo(). */
-#ifdef EVENT__HAVE_STRUCT_ADDRINFO
+#ifdef EVENT__HAVE_STRUCT_ADDRINFO
#define evutil_addrinfo addrinfo
#else
/** A definition of struct addrinfo for systems that lack it.
@@ -694,32 +694,32 @@ struct evutil_addrinfo {
@{
*/
-#if defined(EAI_ADDRFAMILY) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(EAI_ADDRFAMILY) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_EAI_ADDRFAMILY EAI_ADDRFAMILY
#else
#define EVUTIL_EAI_ADDRFAMILY -901
#endif
-#if defined(EAI_AGAIN) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(EAI_AGAIN) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_EAI_AGAIN EAI_AGAIN
#else
#define EVUTIL_EAI_AGAIN -902
#endif
-#if defined(EAI_BADFLAGS) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(EAI_BADFLAGS) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_EAI_BADFLAGS EAI_BADFLAGS
#else
#define EVUTIL_EAI_BADFLAGS -903
#endif
-#if defined(EAI_FAIL) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(EAI_FAIL) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_EAI_FAIL EAI_FAIL
#else
#define EVUTIL_EAI_FAIL -904
#endif
-#if defined(EAI_FAMILY) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(EAI_FAMILY) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_EAI_FAMILY EAI_FAMILY
#else
#define EVUTIL_EAI_FAMILY -905
#endif
-#if defined(EAI_MEMORY) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(EAI_MEMORY) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_EAI_MEMORY EAI_MEMORY
#else
#define EVUTIL_EAI_MEMORY -906
@@ -727,27 +727,27 @@ struct evutil_addrinfo {
/* This test is a bit complicated, since some MS SDKs decide to
* remove NODATA or redefine it to be the same as NONAME, in a
* fun interpretation of RFC 2553 and RFC 3493. */
-#if defined(EAI_NODATA) && defined(EVENT__HAVE_GETADDRINFO) && (!defined(EAI_NONAME) || EAI_NODATA != EAI_NONAME)
+#if defined(EAI_NODATA) && defined(EVENT__HAVE_GETADDRINFO) && (!defined(EAI_NONAME) || EAI_NODATA != EAI_NONAME)
#define EVUTIL_EAI_NODATA EAI_NODATA
#else
#define EVUTIL_EAI_NODATA -907
#endif
-#if defined(EAI_NONAME) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(EAI_NONAME) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_EAI_NONAME EAI_NONAME
#else
#define EVUTIL_EAI_NONAME -908
#endif
-#if defined(EAI_SERVICE) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(EAI_SERVICE) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_EAI_SERVICE EAI_SERVICE
#else
#define EVUTIL_EAI_SERVICE -909
#endif
-#if defined(EAI_SOCKTYPE) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(EAI_SOCKTYPE) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_EAI_SOCKTYPE EAI_SOCKTYPE
#else
#define EVUTIL_EAI_SOCKTYPE -910
#endif
-#if defined(EAI_SYSTEM) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(EAI_SYSTEM) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_EAI_SYSTEM EAI_SYSTEM
#else
#define EVUTIL_EAI_SYSTEM -911
@@ -755,37 +755,37 @@ struct evutil_addrinfo {
#define EVUTIL_EAI_CANCEL -90001
-#if defined(AI_PASSIVE) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(AI_PASSIVE) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_AI_PASSIVE AI_PASSIVE
#else
#define EVUTIL_AI_PASSIVE 0x1000
#endif
-#if defined(AI_CANONNAME) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(AI_CANONNAME) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_AI_CANONNAME AI_CANONNAME
#else
#define EVUTIL_AI_CANONNAME 0x2000
#endif
-#if defined(AI_NUMERICHOST) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(AI_NUMERICHOST) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_AI_NUMERICHOST AI_NUMERICHOST
#else
#define EVUTIL_AI_NUMERICHOST 0x4000
#endif
-#if defined(AI_NUMERICSERV) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(AI_NUMERICSERV) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_AI_NUMERICSERV AI_NUMERICSERV
#else
#define EVUTIL_AI_NUMERICSERV 0x8000
#endif
-#if defined(AI_V4MAPPED) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(AI_V4MAPPED) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_AI_V4MAPPED AI_V4MAPPED
#else
#define EVUTIL_AI_V4MAPPED 0x10000
#endif
-#if defined(AI_ALL) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(AI_ALL) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_AI_ALL AI_ALL
#else
#define EVUTIL_AI_ALL 0x20000
#endif
-#if defined(AI_ADDRCONFIG) && defined(EVENT__HAVE_GETADDRINFO)
+#if defined(AI_ADDRCONFIG) && defined(EVENT__HAVE_GETADDRINFO)
#define EVUTIL_AI_ADDRCONFIG AI_ADDRCONFIG
#else
#define EVUTIL_AI_ADDRCONFIG 0x40000
@@ -804,15 +804,15 @@ struct evutil_addrinfo;
*
* For a nonblocking variant, see evdns_getaddrinfo.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_getaddrinfo(const char *nodename, const char *servname,
const struct evutil_addrinfo *hints_in, struct evutil_addrinfo **res);
/** Release storage allocated by evutil_getaddrinfo or evdns_getaddrinfo. */
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evutil_freeaddrinfo(struct evutil_addrinfo *ai);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
const char *evutil_gai_strerror(int err);
/** Generate n bytes of secure pseudorandom data, and store them in buf.
@@ -824,7 +824,7 @@ const char *evutil_gai_strerror(int err);
* provides only rudimentary prediction- and backtracking-resistance. Don't
* use this for serious cryptographic applications.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evutil_secure_rng_get_bytes(void *buf, size_t n);
/**
@@ -843,7 +843,7 @@ void evutil_secure_rng_get_bytes(void *buf, size_t n);
* whatever), and you want to make sure that seeding happens before your
* program loses the ability to do it.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_secure_rng_init(void);
/**
@@ -859,10 +859,10 @@ int evutil_secure_rng_init(void);
*
* This API is unstable, and might change in a future libevent version.
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
int evutil_secure_rng_set_urandom_device_file(char *fname);
-#if !defined(EVENT__HAVE_ARC4RANDOM) || defined(EVENT__HAVE_ARC4RANDOM_ADDRANDOM)
+#if !defined(EVENT__HAVE_ARC4RANDOM) || defined(EVENT__HAVE_ARC4RANDOM_ADDRANDOM)
/** Seed the random number generator with extra random bytes.
You should almost never need to call this function; it should be
@@ -877,12 +877,12 @@ int evutil_secure_rng_set_urandom_device_file(char *fname);
@param dat a buffer full of a strong source of random numbers
@param datlen the number of bytes to read from datlen
*/
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void evutil_secure_rng_add_bytes(const char *dat, size_t datlen);
-#endif
+#endif
#ifdef __cplusplus
}
#endif
-#endif /* EVENT1_EVUTIL_H_INCLUDED_ */
+#endif /* EVENT1_EVUTIL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/event2/visibility.h b/contrib/libs/libevent/include/event2/visibility.h
index 006bbf06d8..221cb1f7b8 100644
--- a/contrib/libs/libevent/include/event2/visibility.h
+++ b/contrib/libs/libevent/include/event2/visibility.h
@@ -1,67 +1,67 @@
-/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/*
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_VISIBILITY_H_INCLUDED_
-#define EVENT2_VISIBILITY_H_INCLUDED_
-
-#include <event2/event-config.h>
-
-#if defined(event_shared_EXPORTS) || \
- defined(event_extra_shared_EXPORTS) || \
- defined(event_core_shared_EXPORTS) || \
- defined(event_pthreads_shared_EXPORTS) || \
- defined(event_openssl_shared_EXPORTS)
-
-# if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
-# define EVENT2_EXPORT_SYMBOL __global
-# elif defined __GNUC__
-# define EVENT2_EXPORT_SYMBOL __attribute__ ((visibility("default")))
-# elif defined(_MSC_VER)
-# define EVENT2_EXPORT_SYMBOL __declspec(dllexport)
-# else
-# define EVENT2_EXPORT_SYMBOL /* unknown compiler */
-# endif
-
-#else /* event_*_EXPORTS */
-
-# define EVENT2_EXPORT_SYMBOL
-
-#endif /* event_*_EXPORTS */
-
-/** We need to dllimport event_debug_logging_mask_ into event_extra */
-#if defined(_MSC_VER)
-# if defined(event_core_shared_EXPORTS) /** from core export */
-# define EVENT2_CORE_EXPORT_SYMBOL __declspec(dllexport)
-# elif defined(event_extra_shared_EXPORTS) || /** from extra import */ \
- defined(EVENT_VISIBILITY_WANT_DLLIMPORT)
-# define EVENT2_CORE_EXPORT_SYMBOL __declspec(dllimport)
-# endif
-#endif /* _MSC_VER */
-#if !defined(EVENT2_CORE_EXPORT_SYMBOL)
-# define EVENT2_CORE_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
-#endif
-
-#endif /* EVENT2_VISIBILITY_H_INCLUDED_ */
+/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef EVENT2_VISIBILITY_H_INCLUDED_
+#define EVENT2_VISIBILITY_H_INCLUDED_
+
+#include <event2/event-config.h>
+
+#if defined(event_shared_EXPORTS) || \
+ defined(event_extra_shared_EXPORTS) || \
+ defined(event_core_shared_EXPORTS) || \
+ defined(event_pthreads_shared_EXPORTS) || \
+ defined(event_openssl_shared_EXPORTS)
+
+# if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
+# define EVENT2_EXPORT_SYMBOL __global
+# elif defined __GNUC__
+# define EVENT2_EXPORT_SYMBOL __attribute__ ((visibility("default")))
+# elif defined(_MSC_VER)
+# define EVENT2_EXPORT_SYMBOL __declspec(dllexport)
+# else
+# define EVENT2_EXPORT_SYMBOL /* unknown compiler */
+# endif
+
+#else /* event_*_EXPORTS */
+
+# define EVENT2_EXPORT_SYMBOL
+
+#endif /* event_*_EXPORTS */
+
+/** We need to dllimport event_debug_logging_mask_ into event_extra */
+#if defined(_MSC_VER)
+# if defined(event_core_shared_EXPORTS) /** from core export */
+# define EVENT2_CORE_EXPORT_SYMBOL __declspec(dllexport)
+# elif defined(event_extra_shared_EXPORTS) || /** from extra import */ \
+ defined(EVENT_VISIBILITY_WANT_DLLIMPORT)
+# define EVENT2_CORE_EXPORT_SYMBOL __declspec(dllimport)
+# endif
+#endif /* _MSC_VER */
+#if !defined(EVENT2_CORE_EXPORT_SYMBOL)
+# define EVENT2_CORE_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
+#endif
+
+#endif /* EVENT2_VISIBILITY_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/evhttp.h b/contrib/libs/libevent/include/evhttp.h
index 549bc9b14a..d876f5219e 100644
--- a/contrib/libs/libevent/include/evhttp.h
+++ b/contrib/libs/libevent/include/evhttp.h
@@ -1,45 +1,45 @@
-/*
- * Copyright 2000-2007 Niels Provos <provos@citi.umich.edu>
- * Copyright 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT1_EVHTTP_H_INCLUDED_
-#define EVENT1_EVHTTP_H_INCLUDED_
-
-/** @file evhttp.h
-
- An http implementation subsystem for Libevent.
-
- The <evhttp.h> header is deprecated in Libevent 2.0 and later; please
- use <event2/http.h> instead. Depending on what functionality you
- need, you may also want to include more of the other <event2/...>
- headers.
- */
-
-#include <event.h>
-#include <event2/http.h>
-#include <event2/http_struct.h>
-#include <event2/http_compat.h>
-
-#endif /* EVENT1_EVHTTP_H_INCLUDED_ */
+/*
+ * Copyright 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef EVENT1_EVHTTP_H_INCLUDED_
+#define EVENT1_EVHTTP_H_INCLUDED_
+
+/** @file evhttp.h
+
+ An http implementation subsystem for Libevent.
+
+ The <evhttp.h> header is deprecated in Libevent 2.0 and later; please
+ use <event2/http.h> instead. Depending on what functionality you
+ need, you may also want to include more of the other <event2/...>
+ headers.
+ */
+
+#include <event.h>
+#include <event2/http.h>
+#include <event2/http_struct.h>
+#include <event2/http_compat.h>
+
+#endif /* EVENT1_EVHTTP_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/evrpc.h b/contrib/libs/libevent/include/evrpc.h
index 7e986f7dab..8c01a3e356 100644
--- a/contrib/libs/libevent/include/evrpc.h
+++ b/contrib/libs/libevent/include/evrpc.h
@@ -1,45 +1,45 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT1_EVRPC_H_INCLUDED_
-#define EVENT1_EVRPC_H_INCLUDED_
-
-/** @file evrpc.h
-
- An RPC system for Libevent.
-
- The <evrpc.h> header is deprecated in Libevent 2.0 and later; please
- use <event2/rpc.h> instead. Depending on what functionality you
- need, you may also want to include more of the other <event2/...>
- headers.
- */
-
-#include <event.h>
-#include <event2/rpc.h>
-#include <event2/rpc_struct.h>
-#include <event2/rpc_compat.h>
-
-#endif /* EVENT1_EVRPC_H_INCLUDED_ */
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef EVENT1_EVRPC_H_INCLUDED_
+#define EVENT1_EVRPC_H_INCLUDED_
+
+/** @file evrpc.h
+
+ An RPC system for Libevent.
+
+ The <evrpc.h> header is deprecated in Libevent 2.0 and later; please
+ use <event2/rpc.h> instead. Depending on what functionality you
+ need, you may also want to include more of the other <event2/...>
+ headers.
+ */
+
+#include <event.h>
+#include <event2/rpc.h>
+#include <event2/rpc_struct.h>
+#include <event2/rpc_compat.h>
+
+#endif /* EVENT1_EVRPC_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/include/evutil.h b/contrib/libs/libevent/include/evutil.h
index 12c137d745..fc513cc5bc 100644
--- a/contrib/libs/libevent/include/evutil.h
+++ b/contrib/libs/libevent/include/evutil.h
@@ -1,39 +1,39 @@
-/*
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT1_EVUTIL_H_INCLUDED_
-#define EVENT1_EVUTIL_H_INCLUDED_
-
-/** @file evutil.h
-
- Utility and compatibility functions for Libevent.
-
- The <evutil.h> header is deprecated in Libevent 2.0 and later; please
- use <event2/util.h> instead.
-*/
-
-#include <event2/util.h>
-
-#endif /* EVENT1_EVUTIL_H_INCLUDED_ */
+/*
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef EVENT1_EVUTIL_H_INCLUDED_
+#define EVENT1_EVUTIL_H_INCLUDED_
+
+/** @file evutil.h
+
+ Utility and compatibility functions for Libevent.
+
+ The <evutil.h> header is deprecated in Libevent 2.0 and later; please
+ use <event2/util.h> instead.
+*/
+
+#include <event2/util.h>
+
+#endif /* EVENT1_EVUTIL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/iocp-internal.h b/contrib/libs/libevent/iocp-internal.h
index 21e0e0af68..f54e487042 100644
--- a/contrib/libs/libevent/iocp-internal.h
+++ b/contrib/libs/libevent/iocp-internal.h
@@ -24,8 +24,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef IOCP_INTERNAL_H_INCLUDED_
-#define IOCP_INTERNAL_H_INCLUDED_
+#ifndef IOCP_INTERNAL_H_INCLUDED_
+#define IOCP_INTERNAL_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
@@ -39,7 +39,7 @@ typedef void (*iocp_callback)(struct event_overlapped *, ev_uintptr_t, ev_ssize_
/* This whole file is actually win32 only. We wrap the structures in a win32
* ifdef so that we can test-compile code that uses these interfaces on
* non-win32 platforms. */
-#ifdef _WIN32
+#ifdef _WIN32
/**
Internal use only. Wraps an OVERLAPPED that we're using for libevent
@@ -92,8 +92,8 @@ struct event_iocp_port {
HANDLE *shutdownSemaphore;
};
-EVENT2_EXPORT_SYMBOL
-const struct win32_extension_fns *event_get_win32_extension_fns_(void);
+EVENT2_EXPORT_SYMBOL
+const struct win32_extension_fns *event_get_win32_extension_fns_(void);
#else
/* Dummy definition so we can test-compile more things on unix. */
struct event_overlapped {
@@ -107,69 +107,69 @@ struct event_overlapped {
@param cb The callback that should be invoked once the IO operation has
finished.
*/
-EVENT2_EXPORT_SYMBOL
-void event_overlapped_init_(struct event_overlapped *, iocp_callback cb);
+EVENT2_EXPORT_SYMBOL
+void event_overlapped_init_(struct event_overlapped *, iocp_callback cb);
/** Allocate and return a new evbuffer that supports overlapped IO on a given
socket. The socket must be associated with an IO completion port using
- event_iocp_port_associate_.
+ event_iocp_port_associate_.
*/
-EVENT2_EXPORT_SYMBOL
-struct evbuffer *evbuffer_overlapped_new_(evutil_socket_t fd);
+EVENT2_EXPORT_SYMBOL
+struct evbuffer *evbuffer_overlapped_new_(evutil_socket_t fd);
/** XXXX Document (nickm) */
-evutil_socket_t evbuffer_overlapped_get_fd_(struct evbuffer *buf);
+evutil_socket_t evbuffer_overlapped_get_fd_(struct evbuffer *buf);
-void evbuffer_overlapped_set_fd_(struct evbuffer *buf, evutil_socket_t fd);
+void evbuffer_overlapped_set_fd_(struct evbuffer *buf, evutil_socket_t fd);
/** Start reading data onto the end of an overlapped evbuffer.
An evbuffer can only have one read pending at a time. While the read
is in progress, no other data may be added to the end of the buffer.
- The buffer must be created with event_overlapped_init_().
- evbuffer_commit_read_() must be called in the completion callback.
+ The buffer must be created with event_overlapped_init_().
+ evbuffer_commit_read_() must be called in the completion callback.
@param buf The buffer to read onto
@param n The number of bytes to try to read.
@param ol Overlapped object with associated completion callback.
@return 0 on success, -1 on error.
*/
-EVENT2_EXPORT_SYMBOL
-int evbuffer_launch_read_(struct evbuffer *buf, size_t n, struct event_overlapped *ol);
+EVENT2_EXPORT_SYMBOL
+int evbuffer_launch_read_(struct evbuffer *buf, size_t n, struct event_overlapped *ol);
/** Start writing data from the start of an evbuffer.
An evbuffer can only have one write pending at a time. While the write is
in progress, no other data may be removed from the front of the buffer.
- The buffer must be created with event_overlapped_init_().
- evbuffer_commit_write_() must be called in the completion callback.
+ The buffer must be created with event_overlapped_init_().
+ evbuffer_commit_write_() must be called in the completion callback.
@param buf The buffer to read onto
@param n The number of bytes to try to read.
@param ol Overlapped object with associated completion callback.
@return 0 on success, -1 on error.
*/
-EVENT2_EXPORT_SYMBOL
-int evbuffer_launch_write_(struct evbuffer *buf, ev_ssize_t n, struct event_overlapped *ol);
+EVENT2_EXPORT_SYMBOL
+int evbuffer_launch_write_(struct evbuffer *buf, ev_ssize_t n, struct event_overlapped *ol);
/** XXX document */
-EVENT2_EXPORT_SYMBOL
-void evbuffer_commit_read_(struct evbuffer *, ev_ssize_t);
-EVENT2_EXPORT_SYMBOL
-void evbuffer_commit_write_(struct evbuffer *, ev_ssize_t);
+EVENT2_EXPORT_SYMBOL
+void evbuffer_commit_read_(struct evbuffer *, ev_ssize_t);
+EVENT2_EXPORT_SYMBOL
+void evbuffer_commit_write_(struct evbuffer *, ev_ssize_t);
/** Create an IOCP, and launch its worker threads. Internal use only.
This interface is unstable, and will change.
*/
-EVENT2_EXPORT_SYMBOL
-struct event_iocp_port *event_iocp_port_launch_(int n_cpus);
+EVENT2_EXPORT_SYMBOL
+struct event_iocp_port *event_iocp_port_launch_(int n_cpus);
/** Associate a file descriptor with an iocp, such that overlapped IO on the
fd will happen on one of the iocp's worker threads.
*/
-EVENT2_EXPORT_SYMBOL
-int event_iocp_port_associate_(struct event_iocp_port *port, evutil_socket_t fd,
+EVENT2_EXPORT_SYMBOL
+int event_iocp_port_associate_(struct event_iocp_port *port, evutil_socket_t fd,
ev_uintptr_t key);
/** Tell all threads serving an iocp to stop. Wait for up to waitMsec for all
@@ -178,34 +178,34 @@ int event_iocp_port_associate_(struct event_iocp_port *port, evutil_socket_t fd,
0. Otherwise, return -1. If you get a -1 return value, it is safe to call
this function again.
*/
-EVENT2_EXPORT_SYMBOL
-int event_iocp_shutdown_(struct event_iocp_port *port, long waitMsec);
+EVENT2_EXPORT_SYMBOL
+int event_iocp_shutdown_(struct event_iocp_port *port, long waitMsec);
/* FIXME document. */
-EVENT2_EXPORT_SYMBOL
-int event_iocp_activate_overlapped_(struct event_iocp_port *port,
+EVENT2_EXPORT_SYMBOL
+int event_iocp_activate_overlapped_(struct event_iocp_port *port,
struct event_overlapped *o,
ev_uintptr_t key, ev_uint32_t n_bytes);
struct event_base;
/* FIXME document. */
-EVENT2_EXPORT_SYMBOL
-struct event_iocp_port *event_base_get_iocp_(struct event_base *base);
+EVENT2_EXPORT_SYMBOL
+struct event_iocp_port *event_base_get_iocp_(struct event_base *base);
/* FIXME document. */
-EVENT2_EXPORT_SYMBOL
-int event_base_start_iocp_(struct event_base *base, int n_cpus);
-void event_base_stop_iocp_(struct event_base *base);
+EVENT2_EXPORT_SYMBOL
+int event_base_start_iocp_(struct event_base *base, int n_cpus);
+void event_base_stop_iocp_(struct event_base *base);
/* FIXME document. */
-EVENT2_EXPORT_SYMBOL
-struct bufferevent *bufferevent_async_new_(struct event_base *base,
+EVENT2_EXPORT_SYMBOL
+struct bufferevent *bufferevent_async_new_(struct event_base *base,
evutil_socket_t fd, int options);
/* FIXME document. */
-void bufferevent_async_set_connected_(struct bufferevent *bev);
-int bufferevent_async_can_connect_(struct bufferevent *bev);
-int bufferevent_async_connect_(struct bufferevent *bev, evutil_socket_t fd,
+void bufferevent_async_set_connected_(struct bufferevent *bev);
+int bufferevent_async_can_connect_(struct bufferevent *bev);
+int bufferevent_async_connect_(struct bufferevent *bev, evutil_socket_t fd,
const struct sockaddr *sa, int socklen);
#ifdef __cplusplus
diff --git a/contrib/libs/libevent/ipv6-internal.h b/contrib/libs/libevent/ipv6-internal.h
index 0c207377b8..b619ffff4e 100644
--- a/contrib/libs/libevent/ipv6-internal.h
+++ b/contrib/libs/libevent/ipv6-internal.h
@@ -27,14 +27,14 @@
/* Internal use only: Fake IPv6 structures and values on platforms that
* do not have them */
-#ifndef IPV6_INTERNAL_H_INCLUDED_
-#define IPV6_INTERNAL_H_INCLUDED_
-
-#include "event2/event-config.h"
-#include "evconfig-private.h"
+#ifndef IPV6_INTERNAL_H_INCLUDED_
+#define IPV6_INTERNAL_H_INCLUDED_
+#include "event2/event-config.h"
+#include "evconfig-private.h"
+
#include <sys/types.h>
-#ifdef EVENT__HAVE_SYS_SOCKET_H
+#ifdef EVENT__HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include "event2/util.h"
@@ -49,17 +49,17 @@ extern "C" {
* properly.
*/
-#ifndef EVENT__HAVE_STRUCT_IN6_ADDR
+#ifndef EVENT__HAVE_STRUCT_IN6_ADDR
struct in6_addr {
ev_uint8_t s6_addr[16];
};
#endif
-#ifndef EVENT__HAVE_SA_FAMILY_T
+#ifndef EVENT__HAVE_SA_FAMILY_T
typedef int sa_family_t;
#endif
-#ifndef EVENT__HAVE_STRUCT_SOCKADDR_IN6
+#ifndef EVENT__HAVE_STRUCT_SOCKADDR_IN6
struct sockaddr_in6 {
/* This will fail if we find a struct sockaddr that doesn't have
* sa_family as the first element. */
diff --git a/contrib/libs/libevent/kqueue-internal.h b/contrib/libs/libevent/kqueue-internal.h
index 02c5a3606c..89fed6b5ac 100644
--- a/contrib/libs/libevent/kqueue-internal.h
+++ b/contrib/libs/libevent/kqueue-internal.h
@@ -1,39 +1,39 @@
-/*
- * Copyright (c) 2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef KQUEUE_INTERNAL_H_INCLUDED_
-#define KQUEUE_INTERNAL_H_INCLUDED_
-
-/** Notification function, used to tell an event base to wake up from another
- * thread. Only works when event_kq_add_notify_event_() has previously been
- * called successfully on that base. */
-int event_kq_notify_base_(struct event_base *base);
-
-/** Prepare a kqueue-using event base to receive notifications via an internal
- * EVFILT_USER event. Return 0 on sucess, -1 on failure.
- */
-int event_kq_add_notify_event_(struct event_base *base);
-
-#endif
+/*
+ * Copyright (c) 2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef KQUEUE_INTERNAL_H_INCLUDED_
+#define KQUEUE_INTERNAL_H_INCLUDED_
+
+/** Notification function, used to tell an event base to wake up from another
+ * thread. Only works when event_kq_add_notify_event_() has previously been
+ * called successfully on that base. */
+int event_kq_notify_base_(struct event_base *base);
+
+/** Prepare a kqueue-using event base to receive notifications via an internal
+ * EVFILT_USER event. Return 0 on sucess, -1 on failure.
+ */
+int event_kq_add_notify_event_(struct event_base *base);
+
+#endif
diff --git a/contrib/libs/libevent/kqueue.c b/contrib/libs/libevent/kqueue.c
index dfd7751d64..a5ec6d6734 100644
--- a/contrib/libs/libevent/kqueue.c
+++ b/contrib/libs/libevent/kqueue.c
@@ -27,24 +27,24 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
-
-#ifdef EVENT__HAVE_KQUEUE
+#include "evconfig-private.h"
+#ifdef EVENT__HAVE_KQUEUE
+
#include <sys/types.h>
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <sys/queue.h>
#include <sys/event.h>
-#include <limits.h>
+#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
-#ifdef EVENT__HAVE_INTTYPES_H
+#ifdef EVENT__HAVE_INTTYPES_H
#include <inttypes.h>
#endif
@@ -66,12 +66,12 @@
#include "log-internal.h"
#include "evmap-internal.h"
#include "event2/thread.h"
-#include "event2/util.h"
+#include "event2/util.h"
#include "evthread-internal.h"
#include "changelist-internal.h"
-#include "kqueue-internal.h"
-
+#include "kqueue-internal.h"
+
#define NEVENT 64
struct kqop {
@@ -81,7 +81,7 @@ struct kqop {
struct kevent *events;
int events_size;
int kq;
- int notify_event_added;
+ int notify_event_added;
pid_t pid;
};
@@ -96,8 +96,8 @@ static void kq_dealloc(struct event_base *);
const struct eventop kqops = {
"kqueue",
kq_init,
- event_changelist_add_,
- event_changelist_del_,
+ event_changelist_add_,
+ event_changelist_del_,
kq_dispatch,
kq_dealloc,
1 /* need reinit */,
@@ -212,17 +212,17 @@ kq_build_changes_list(const struct event_changelist *changelist,
struct event_change *in_ch = &changelist->changes[i];
struct kevent *out_ch;
if (n_changes >= kqop->changes_size - 1) {
- int newsize;
+ int newsize;
struct kevent *newchanges;
- if (kqop->changes_size > INT_MAX / 2 ||
- (size_t)kqop->changes_size * 2 > EV_SIZE_MAX /
- sizeof(struct kevent)) {
- event_warnx("%s: int overflow", __func__);
- return (-1);
- }
-
- newsize = kqop->changes_size * 2;
+ if (kqop->changes_size > INT_MAX / 2 ||
+ (size_t)kqop->changes_size * 2 > EV_SIZE_MAX /
+ sizeof(struct kevent)) {
+ event_warnx("%s: int overflow", __func__);
+ return (-1);
+ }
+
+ newsize = kqop->changes_size * 2;
newchanges = mm_realloc(kqop->changes,
newsize * sizeof(struct kevent));
if (newchanges == NULL) {
@@ -273,8 +273,8 @@ kq_dispatch(struct event_base *base, struct timeval *tv)
int i, n_changes, res;
if (tv != NULL) {
- ts.tv_sec = tv->tv_sec;
- ts.tv_nsec = tv->tv_usec * 1000;
+ ts.tv_sec = tv->tv_sec;
+ ts.tv_nsec = tv->tv_usec * 1000;
ts_p = &ts;
}
@@ -284,7 +284,7 @@ kq_dispatch(struct event_base *base, struct timeval *tv)
if (n_changes < 0)
return -1;
- event_changelist_remove_all_(&base->changelist, base);
+ event_changelist_remove_all_(&base->changelist, base);
/* steal the changes array in case some broken code tries to call
* dispatch twice at once. */
@@ -346,23 +346,23 @@ kq_dispatch(struct event_base *base, struct timeval *tv)
* on FreeBSD. */
case EINVAL:
continue;
-#if defined(__FreeBSD__)
- /*
- * This currently occurs if an FD is closed
- * before the EV_DELETE makes it out via kevent().
- * The FreeBSD capabilities code sees the blank
- * capability set and rejects the request to
- * modify an event.
- *
- * To be strictly correct - when an FD is closed,
- * all the registered events are also removed.
- * Queuing EV_DELETE to a closed FD is wrong.
- * The event(s) should just be deleted from
- * the pending changelist.
- */
- case ENOTCAPABLE:
- continue;
-#endif
+#if defined(__FreeBSD__)
+ /*
+ * This currently occurs if an FD is closed
+ * before the EV_DELETE makes it out via kevent().
+ * The FreeBSD capabilities code sees the blank
+ * capability set and rejects the request to
+ * modify an event.
+ *
+ * To be strictly correct - when an FD is closed,
+ * all the registered events are also removed.
+ * Queuing EV_DELETE to a closed FD is wrong.
+ * The event(s) should just be deleted from
+ * the pending changelist.
+ */
+ case ENOTCAPABLE:
+ continue;
+#endif
/* Can occur on a delete if the fd is closed. */
case EBADF:
@@ -403,19 +403,19 @@ kq_dispatch(struct event_base *base, struct timeval *tv)
which |= EV_WRITE;
} else if (events[i].filter == EVFILT_SIGNAL) {
which |= EV_SIGNAL;
-#ifdef EVFILT_USER
- } else if (events[i].filter == EVFILT_USER) {
- base->is_notify_pending = 0;
-#endif
+#ifdef EVFILT_USER
+ } else if (events[i].filter == EVFILT_USER) {
+ base->is_notify_pending = 0;
+#endif
}
if (!which)
continue;
if (events[i].filter == EVFILT_SIGNAL) {
- evmap_signal_active_(base, events[i].ident, 1);
+ evmap_signal_active_(base, events[i].ident, 1);
} else {
- evmap_io_active_(base, events[i].ident, which | EV_ET);
+ evmap_io_active_(base, events[i].ident, which | EV_ET);
}
}
@@ -445,7 +445,7 @@ static void
kq_dealloc(struct event_base *base)
{
struct kqop *kqop = base->evbase;
- evsig_dealloc_(base);
+ evsig_dealloc_(base);
kqop_free(kqop);
}
@@ -471,13 +471,13 @@ kq_sig_add(struct event_base *base, int nsignal, short old, short events, void *
if (kevent(kqop->kq, &kev, 1, NULL, 0, &timeout) == -1)
return (-1);
- /* We can set the handler for most signals to SIG_IGN and
- * still have them reported to us in the queue. However,
- * if the handler for SIGCHLD is SIG_IGN, the system reaps
- * zombie processes for us, and we don't get any notification.
- * This appears to be the only signal with this quirk. */
- if (evsig_set_handler_(base, nsignal,
- nsignal == SIGCHLD ? SIG_DFL : SIG_IGN) == -1)
+ /* We can set the handler for most signals to SIG_IGN and
+ * still have them reported to us in the queue. However,
+ * if the handler for SIGCHLD is SIG_IGN, the system reaps
+ * zombie processes for us, and we don't get any notification.
+ * This appears to be the only signal with this quirk. */
+ if (evsig_set_handler_(base, nsignal,
+ nsignal == SIGCHLD ? SIG_DFL : SIG_IGN) == -1)
return (-1);
return (0);
@@ -505,76 +505,76 @@ kq_sig_del(struct event_base *base, int nsignal, short old, short events, void *
if (kevent(kqop->kq, &kev, 1, NULL, 0, &timeout) == -1)
return (-1);
- if (evsig_restore_handler_(base, nsignal) == -1)
+ if (evsig_restore_handler_(base, nsignal) == -1)
return (-1);
return (0);
}
-
-
-/* OSX 10.6 and FreeBSD 8.1 add support for EVFILT_USER, which we can use
- * to wake up the event loop from another thread. */
-
-/* Magic number we use for our filter ID. */
-#define NOTIFY_IDENT 42
-
-int
-event_kq_add_notify_event_(struct event_base *base)
-{
- struct kqop *kqop = base->evbase;
-#if defined(EVFILT_USER) && defined(NOTE_TRIGGER)
- struct kevent kev;
- struct timespec timeout = { 0, 0 };
-#endif
-
- if (kqop->notify_event_added)
- return 0;
-
-#if defined(EVFILT_USER) && defined(NOTE_TRIGGER)
- memset(&kev, 0, sizeof(kev));
- kev.ident = NOTIFY_IDENT;
- kev.filter = EVFILT_USER;
- kev.flags = EV_ADD | EV_CLEAR;
-
- if (kevent(kqop->kq, &kev, 1, NULL, 0, &timeout) == -1) {
- event_warn("kevent: adding EVFILT_USER event");
- return -1;
- }
-
- kqop->notify_event_added = 1;
-
- return 0;
-#else
- return -1;
-#endif
-}
-
-int
-event_kq_notify_base_(struct event_base *base)
-{
- struct kqop *kqop = base->evbase;
-#if defined(EVFILT_USER) && defined(NOTE_TRIGGER)
- struct kevent kev;
- struct timespec timeout = { 0, 0 };
-#endif
- if (! kqop->notify_event_added)
- return -1;
-
-#if defined(EVFILT_USER) && defined(NOTE_TRIGGER)
- memset(&kev, 0, sizeof(kev));
- kev.ident = NOTIFY_IDENT;
- kev.filter = EVFILT_USER;
- kev.fflags = NOTE_TRIGGER;
-
- if (kevent(kqop->kq, &kev, 1, NULL, 0, &timeout) == -1) {
- event_warn("kevent: triggering EVFILT_USER event");
- return -1;
- }
-
- return 0;
-#else
- return -1;
-#endif
-}
-
-#endif /* EVENT__HAVE_KQUEUE */
+
+
+/* OSX 10.6 and FreeBSD 8.1 add support for EVFILT_USER, which we can use
+ * to wake up the event loop from another thread. */
+
+/* Magic number we use for our filter ID. */
+#define NOTIFY_IDENT 42
+
+int
+event_kq_add_notify_event_(struct event_base *base)
+{
+ struct kqop *kqop = base->evbase;
+#if defined(EVFILT_USER) && defined(NOTE_TRIGGER)
+ struct kevent kev;
+ struct timespec timeout = { 0, 0 };
+#endif
+
+ if (kqop->notify_event_added)
+ return 0;
+
+#if defined(EVFILT_USER) && defined(NOTE_TRIGGER)
+ memset(&kev, 0, sizeof(kev));
+ kev.ident = NOTIFY_IDENT;
+ kev.filter = EVFILT_USER;
+ kev.flags = EV_ADD | EV_CLEAR;
+
+ if (kevent(kqop->kq, &kev, 1, NULL, 0, &timeout) == -1) {
+ event_warn("kevent: adding EVFILT_USER event");
+ return -1;
+ }
+
+ kqop->notify_event_added = 1;
+
+ return 0;
+#else
+ return -1;
+#endif
+}
+
+int
+event_kq_notify_base_(struct event_base *base)
+{
+ struct kqop *kqop = base->evbase;
+#if defined(EVFILT_USER) && defined(NOTE_TRIGGER)
+ struct kevent kev;
+ struct timespec timeout = { 0, 0 };
+#endif
+ if (! kqop->notify_event_added)
+ return -1;
+
+#if defined(EVFILT_USER) && defined(NOTE_TRIGGER)
+ memset(&kev, 0, sizeof(kev));
+ kev.ident = NOTIFY_IDENT;
+ kev.filter = EVFILT_USER;
+ kev.fflags = NOTE_TRIGGER;
+
+ if (kevent(kqop->kq, &kev, 1, NULL, 0, &timeout) == -1) {
+ event_warn("kevent: triggering EVFILT_USER event");
+ return -1;
+ }
+
+ return 0;
+#else
+ return -1;
+#endif
+}
+
+#endif /* EVENT__HAVE_KQUEUE */
diff --git a/contrib/libs/libevent/listener.c b/contrib/libs/libevent/listener.c
index f5c00c9c0e..9d039a1df9 100644
--- a/contrib/libs/libevent/listener.c
+++ b/contrib/libs/libevent/listener.c
@@ -24,29 +24,29 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "event2/event-config.h"
-#include "evconfig-private.h"
-
+#include "event2/event-config.h"
+#include "evconfig-private.h"
+
#include <sys/types.h>
-#ifdef _WIN32
+#ifdef _WIN32
#ifndef _WIN32_WINNT
/* Minimum required for InitializeCriticalSectionAndSpinCount */
#define _WIN32_WINNT 0x0403
#endif
#include <winsock2.h>
-#include <winerror.h>
+#include <winerror.h>
#include <ws2tcpip.h>
#include <mswsock.h>
#endif
#include <errno.h>
-#ifdef EVENT__HAVE_SYS_SOCKET_H
+#ifdef EVENT__HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#ifdef EVENT__HAVE_FCNTL_H
+#ifdef EVENT__HAVE_FCNTL_H
#include <fcntl.h>
#endif
-#ifdef EVENT__HAVE_UNISTD_H
+#ifdef EVENT__HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -58,7 +58,7 @@
#include "util-internal.h"
#include "log-internal.h"
#include "evthread-internal.h"
-#ifdef _WIN32
+#ifdef _WIN32
#include "iocp-internal.h"
#include "defer-internal.h"
#include "event-internal.h"
@@ -81,7 +81,7 @@ struct evconnlistener {
void *user_data;
unsigned flags;
short refcnt;
- int accept4_flags;
+ int accept4_flags;
unsigned enabled : 1;
};
@@ -90,7 +90,7 @@ struct evconnlistener_event {
struct event listener;
};
-#ifdef _WIN32
+#ifdef _WIN32
struct evconnlistener_iocp {
struct evconnlistener base;
evutil_socket_t fd;
@@ -160,10 +160,10 @@ evconnlistener_new(struct event_base *base,
{
struct evconnlistener_event *lev;
-#ifdef _WIN32
- if (base && event_base_get_iocp_(base)) {
+#ifdef _WIN32
+ if (base && event_base_get_iocp_(base)) {
const struct win32_extension_fns *ext =
- event_get_win32_extension_fns_();
+ event_get_win32_extension_fns_();
if (ext->AcceptEx && ext->GetAcceptExSockaddrs)
return evconnlistener_new_async(base, cb, ptr, flags,
backlog, fd);
@@ -188,12 +188,12 @@ evconnlistener_new(struct event_base *base,
lev->base.flags = flags;
lev->base.refcnt = 1;
- lev->base.accept4_flags = 0;
- if (!(flags & LEV_OPT_LEAVE_SOCKETS_BLOCKING))
- lev->base.accept4_flags |= EVUTIL_SOCK_NONBLOCK;
- if (flags & LEV_OPT_CLOSE_ON_EXEC)
- lev->base.accept4_flags |= EVUTIL_SOCK_CLOEXEC;
-
+ lev->base.accept4_flags = 0;
+ if (!(flags & LEV_OPT_LEAVE_SOCKETS_BLOCKING))
+ lev->base.accept4_flags |= EVUTIL_SOCK_NONBLOCK;
+ if (flags & LEV_OPT_CLOSE_ON_EXEC)
+ lev->base.accept4_flags |= EVUTIL_SOCK_CLOEXEC;
+
if (flags & LEV_OPT_THREADSAFE) {
EVTHREAD_ALLOC_LOCK(lev->base.lock, EVTHREAD_LOCKTYPE_RECURSIVE);
}
@@ -201,8 +201,8 @@ evconnlistener_new(struct event_base *base,
event_assign(&lev->listener, base, fd, EV_READ|EV_PERSIST,
listener_read_cb, lev);
- if (!(flags & LEV_OPT_DISABLED))
- evconnlistener_enable(&lev->base);
+ if (!(flags & LEV_OPT_DISABLED))
+ evconnlistener_enable(&lev->base);
return &lev->base;
}
@@ -216,54 +216,54 @@ evconnlistener_new_bind(struct event_base *base, evconnlistener_cb cb,
evutil_socket_t fd;
int on = 1;
int family = sa ? sa->sa_family : AF_UNSPEC;
- int socktype = SOCK_STREAM | EVUTIL_SOCK_NONBLOCK;
+ int socktype = SOCK_STREAM | EVUTIL_SOCK_NONBLOCK;
if (backlog == 0)
return NULL;
- if (flags & LEV_OPT_CLOSE_ON_EXEC)
- socktype |= EVUTIL_SOCK_CLOEXEC;
-
- fd = evutil_socket_(family, socktype, 0);
+ if (flags & LEV_OPT_CLOSE_ON_EXEC)
+ socktype |= EVUTIL_SOCK_CLOEXEC;
+
+ fd = evutil_socket_(family, socktype, 0);
if (fd == -1)
return NULL;
- if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void*)&on, sizeof(on))<0)
- goto err;
-
- if (flags & LEV_OPT_REUSEABLE) {
- if (evutil_make_listen_socket_reuseable(fd) < 0)
- goto err;
+ if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void*)&on, sizeof(on))<0)
+ goto err;
+
+ if (flags & LEV_OPT_REUSEABLE) {
+ if (evutil_make_listen_socket_reuseable(fd) < 0)
+ goto err;
}
- if (flags & LEV_OPT_REUSEABLE_PORT) {
- if (evutil_make_listen_socket_reuseable_port(fd) < 0)
- goto err;
+ if (flags & LEV_OPT_REUSEABLE_PORT) {
+ if (evutil_make_listen_socket_reuseable_port(fd) < 0)
+ goto err;
}
- if (flags & LEV_OPT_DEFERRED_ACCEPT) {
- if (evutil_make_tcp_listen_socket_deferred(fd) < 0)
- goto err;
+ if (flags & LEV_OPT_DEFERRED_ACCEPT) {
+ if (evutil_make_tcp_listen_socket_deferred(fd) < 0)
+ goto err;
}
-
- if (flags & LEV_OPT_BIND_IPV6ONLY) {
- if (evutil_make_listen_socket_ipv6only(fd) < 0)
- goto err;
+
+ if (flags & LEV_OPT_BIND_IPV6ONLY) {
+ if (evutil_make_listen_socket_ipv6only(fd) < 0)
+ goto err;
}
if (sa) {
- if (bind(fd, sa, socklen)<0)
- goto err;
+ if (bind(fd, sa, socklen)<0)
+ goto err;
}
listener = evconnlistener_new(base, cb, ptr, flags, backlog, fd);
- if (!listener)
- goto err;
+ if (!listener)
+ goto err;
return listener;
-err:
- evutil_closesocket(fd);
- return NULL;
+err:
+ evutil_closesocket(fd);
+ return NULL;
}
void
@@ -401,8 +401,8 @@ listener_read_cb(evutil_socket_t fd, short what, void *p)
LOCK(lev);
while (1) {
struct sockaddr_storage ss;
- ev_socklen_t socklen = sizeof(ss);
- evutil_socket_t new_fd = evutil_accept4_(fd, (struct sockaddr*)&ss, &socklen, lev->accept4_flags);
+ ev_socklen_t socklen = sizeof(ss);
+ evutil_socket_t new_fd = evutil_accept4_(fd, (struct sockaddr*)&ss, &socklen, lev->accept4_flags);
if (new_fd < 0)
break;
if (socklen == 0) {
@@ -430,11 +430,11 @@ listener_read_cb(evutil_socket_t fd, short what, void *p)
return;
}
--lev->refcnt;
- if (!lev->enabled) {
- /* the callback could have disabled the listener */
- UNLOCK(lev);
- return;
- }
+ if (!lev->enabled) {
+ /* the callback could have disabled the listener */
+ UNLOCK(lev);
+ return;
+ }
}
err = evutil_socket_geterror(fd);
if (EVUTIL_ERR_ACCEPT_RETRIABLE(err)) {
@@ -451,17 +451,17 @@ listener_read_cb(evutil_socket_t fd, short what, void *p)
listener_decref_and_unlock(lev);
} else {
event_sock_warn(fd, "Error from accept() call");
- UNLOCK(lev);
+ UNLOCK(lev);
}
}
-#ifdef _WIN32
+#ifdef _WIN32
struct accepting_socket {
CRITICAL_SECTION lock;
struct event_overlapped overlapped;
SOCKET s;
int error;
- struct event_callback deferred;
+ struct event_callback deferred;
struct evconnlistener_iocp *lev;
ev_uint8_t buflen;
ev_uint8_t family;
@@ -471,7 +471,7 @@ struct accepting_socket {
static void accepted_socket_cb(struct event_overlapped *o, ev_uintptr_t key,
ev_ssize_t n, int ok);
-static void accepted_socket_invoke_user_cb(struct event_callback *cb, void *arg);
+static void accepted_socket_invoke_user_cb(struct event_callback *cb, void *arg);
static void
iocp_listener_event_add(struct evconnlistener_iocp *lev)
@@ -480,7 +480,7 @@ iocp_listener_event_add(struct evconnlistener_iocp *lev)
return;
lev->event_added = 1;
- event_base_add_virtual_(lev->event_base);
+ event_base_add_virtual_(lev->event_base);
}
static void
@@ -490,7 +490,7 @@ iocp_listener_event_del(struct evconnlistener_iocp *lev)
return;
lev->event_added = 0;
- event_base_del_virtual_(lev->event_base);
+ event_base_del_virtual_(lev->event_base);
}
static struct accepting_socket *
@@ -512,15 +512,15 @@ new_accepting_socket(struct evconnlistener_iocp *lev, int family)
if (!res)
return NULL;
- event_overlapped_init_(&res->overlapped, accepted_socket_cb);
- res->s = EVUTIL_INVALID_SOCKET;
+ event_overlapped_init_(&res->overlapped, accepted_socket_cb);
+ res->s = EVUTIL_INVALID_SOCKET;
res->lev = lev;
res->buflen = buflen;
res->family = family;
- event_deferred_cb_init_(&res->deferred,
- event_base_get_npriorities(lev->event_base) / 2,
- accepted_socket_invoke_user_cb, res);
+ event_deferred_cb_init_(&res->deferred,
+ event_base_get_npriorities(lev->event_base) / 2,
+ accepted_socket_invoke_user_cb, res);
InitializeCriticalSectionAndSpinCount(&res->lock, 1000);
@@ -531,7 +531,7 @@ static void
free_and_unlock_accepting_socket(struct accepting_socket *as)
{
/* requires lock. */
- if (as->s != EVUTIL_INVALID_SOCKET)
+ if (as->s != EVUTIL_INVALID_SOCKET)
closesocket(as->s);
LeaveCriticalSection(&as->lock);
@@ -543,7 +543,7 @@ static int
start_accepting(struct accepting_socket *as)
{
/* requires lock */
- const struct win32_extension_fns *ext = event_get_win32_extension_fns_();
+ const struct win32_extension_fns *ext = event_get_win32_extension_fns_();
DWORD pending = 0;
SOCKET s = socket(as->family, SOCK_STREAM, 0);
int error = 0;
@@ -551,7 +551,7 @@ start_accepting(struct accepting_socket *as)
if (!as->lev->base.enabled)
return 0;
- if (s == EVUTIL_INVALID_SOCKET) {
+ if (s == EVUTIL_INVALID_SOCKET) {
error = WSAGetLastError();
goto report_err;
}
@@ -564,7 +564,7 @@ start_accepting(struct accepting_socket *as)
if (!(as->lev->base.flags & LEV_OPT_LEAVE_SOCKETS_BLOCKING))
evutil_make_socket_nonblocking(s);
- if (event_iocp_port_associate_(as->lev->port, s, 1) < 0) {
+ if (event_iocp_port_associate_(as->lev->port, s, 1) < 0) {
closesocket(s);
return -1;
}
@@ -587,8 +587,8 @@ start_accepting(struct accepting_socket *as)
report_err:
as->error = error;
- event_deferred_cb_schedule_(
- as->lev->event_base,
+ event_deferred_cb_schedule_(
+ as->lev->event_base,
&as->deferred);
return 0;
}
@@ -598,18 +598,18 @@ stop_accepting(struct accepting_socket *as)
{
/* requires lock. */
SOCKET s = as->s;
- as->s = EVUTIL_INVALID_SOCKET;
+ as->s = EVUTIL_INVALID_SOCKET;
closesocket(s);
}
static void
-accepted_socket_invoke_user_cb(struct event_callback *dcb, void *arg)
+accepted_socket_invoke_user_cb(struct event_callback *dcb, void *arg)
{
struct accepting_socket *as = arg;
struct sockaddr *sa_local=NULL, *sa_remote=NULL;
int socklen_local=0, socklen_remote=0;
- const struct win32_extension_fns *ext = event_get_win32_extension_fns_();
+ const struct win32_extension_fns *ext = event_get_win32_extension_fns_();
struct evconnlistener *lev = &as->lev->base;
evutil_socket_t sock=-1;
void *data;
@@ -640,7 +640,7 @@ accepted_socket_invoke_user_cb(struct event_callback *dcb, void *arg)
&socklen_remote);
sock = as->s;
cb = lev->cb;
- as->s = EVUTIL_INVALID_SOCKET;
+ as->s = EVUTIL_INVALID_SOCKET;
/* We need to call this so getsockname, getpeername, and
* shutdown work correctly on the accepted socket. */
@@ -679,8 +679,8 @@ accepted_socket_cb(struct event_overlapped *o, ev_uintptr_t key, ev_ssize_t n, i
EnterCriticalSection(&as->lock);
if (ok) {
/* XXXX Don't do this if some EV_MT flag is set. */
- event_deferred_cb_schedule_(
- as->lev->event_base,
+ event_deferred_cb_schedule_(
+ as->lev->event_base,
&as->deferred);
LeaveCriticalSection(&as->lock);
} else if (as->free_on_cb) {
@@ -688,7 +688,7 @@ accepted_socket_cb(struct event_overlapped *o, ev_uintptr_t key, ev_ssize_t n, i
free_and_unlock_accepting_socket(as);
listener_decref_and_unlock(lev);
return;
- } else if (as->s == EVUTIL_INVALID_SOCKET) {
+ } else if (as->s == EVUTIL_INVALID_SOCKET) {
/* This is okay; we were disabled by iocp_listener_disable. */
LeaveCriticalSection(&as->lock);
} else {
@@ -704,8 +704,8 @@ accepted_socket_cb(struct event_overlapped *o, ev_uintptr_t key, ev_ssize_t n, i
} else {
as->error = WSAGetLastError();
}
- event_deferred_cb_schedule_(
- as->lev->event_base,
+ event_deferred_cb_schedule_(
+ as->lev->event_base,
&as->deferred);
LeaveCriticalSection(&as->lock);
}
@@ -726,7 +726,7 @@ iocp_listener_enable(struct evconnlistener *lev)
if (!as)
continue;
EnterCriticalSection(&as->lock);
- if (!as->free_on_cb && as->s == EVUTIL_INVALID_SOCKET)
+ if (!as->free_on_cb && as->s == EVUTIL_INVALID_SOCKET)
start_accepting(as);
LeaveCriticalSection(&as->lock);
}
@@ -748,7 +748,7 @@ iocp_listener_disable_impl(struct evconnlistener *lev, int shutdown)
if (!as)
continue;
EnterCriticalSection(&as->lock);
- if (!as->free_on_cb && as->s != EVUTIL_INVALID_SOCKET) {
+ if (!as->free_on_cb && as->s != EVUTIL_INVALID_SOCKET) {
if (shutdown)
as->free_on_cb = 1;
stop_accepting(as);
@@ -821,7 +821,7 @@ evconnlistener_new_async(struct event_base *base,
flags |= LEV_OPT_THREADSAFE;
- if (!base || !event_base_get_iocp_(base))
+ if (!base || !event_base_get_iocp_(base))
goto err;
/* XXXX duplicate code */
@@ -848,12 +848,12 @@ evconnlistener_new_async(struct event_base *base,
lev->base.refcnt = 1;
lev->base.enabled = 1;
- lev->port = event_base_get_iocp_(base);
+ lev->port = event_base_get_iocp_(base);
lev->fd = fd;
lev->event_base = base;
- if (event_iocp_port_associate_(lev->port, fd, 1) < 0)
+ if (event_iocp_port_associate_(lev->port, fd, 1) < 0)
goto err_free_lev;
EVTHREAD_ALLOC_LOCK(lev->base.lock, EVTHREAD_LOCKTYPE_RECURSIVE);
diff --git a/contrib/libs/libevent/log-internal.h b/contrib/libs/libevent/log-internal.h
index 2c31608b25..d2538f5226 100644
--- a/contrib/libs/libevent/log-internal.h
+++ b/contrib/libs/libevent/log-internal.h
@@ -24,15 +24,15 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef LOG_INTERNAL_H_INCLUDED_
-#define LOG_INTERNAL_H_INCLUDED_
+#ifndef LOG_INTERNAL_H_INCLUDED_
+#define LOG_INTERNAL_H_INCLUDED_
#include "event2/util.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef __GNUC__
#define EV_CHECK_FMT(a,b) __attribute__((format(printf, a, b)))
#define EV_NORETURN __attribute__((noreturn))
@@ -41,54 +41,54 @@ extern "C" {
#define EV_NORETURN
#endif
-#define EVENT_ERR_ABORT_ ((int)0xdeaddead)
+#define EVENT_ERR_ABORT_ ((int)0xdeaddead)
-#if !defined(EVENT__DISABLE_DEBUG_MODE) || defined(USE_DEBUG)
-#define EVENT_DEBUG_LOGGING_ENABLED
-#endif
-
-#ifdef EVENT_DEBUG_LOGGING_ENABLED
-EVENT2_CORE_EXPORT_SYMBOL extern ev_uint32_t event_debug_logging_mask_;
-#define event_debug_get_logging_mask_() (event_debug_logging_mask_)
-#else
-#define event_debug_get_logging_mask_() (0)
-#endif
-
-EVENT2_EXPORT_SYMBOL
+#if !defined(EVENT__DISABLE_DEBUG_MODE) || defined(USE_DEBUG)
+#define EVENT_DEBUG_LOGGING_ENABLED
+#endif
+
+#ifdef EVENT_DEBUG_LOGGING_ENABLED
+EVENT2_CORE_EXPORT_SYMBOL extern ev_uint32_t event_debug_logging_mask_;
+#define event_debug_get_logging_mask_() (event_debug_logging_mask_)
+#else
+#define event_debug_get_logging_mask_() (0)
+#endif
+
+EVENT2_EXPORT_SYMBOL
void event_err(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN;
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_warn(const char *fmt, ...) EV_CHECK_FMT(1,2);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_sock_err(int eval, evutil_socket_t sock, const char *fmt, ...) EV_CHECK_FMT(3,4) EV_NORETURN;
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_sock_warn(evutil_socket_t sock, const char *fmt, ...) EV_CHECK_FMT(2,3);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_errx(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN;
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_warnx(const char *fmt, ...) EV_CHECK_FMT(1,2);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_msgx(const char *fmt, ...) EV_CHECK_FMT(1,2);
-EVENT2_EXPORT_SYMBOL
-void event_debugx_(const char *fmt, ...) EV_CHECK_FMT(1,2);
+EVENT2_EXPORT_SYMBOL
+void event_debugx_(const char *fmt, ...) EV_CHECK_FMT(1,2);
-EVENT2_EXPORT_SYMBOL
-void event_logv_(int severity, const char *errstr, const char *fmt, va_list ap)
- EV_CHECK_FMT(3,0);
-
-#ifdef EVENT_DEBUG_LOGGING_ENABLED
-#define event_debug(x) do { \
- if (event_debug_get_logging_mask_()) { \
- event_debugx_ x; \
- } \
- } while (0)
+EVENT2_EXPORT_SYMBOL
+void event_logv_(int severity, const char *errstr, const char *fmt, va_list ap)
+ EV_CHECK_FMT(3,0);
+
+#ifdef EVENT_DEBUG_LOGGING_ENABLED
+#define event_debug(x) do { \
+ if (event_debug_get_logging_mask_()) { \
+ event_debugx_ x; \
+ } \
+ } while (0)
#else
-#define event_debug(x) ((void)0)
+#define event_debug(x) ((void)0)
#endif
#undef EV_CHECK_FMT
-#ifdef __cplusplus
-}
+#ifdef __cplusplus
+}
#endif
-
-#endif /* LOG_INTERNAL_H_INCLUDED_ */
+
+#endif /* LOG_INTERNAL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/log.c b/contrib/libs/libevent/log.c
index a9debb864e..da480ecb21 100644
--- a/contrib/libs/libevent/log.c
+++ b/contrib/libs/libevent/log.c
@@ -38,9 +38,9 @@
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
-#ifdef _WIN32
+#ifdef _WIN32
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -62,25 +62,25 @@ static void event_exit(int errcode) EV_NORETURN;
static event_fatal_cb fatal_fn = NULL;
-#ifdef EVENT_DEBUG_LOGGING_ENABLED
-#ifdef USE_DEBUG
-#define DEFAULT_MASK EVENT_DBG_ALL
-#else
-#define DEFAULT_MASK 0
-#endif
-
-EVENT2_EXPORT_SYMBOL ev_uint32_t event_debug_logging_mask_ = DEFAULT_MASK;
-#endif /* EVENT_DEBUG_LOGGING_ENABLED */
-
-void
-event_enable_debug_logging(ev_uint32_t which)
-{
-#ifdef EVENT_DEBUG_LOGGING_ENABLED
- event_debug_logging_mask_ = which;
-#endif
-}
-
+#ifdef EVENT_DEBUG_LOGGING_ENABLED
+#ifdef USE_DEBUG
+#define DEFAULT_MASK EVENT_DBG_ALL
+#else
+#define DEFAULT_MASK 0
+#endif
+
+EVENT2_EXPORT_SYMBOL ev_uint32_t event_debug_logging_mask_ = DEFAULT_MASK;
+#endif /* EVENT_DEBUG_LOGGING_ENABLED */
+
void
+event_enable_debug_logging(ev_uint32_t which)
+{
+#ifdef EVENT_DEBUG_LOGGING_ENABLED
+ event_debug_logging_mask_ = which;
+#endif
+}
+
+void
event_set_fatal_callback(event_fatal_cb cb)
{
fatal_fn = cb;
@@ -92,7 +92,7 @@ event_exit(int errcode)
if (fatal_fn) {
fatal_fn(errcode);
exit(errcode); /* should never be reached */
- } else if (errcode == EVENT_ERR_ABORT_)
+ } else if (errcode == EVENT_ERR_ABORT_)
abort();
else
exit(errcode);
@@ -104,7 +104,7 @@ event_err(int eval, const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- event_logv_(EVENT_LOG_ERR, strerror(errno), fmt, ap);
+ event_logv_(EVENT_LOG_ERR, strerror(errno), fmt, ap);
va_end(ap);
event_exit(eval);
}
@@ -115,7 +115,7 @@ event_warn(const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- event_logv_(EVENT_LOG_WARN, strerror(errno), fmt, ap);
+ event_logv_(EVENT_LOG_WARN, strerror(errno), fmt, ap);
va_end(ap);
}
@@ -126,7 +126,7 @@ event_sock_err(int eval, evutil_socket_t sock, const char *fmt, ...)
int err = evutil_socket_geterror(sock);
va_start(ap, fmt);
- event_logv_(EVENT_LOG_ERR, evutil_socket_error_to_string(err), fmt, ap);
+ event_logv_(EVENT_LOG_ERR, evutil_socket_error_to_string(err), fmt, ap);
va_end(ap);
event_exit(eval);
}
@@ -138,7 +138,7 @@ event_sock_warn(evutil_socket_t sock, const char *fmt, ...)
int err = evutil_socket_geterror(sock);
va_start(ap, fmt);
- event_logv_(EVENT_LOG_WARN, evutil_socket_error_to_string(err), fmt, ap);
+ event_logv_(EVENT_LOG_WARN, evutil_socket_error_to_string(err), fmt, ap);
va_end(ap);
}
@@ -148,7 +148,7 @@ event_errx(int eval, const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- event_logv_(EVENT_LOG_ERR, NULL, fmt, ap);
+ event_logv_(EVENT_LOG_ERR, NULL, fmt, ap);
va_end(ap);
event_exit(eval);
}
@@ -159,7 +159,7 @@ event_warnx(const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- event_logv_(EVENT_LOG_WARN, NULL, fmt, ap);
+ event_logv_(EVENT_LOG_WARN, NULL, fmt, ap);
va_end(ap);
}
@@ -169,29 +169,29 @@ event_msgx(const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- event_logv_(EVENT_LOG_MSG, NULL, fmt, ap);
+ event_logv_(EVENT_LOG_MSG, NULL, fmt, ap);
va_end(ap);
}
void
-event_debugx_(const char *fmt, ...)
+event_debugx_(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
- event_logv_(EVENT_LOG_DEBUG, NULL, fmt, ap);
+ event_logv_(EVENT_LOG_DEBUG, NULL, fmt, ap);
va_end(ap);
}
-void
-event_logv_(int severity, const char *errstr, const char *fmt, va_list ap)
+void
+event_logv_(int severity, const char *errstr, const char *fmt, va_list ap)
{
char buf[1024];
size_t len;
- if (severity == EVENT_LOG_DEBUG && !event_debug_get_logging_mask_())
- return;
-
+ if (severity == EVENT_LOG_DEBUG && !event_debug_get_logging_mask_())
+ return;
+
if (fmt != NULL)
evutil_vsnprintf(buf, sizeof(buf), fmt, ap);
else
@@ -223,16 +223,16 @@ event_log(int severity, const char *msg)
else {
const char *severity_str;
switch (severity) {
- case EVENT_LOG_DEBUG:
+ case EVENT_LOG_DEBUG:
severity_str = "debug";
break;
- case EVENT_LOG_MSG:
+ case EVENT_LOG_MSG:
severity_str = "msg";
break;
- case EVENT_LOG_WARN:
+ case EVENT_LOG_WARN:
severity_str = "warn";
break;
- case EVENT_LOG_ERR:
+ case EVENT_LOG_ERR:
severity_str = "err";
break;
default:
diff --git a/contrib/libs/libevent/minheap-internal.h b/contrib/libs/libevent/minheap-internal.h
index b3a0eb1fb5..ee5138ea0e 100644
--- a/contrib/libs/libevent/minheap-internal.h
+++ b/contrib/libs/libevent/minheap-internal.h
@@ -25,11 +25,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef MINHEAP_INTERNAL_H_INCLUDED_
-#define MINHEAP_INTERNAL_H_INCLUDED_
+#ifndef MINHEAP_INTERNAL_H_INCLUDED_
+#define MINHEAP_INTERNAL_H_INCLUDED_
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
#include "event2/event.h"
#include "event2/event_struct.h"
#include "event2/util.h"
@@ -42,41 +42,41 @@ typedef struct min_heap
unsigned n, a;
} min_heap_t;
-static inline void min_heap_ctor_(min_heap_t* s);
-static inline void min_heap_dtor_(min_heap_t* s);
-static inline void min_heap_elem_init_(struct event* e);
-static inline int min_heap_elt_is_top_(const struct event *e);
-static inline int min_heap_empty_(min_heap_t* s);
-static inline unsigned min_heap_size_(min_heap_t* s);
-static inline struct event* min_heap_top_(min_heap_t* s);
-static inline int min_heap_reserve_(min_heap_t* s, unsigned n);
-static inline int min_heap_push_(min_heap_t* s, struct event* e);
-static inline struct event* min_heap_pop_(min_heap_t* s);
-static inline int min_heap_adjust_(min_heap_t *s, struct event* e);
-static inline int min_heap_erase_(min_heap_t* s, struct event* e);
+static inline void min_heap_ctor_(min_heap_t* s);
+static inline void min_heap_dtor_(min_heap_t* s);
+static inline void min_heap_elem_init_(struct event* e);
+static inline int min_heap_elt_is_top_(const struct event *e);
+static inline int min_heap_empty_(min_heap_t* s);
+static inline unsigned min_heap_size_(min_heap_t* s);
+static inline struct event* min_heap_top_(min_heap_t* s);
+static inline int min_heap_reserve_(min_heap_t* s, unsigned n);
+static inline int min_heap_push_(min_heap_t* s, struct event* e);
+static inline struct event* min_heap_pop_(min_heap_t* s);
+static inline int min_heap_adjust_(min_heap_t *s, struct event* e);
+static inline int min_heap_erase_(min_heap_t* s, struct event* e);
static inline void min_heap_shift_up_(min_heap_t* s, unsigned hole_index, struct event* e);
-static inline void min_heap_shift_up_unconditional_(min_heap_t* s, unsigned hole_index, struct event* e);
+static inline void min_heap_shift_up_unconditional_(min_heap_t* s, unsigned hole_index, struct event* e);
static inline void min_heap_shift_down_(min_heap_t* s, unsigned hole_index, struct event* e);
-#define min_heap_elem_greater(a, b) \
- (evutil_timercmp(&(a)->ev_timeout, &(b)->ev_timeout, >))
+#define min_heap_elem_greater(a, b) \
+ (evutil_timercmp(&(a)->ev_timeout, &(b)->ev_timeout, >))
-void min_heap_ctor_(min_heap_t* s) { s->p = 0; s->n = 0; s->a = 0; }
-void min_heap_dtor_(min_heap_t* s) { if (s->p) mm_free(s->p); }
-void min_heap_elem_init_(struct event* e) { e->ev_timeout_pos.min_heap_idx = -1; }
-int min_heap_empty_(min_heap_t* s) { return 0u == s->n; }
-unsigned min_heap_size_(min_heap_t* s) { return s->n; }
-struct event* min_heap_top_(min_heap_t* s) { return s->n ? *s->p : 0; }
+void min_heap_ctor_(min_heap_t* s) { s->p = 0; s->n = 0; s->a = 0; }
+void min_heap_dtor_(min_heap_t* s) { if (s->p) mm_free(s->p); }
+void min_heap_elem_init_(struct event* e) { e->ev_timeout_pos.min_heap_idx = -1; }
+int min_heap_empty_(min_heap_t* s) { return 0u == s->n; }
+unsigned min_heap_size_(min_heap_t* s) { return s->n; }
+struct event* min_heap_top_(min_heap_t* s) { return s->n ? *s->p : 0; }
-int min_heap_push_(min_heap_t* s, struct event* e)
+int min_heap_push_(min_heap_t* s, struct event* e)
{
- if (s->n == UINT32_MAX || min_heap_reserve_(s, s->n + 1))
+ if (s->n == UINT32_MAX || min_heap_reserve_(s, s->n + 1))
return -1;
min_heap_shift_up_(s, s->n++, e);
return 0;
}
-struct event* min_heap_pop_(min_heap_t* s)
+struct event* min_heap_pop_(min_heap_t* s)
{
if (s->n)
{
@@ -88,12 +88,12 @@ struct event* min_heap_pop_(min_heap_t* s)
return 0;
}
-int min_heap_elt_is_top_(const struct event *e)
+int min_heap_elt_is_top_(const struct event *e)
{
return e->ev_timeout_pos.min_heap_idx == 0;
}
-int min_heap_erase_(min_heap_t* s, struct event* e)
+int min_heap_erase_(min_heap_t* s, struct event* e)
{
if (-1 != e->ev_timeout_pos.min_heap_idx)
{
@@ -105,7 +105,7 @@ int min_heap_erase_(min_heap_t* s, struct event* e)
to be less than the parent, it can't need to shift both up and
down. */
if (e->ev_timeout_pos.min_heap_idx > 0 && min_heap_elem_greater(s->p[parent], last))
- min_heap_shift_up_unconditional_(s, e->ev_timeout_pos.min_heap_idx, last);
+ min_heap_shift_up_unconditional_(s, e->ev_timeout_pos.min_heap_idx, last);
else
min_heap_shift_down_(s, e->ev_timeout_pos.min_heap_idx, last);
e->ev_timeout_pos.min_heap_idx = -1;
@@ -114,34 +114,34 @@ int min_heap_erase_(min_heap_t* s, struct event* e)
return -1;
}
-int min_heap_adjust_(min_heap_t *s, struct event *e)
-{
- if (-1 == e->ev_timeout_pos.min_heap_idx) {
- return min_heap_push_(s, e);
- } else {
- unsigned parent = (e->ev_timeout_pos.min_heap_idx - 1) / 2;
- /* The position of e has changed; we shift it up or down
- * as needed. We can't need to do both. */
- if (e->ev_timeout_pos.min_heap_idx > 0 && min_heap_elem_greater(s->p[parent], e))
- min_heap_shift_up_unconditional_(s, e->ev_timeout_pos.min_heap_idx, e);
- else
- min_heap_shift_down_(s, e->ev_timeout_pos.min_heap_idx, e);
- return 0;
- }
-}
-
-int min_heap_reserve_(min_heap_t* s, unsigned n)
+int min_heap_adjust_(min_heap_t *s, struct event *e)
{
+ if (-1 == e->ev_timeout_pos.min_heap_idx) {
+ return min_heap_push_(s, e);
+ } else {
+ unsigned parent = (e->ev_timeout_pos.min_heap_idx - 1) / 2;
+ /* The position of e has changed; we shift it up or down
+ * as needed. We can't need to do both. */
+ if (e->ev_timeout_pos.min_heap_idx > 0 && min_heap_elem_greater(s->p[parent], e))
+ min_heap_shift_up_unconditional_(s, e->ev_timeout_pos.min_heap_idx, e);
+ else
+ min_heap_shift_down_(s, e->ev_timeout_pos.min_heap_idx, e);
+ return 0;
+ }
+}
+
+int min_heap_reserve_(min_heap_t* s, unsigned n)
+{
if (s->a < n)
{
struct event** p;
unsigned a = s->a ? s->a * 2 : 8;
if (a < n)
a = n;
-#if (SIZE_MAX == UINT32_MAX)
- if (a > SIZE_MAX / sizeof *p)
- return -1;
-#endif
+#if (SIZE_MAX == UINT32_MAX)
+ if (a > SIZE_MAX / sizeof *p)
+ return -1;
+#endif
if (!(p = (struct event**)mm_realloc(s->p, a * sizeof *p)))
return -1;
s->p = p;
@@ -150,18 +150,18 @@ int min_heap_reserve_(min_heap_t* s, unsigned n)
return 0;
}
-void min_heap_shift_up_unconditional_(min_heap_t* s, unsigned hole_index, struct event* e)
-{
- unsigned parent = (hole_index - 1) / 2;
- do
- {
- (s->p[hole_index] = s->p[parent])->ev_timeout_pos.min_heap_idx = hole_index;
- hole_index = parent;
- parent = (hole_index - 1) / 2;
- } while (hole_index && min_heap_elem_greater(s->p[parent], e));
- (s->p[hole_index] = e)->ev_timeout_pos.min_heap_idx = hole_index;
-}
-
+void min_heap_shift_up_unconditional_(min_heap_t* s, unsigned hole_index, struct event* e)
+{
+ unsigned parent = (hole_index - 1) / 2;
+ do
+ {
+ (s->p[hole_index] = s->p[parent])->ev_timeout_pos.min_heap_idx = hole_index;
+ hole_index = parent;
+ parent = (hole_index - 1) / 2;
+ } while (hole_index && min_heap_elem_greater(s->p[parent], e));
+ (s->p[hole_index] = e)->ev_timeout_pos.min_heap_idx = hole_index;
+}
+
void min_heap_shift_up_(min_heap_t* s, unsigned hole_index, struct event* e)
{
unsigned parent = (hole_index - 1) / 2;
@@ -189,4 +189,4 @@ void min_heap_shift_down_(min_heap_t* s, unsigned hole_index, struct event* e)
(s->p[hole_index] = e)->ev_timeout_pos.min_heap_idx = hole_index;
}
-#endif /* MINHEAP_INTERNAL_H_INCLUDED_ */
+#endif /* MINHEAP_INTERNAL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/mm-internal.h b/contrib/libs/libevent/mm-internal.h
index 7a95c99561..77825d850c 100644
--- a/contrib/libs/libevent/mm-internal.h
+++ b/contrib/libs/libevent/mm-internal.h
@@ -23,8 +23,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef MM_INTERNAL_H_INCLUDED_
-#define MM_INTERNAL_H_INCLUDED_
+#ifndef MM_INTERNAL_H_INCLUDED_
+#define MM_INTERNAL_H_INCLUDED_
#include <sys/types.h>
@@ -32,45 +32,45 @@
extern "C" {
#endif
-#ifndef EVENT__DISABLE_MM_REPLACEMENT
+#ifndef EVENT__DISABLE_MM_REPLACEMENT
/* Internal use only: Memory allocation functions. We give them nice short
* mm_names for our own use, but make sure that the symbols have longer names
* so they don't conflict with other libraries (like, say, libmm). */
-
-/** Allocate uninitialized memory.
- *
- * @return On success, return a pointer to sz newly allocated bytes.
- * On failure, set errno to ENOMEM and return NULL.
- * If the argument sz is 0, simply return NULL.
- */
-EVENT2_EXPORT_SYMBOL
+
+/** Allocate uninitialized memory.
+ *
+ * @return On success, return a pointer to sz newly allocated bytes.
+ * On failure, set errno to ENOMEM and return NULL.
+ * If the argument sz is 0, simply return NULL.
+ */
+EVENT2_EXPORT_SYMBOL
void *event_mm_malloc_(size_t sz);
-
-/** Allocate memory initialized to zero.
- *
- * @return On success, return a pointer to (count * size) newly allocated
- * bytes, initialized to zero.
- * On failure, or if the product would result in an integer overflow,
- * set errno to ENOMEM and return NULL.
- * If either arguments are 0, simply return NULL.
- */
-EVENT2_EXPORT_SYMBOL
+
+/** Allocate memory initialized to zero.
+ *
+ * @return On success, return a pointer to (count * size) newly allocated
+ * bytes, initialized to zero.
+ * On failure, or if the product would result in an integer overflow,
+ * set errno to ENOMEM and return NULL.
+ * If either arguments are 0, simply return NULL.
+ */
+EVENT2_EXPORT_SYMBOL
void *event_mm_calloc_(size_t count, size_t size);
-
-/** Duplicate a string.
- *
- * @return On success, return a pointer to a newly allocated duplicate
- * of a string.
- * Set errno to ENOMEM and return NULL if a memory allocation error
- * occurs (or would occur) in the process.
- * If the argument str is NULL, set errno to EINVAL and return NULL.
- */
-EVENT2_EXPORT_SYMBOL
-char *event_mm_strdup_(const char *str);
-
-EVENT2_EXPORT_SYMBOL
+
+/** Duplicate a string.
+ *
+ * @return On success, return a pointer to a newly allocated duplicate
+ * of a string.
+ * Set errno to ENOMEM and return NULL if a memory allocation error
+ * occurs (or would occur) in the process.
+ * If the argument str is NULL, set errno to EINVAL and return NULL.
+ */
+EVENT2_EXPORT_SYMBOL
+char *event_mm_strdup_(const char *str);
+
+EVENT2_EXPORT_SYMBOL
void *event_mm_realloc_(void *p, size_t sz);
-EVENT2_EXPORT_SYMBOL
+EVENT2_EXPORT_SYMBOL
void event_mm_free_(void *p);
#define mm_malloc(sz) event_mm_malloc_(sz)
#define mm_calloc(count, size) event_mm_calloc_((count), (size))
diff --git a/contrib/libs/libevent/openssl-compat.h b/contrib/libs/libevent/openssl-compat.h
index a23e34251b..c0ac9e03ee 100644
--- a/contrib/libs/libevent/openssl-compat.h
+++ b/contrib/libs/libevent/openssl-compat.h
@@ -1,47 +1,47 @@
#ifndef OPENSSL_COMPAT_H
#define OPENSSL_COMPAT_H
-#include <openssl/bio.h>
-#include "util-internal.h"
+#include <openssl/bio.h>
+#include "util-internal.h"
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || \
- (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
-
-static inline BIO_METHOD *BIO_meth_new(int type, const char *name)
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || \
+ (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
+
+static inline BIO_METHOD *BIO_meth_new(int type, const char *name)
{
- BIO_METHOD *biom = calloc(1, sizeof(BIO_METHOD));
+ BIO_METHOD *biom = calloc(1, sizeof(BIO_METHOD));
- if (biom != NULL) {
- biom->type = type;
- biom->name = name;
- }
- return biom;
+ if (biom != NULL) {
+ biom->type = type;
+ biom->name = name;
+ }
+ return biom;
}
-#define BIO_meth_set_write(b, f) (b)->bwrite = (f)
-#define BIO_meth_set_read(b, f) (b)->bread = (f)
-#define BIO_meth_set_puts(b, f) (b)->bputs = (f)
-#define BIO_meth_set_ctrl(b, f) (b)->ctrl = (f)
-#define BIO_meth_set_create(b, f) (b)->create = (f)
-#define BIO_meth_set_destroy(b, f) (b)->destroy = (f)
+#define BIO_meth_set_write(b, f) (b)->bwrite = (f)
+#define BIO_meth_set_read(b, f) (b)->bread = (f)
+#define BIO_meth_set_puts(b, f) (b)->bputs = (f)
+#define BIO_meth_set_ctrl(b, f) (b)->ctrl = (f)
+#define BIO_meth_set_create(b, f) (b)->create = (f)
+#define BIO_meth_set_destroy(b, f) (b)->destroy = (f)
-#define BIO_set_init(b, val) (b)->init = (val)
-#define BIO_set_data(b, val) (b)->ptr = (val)
-#define BIO_set_shutdown(b, val) (b)->shutdown = (val)
-#define BIO_get_init(b) (b)->init
-#define BIO_get_data(b) (b)->ptr
-#define BIO_get_shutdown(b) (b)->shutdown
+#define BIO_set_init(b, val) (b)->init = (val)
+#define BIO_set_data(b, val) (b)->ptr = (val)
+#define BIO_set_shutdown(b, val) (b)->shutdown = (val)
+#define BIO_get_init(b) (b)->init
+#define BIO_get_data(b) (b)->ptr
+#define BIO_get_shutdown(b) (b)->shutdown
-#define TLS_method SSLv23_method
+#define TLS_method SSLv23_method
#define X509_getm_notBefore X509_get_notBefore
#define X509_getm_notAfter X509_get_notAfter
-#endif /* (OPENSSL_VERSION_NUMBER < 0x10100000L) || \
- (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) */
-
-#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20700000L
-#define BIO_get_init(b) (b)->init
-#endif
-
+#endif /* (OPENSSL_VERSION_NUMBER < 0x10100000L) || \
+ (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) */
+
+#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20700000L
+#define BIO_get_init(b) (b)->init
+#endif
+
#endif /* OPENSSL_COMPAT_H */
diff --git a/contrib/libs/libevent/poll.c b/contrib/libs/libevent/poll.c
index c3c9aac52a..ab13047a5f 100644
--- a/contrib/libs/libevent/poll.c
+++ b/contrib/libs/libevent/poll.c
@@ -27,12 +27,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
-
-#ifdef EVENT__HAVE_POLL
+#include "evconfig-private.h"
+#ifdef EVENT__HAVE_POLL
+
#include <sys/types.h>
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <sys/queue.h>
@@ -51,7 +51,7 @@
#include "evmap-internal.h"
#include "event2/thread.h"
#include "evthread-internal.h"
-#include "time-internal.h"
+#include "time-internal.h"
/* Since Linux 2.6.17, poll is able to report about peer half-closed connection
using special POLLRDHUP flag on a read event.
@@ -78,8 +78,8 @@ struct pollop {
};
static void *poll_init(struct event_base *);
-static int poll_add(struct event_base *, int, short old, short events, void *idx);
-static int poll_del(struct event_base *, int, short old, short events, void *idx);
+static int poll_add(struct event_base *, int, short old, short events, void *idx);
+static int poll_del(struct event_base *, int, short old, short events, void *idx);
static int poll_dispatch(struct event_base *, struct timeval *);
static void poll_dealloc(struct event_base *);
@@ -103,10 +103,10 @@ poll_init(struct event_base *base)
if (!(pollop = mm_calloc(1, sizeof(struct pollop))))
return (NULL);
- evsig_init_(base);
-
- evutil_weakrand_seed_(&base->weakrand_seed, 0);
+ evsig_init_(base);
+ evutil_weakrand_seed_(&base->weakrand_seed, 0);
+
return (pollop);
}
@@ -144,7 +144,7 @@ poll_dispatch(struct event_base *base, struct timeval *tv)
nfds = pop->nfds;
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
if (base->th_base_lock) {
/* If we're using this backend in a multithreaded setting,
* then we need to work on a copy of event_set, so that we can
@@ -172,7 +172,7 @@ poll_dispatch(struct event_base *base, struct timeval *tv)
#endif
if (tv != NULL) {
- msec = evutil_tv_to_msec_(tv);
+ msec = evutil_tv_to_msec_(tv);
if (msec < 0 || msec > INT_MAX)
msec = INT_MAX;
}
@@ -197,7 +197,7 @@ poll_dispatch(struct event_base *base, struct timeval *tv)
if (res == 0 || nfds == 0)
return (0);
- i = evutil_weakrand_range_(&base->weakrand_seed, nfds);
+ i = evutil_weakrand_range_(&base->weakrand_seed, nfds);
for (j = 0; j < nfds; j++) {
int what;
if (++i == nfds)
@@ -209,7 +209,7 @@ poll_dispatch(struct event_base *base, struct timeval *tv)
res = 0;
/* If the file gets closed notify */
- if (what & (POLLHUP|POLLERR|POLLNVAL))
+ if (what & (POLLHUP|POLLERR|POLLNVAL))
what |= POLLIN|POLLOUT;
if (what & POLLIN)
res |= EV_READ;
@@ -220,18 +220,18 @@ poll_dispatch(struct event_base *base, struct timeval *tv)
if (res == 0)
continue;
- evmap_io_active_(base, event_set[i].fd, res);
+ evmap_io_active_(base, event_set[i].fd, res);
}
return (0);
}
static int
-poll_add(struct event_base *base, int fd, short old, short events, void *idx_)
+poll_add(struct event_base *base, int fd, short old, short events, void *idx_)
{
struct pollop *pop = base->evbase;
struct pollfd *pfd = NULL;
- struct pollidx *idx = idx_;
+ struct pollidx *idx = idx_;
int i;
EVUTIL_ASSERT((events & EV_SIGNAL) == 0);
@@ -290,11 +290,11 @@ poll_add(struct event_base *base, int fd, short old, short events, void *idx_)
*/
static int
-poll_del(struct event_base *base, int fd, short old, short events, void *idx_)
+poll_del(struct event_base *base, int fd, short old, short events, void *idx_)
{
struct pollop *pop = base->evbase;
struct pollfd *pfd = NULL;
- struct pollidx *idx = idx_;
+ struct pollidx *idx = idx_;
int i;
EVUTIL_ASSERT((events & EV_SIGNAL) == 0);
@@ -330,7 +330,7 @@ poll_del(struct event_base *base, int fd, short old, short events, void *idx_)
*/
memcpy(&pop->event_set[i], &pop->event_set[pop->nfds],
sizeof(struct pollfd));
- idx = evmap_io_get_fdinfo_(&base->io, pop->event_set[i].fd);
+ idx = evmap_io_get_fdinfo_(&base->io, pop->event_set[i].fd);
EVUTIL_ASSERT(idx);
EVUTIL_ASSERT(idx->idxplus1 == pop->nfds + 1);
idx->idxplus1 = i + 1;
@@ -345,7 +345,7 @@ poll_dealloc(struct event_base *base)
{
struct pollop *pop = base->evbase;
- evsig_dealloc_(base);
+ evsig_dealloc_(base);
if (pop->event_set)
mm_free(pop->event_set);
if (pop->event_set_copy)
@@ -354,5 +354,5 @@ poll_dealloc(struct event_base *base)
memset(pop, 0, sizeof(struct pollop));
mm_free(pop);
}
-
-#endif /* EVENT__HAVE_POLL */
+
+#endif /* EVENT__HAVE_POLL */
diff --git a/contrib/libs/libevent/ratelim-internal.h b/contrib/libs/libevent/ratelim-internal.h
index 6cc1cdde2c..174c93a416 100644
--- a/contrib/libs/libevent/ratelim-internal.h
+++ b/contrib/libs/libevent/ratelim-internal.h
@@ -23,8 +23,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef RATELIM_INTERNAL_H_INCLUDED_
-#define RATELIM_INTERNAL_H_INCLUDED_
+#ifndef RATELIM_INTERNAL_H_INCLUDED_
+#define RATELIM_INTERNAL_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
@@ -65,13 +65,13 @@ struct ev_token_bucket_cfg {
/** The current tick is 'current_tick': add bytes to 'bucket' as specified in
* 'cfg'. */
-int ev_token_bucket_update_(struct ev_token_bucket *bucket,
+int ev_token_bucket_update_(struct ev_token_bucket *bucket,
const struct ev_token_bucket_cfg *cfg,
ev_uint32_t current_tick);
/** In which tick does 'tv' fall according to 'cfg'? Note that ticks can
* overflow easily; your code needs to handle this. */
-ev_uint32_t ev_token_bucket_get_tick_(const struct timeval *tv,
+ev_uint32_t ev_token_bucket_get_tick_(const struct timeval *tv,
const struct ev_token_bucket_cfg *cfg);
/** Adjust 'bucket' to respect 'cfg', and note that it was last updated in
@@ -79,12 +79,12 @@ ev_uint32_t ev_token_bucket_get_tick_(const struct timeval *tv,
* configuration of 'bucket'; otherwise, we are setting it up for the first
* time.
*/
-int ev_token_bucket_init_(struct ev_token_bucket *bucket,
+int ev_token_bucket_init_(struct ev_token_bucket *bucket,
const struct ev_token_bucket_cfg *cfg,
ev_uint32_t current_tick,
int reinitialize);
-int bufferevent_remove_from_rate_limit_group_internal_(struct bufferevent *bev,
+int bufferevent_remove_from_rate_limit_group_internal_(struct bufferevent *bev,
int unsuspend);
/** Decrease the read limit of 'b' by 'n' bytes */
diff --git a/contrib/libs/libevent/select.c b/contrib/libs/libevent/select.c
index b1db0e44b6..8925a63ca6 100644
--- a/contrib/libs/libevent/select.c
+++ b/contrib/libs/libevent/select.c
@@ -27,21 +27,21 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
-
-#ifdef EVENT__HAVE_SELECT
-
-#ifdef __APPLE__
-/* Apple wants us to define this if we might ever pass more than
- * FD_SETSIZE bits to select(). */
-#define _DARWIN_UNLIMITED_SELECT
-#endif
-
+#include "evconfig-private.h"
+
+#ifdef EVENT__HAVE_SELECT
+
+#ifdef __APPLE__
+/* Apple wants us to define this if we might ever pass more than
+ * FD_SETSIZE bits to select(). */
+#define _DARWIN_UNLIMITED_SELECT
+#endif
+
#include <sys/types.h>
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#ifdef EVENT__HAVE_SYS_SELECT_H
+#ifdef EVENT__HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <sys/queue.h>
@@ -59,7 +59,7 @@
#include "log-internal.h"
#include "evmap-internal.h"
-#ifndef EVENT__HAVE_FD_MASK
+#ifndef EVENT__HAVE_FD_MASK
/* This type is mandatory, but Android doesn't define it. */
typedef unsigned long fd_mask;
#endif
@@ -119,10 +119,10 @@ select_init(struct event_base *base)
return (NULL);
}
- evsig_init_(base);
-
- evutil_weakrand_seed_(&base->weakrand_seed, 0);
+ evsig_init_(base);
+ evutil_weakrand_seed_(&base->weakrand_seed, 0);
+
return (sop);
}
@@ -188,7 +188,7 @@ select_dispatch(struct event_base *base, struct timeval *tv)
event_debug(("%s: select reports %d", __func__, res));
check_selectop(sop);
- i = evutil_weakrand_range_(&base->weakrand_seed, nfds);
+ i = evutil_weakrand_range_(&base->weakrand_seed, nfds);
for (j = 0; j < nfds; ++j) {
if (++i >= nfds)
i = 0;
@@ -201,7 +201,7 @@ select_dispatch(struct event_base *base, struct timeval *tv)
if (res == 0)
continue;
- evmap_io_active_(base, i, res);
+ evmap_io_active_(base, i, res);
}
check_selectop(sop);
@@ -338,9 +338,9 @@ select_free_selectop(struct selectop *sop)
static void
select_dealloc(struct event_base *base)
{
- evsig_dealloc_(base);
+ evsig_dealloc_(base);
select_free_selectop(base->evbase);
}
-
-#endif /* EVENT__HAVE_SELECT */
+
+#endif /* EVENT__HAVE_SELECT */
diff --git a/contrib/libs/libevent/signal.c b/contrib/libs/libevent/signal.c
index 89f5fc1717..875dbcf9b9 100644
--- a/contrib/libs/libevent/signal.c
+++ b/contrib/libs/libevent/signal.c
@@ -27,31 +27,31 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "event2/event-config.h"
-#include "evconfig-private.h"
+#include "evconfig-private.h"
-#ifdef _WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
#include <sys/types.h>
-#ifdef EVENT__HAVE_SYS_TIME_H
+#ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifdef EVENT__HAVE_SYS_SOCKET_H
+#ifdef EVENT__HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef EVENT__HAVE_UNISTD_H
+#ifdef EVENT__HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
-#ifdef EVENT__HAVE_FCNTL_H
+#ifdef EVENT__HAVE_FCNTL_H
#include <fcntl.h>
#endif
@@ -82,13 +82,13 @@
on Linux do a reasonable thing using signalfd.
*/
-#ifndef _WIN32
+#ifndef _WIN32
/* Windows wants us to call our signal handlers as __cdecl. Nobody else
* expects you to do anything crazy like this. */
-#ifndef __cdecl
+#ifndef __cdecl
#define __cdecl
#endif
-#endif
+#endif
static int evsig_add(struct event_base *, evutil_socket_t, short, short, void *);
static int evsig_del(struct event_base *, evutil_socket_t, short, short, void *);
@@ -103,7 +103,7 @@ static const struct eventop evsigops = {
0, 0, 0
};
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
/* Lock for evsig_base and evsig_base_n_signals_added fields. */
static void *evsig_base_lock = NULL;
#endif
@@ -119,12 +119,12 @@ static void __cdecl evsig_handler(int sig);
#define EVSIGBASE_UNLOCK() EVLOCK_UNLOCK(evsig_base_lock, 0)
void
-evsig_set_base_(struct event_base *base)
+evsig_set_base_(struct event_base *base)
{
EVSIGBASE_LOCK();
evsig_base = base;
evsig_base_n_signals_added = base->sig.ev_n_signals_added;
- evsig_base_fd = base->sig.ev_signal_pair[1];
+ evsig_base_fd = base->sig.ev_signal_pair[1];
EVSIGBASE_UNLOCK();
}
@@ -143,11 +143,11 @@ evsig_cb(evutil_socket_t fd, short what, void *arg)
memset(&ncaught, 0, sizeof(ncaught));
while (1) {
-#ifdef _WIN32
+#ifdef _WIN32
n = recv(fd, signals, sizeof(signals), 0);
-#else
- n = read(fd, signals, sizeof(signals));
-#endif
+#else
+ n = read(fd, signals, sizeof(signals));
+#endif
if (n == -1) {
int err = evutil_socket_geterror(fd);
if (! EVUTIL_ERR_RW_RETRIABLE(err))
@@ -167,21 +167,21 @@ evsig_cb(evutil_socket_t fd, short what, void *arg)
EVBASE_ACQUIRE_LOCK(base, th_base_lock);
for (i = 0; i < NSIG; ++i) {
if (ncaught[i])
- evmap_signal_active_(base, i, ncaught[i]);
+ evmap_signal_active_(base, i, ncaught[i]);
}
EVBASE_RELEASE_LOCK(base, th_base_lock);
}
int
-evsig_init_(struct event_base *base)
+evsig_init_(struct event_base *base)
{
/*
* Our signal handler is going to write to one end of the socket
* pair to wake up our event loop. The event loop then scans for
* signals that got delivered.
*/
- if (evutil_make_internal_pipe_(base->sig.ev_signal_pair) == -1) {
-#ifdef _WIN32
+ if (evutil_make_internal_pipe_(base->sig.ev_signal_pair) == -1) {
+#ifdef _WIN32
/* Make this nonfatal on win32, where sometimes people
have localhost firewalled. */
event_sock_warn(-1, "%s: socketpair", __func__);
@@ -191,13 +191,13 @@ evsig_init_(struct event_base *base)
return -1;
}
- if (base->sig.sh_old) {
- mm_free(base->sig.sh_old);
- }
+ if (base->sig.sh_old) {
+ mm_free(base->sig.sh_old);
+ }
base->sig.sh_old = NULL;
base->sig.sh_old_max = 0;
- event_assign(&base->sig.ev_signal, base, base->sig.ev_signal_pair[0],
+ event_assign(&base->sig.ev_signal, base, base->sig.ev_signal_pair[0],
EV_READ | EV_PERSIST, evsig_cb, base);
base->sig.ev_signal.ev_flags |= EVLIST_INTERNAL;
@@ -211,10 +211,10 @@ evsig_init_(struct event_base *base)
/* Helper: set the signal handler for evsignal to handler in base, so that
* we can restore the original handler when we clear the current one. */
int
-evsig_set_handler_(struct event_base *base,
+evsig_set_handler_(struct event_base *base,
int evsignal, void (__cdecl *handler)(int))
{
-#ifdef EVENT__HAVE_SIGACTION
+#ifdef EVENT__HAVE_SIGACTION
struct sigaction sa;
#else
ev_sighandler_t sh;
@@ -251,7 +251,7 @@ evsig_set_handler_(struct event_base *base,
}
/* save previous handler and setup new handler */
-#ifdef EVENT__HAVE_SIGACTION
+#ifdef EVENT__HAVE_SIGACTION
memset(&sa, 0, sizeof(sa));
sa.sa_handler = handler;
sa.sa_flags |= SA_RESTART;
@@ -297,17 +297,17 @@ evsig_add(struct event_base *base, evutil_socket_t evsignal, short old, short ev
}
evsig_base = base;
evsig_base_n_signals_added = ++sig->ev_n_signals_added;
- evsig_base_fd = base->sig.ev_signal_pair[1];
+ evsig_base_fd = base->sig.ev_signal_pair[1];
EVSIGBASE_UNLOCK();
event_debug(("%s: %d: changing signal handler", __func__, (int)evsignal));
- if (evsig_set_handler_(base, (int)evsignal, evsig_handler) == -1) {
+ if (evsig_set_handler_(base, (int)evsignal, evsig_handler) == -1) {
goto err;
}
if (!sig->ev_signal_added) {
- if (event_add_nolock_(&sig->ev_signal, NULL, 0))
+ if (event_add_nolock_(&sig->ev_signal, NULL, 0))
goto err;
sig->ev_signal_added = 1;
}
@@ -323,26 +323,26 @@ err:
}
int
-evsig_restore_handler_(struct event_base *base, int evsignal)
+evsig_restore_handler_(struct event_base *base, int evsignal)
{
int ret = 0;
struct evsig_info *sig = &base->sig;
-#ifdef EVENT__HAVE_SIGACTION
+#ifdef EVENT__HAVE_SIGACTION
struct sigaction *sh;
#else
ev_sighandler_t *sh;
#endif
- if (evsignal >= sig->sh_old_max) {
- /* Can't actually restore. */
- /* XXXX.*/
- return 0;
- }
-
+ if (evsignal >= sig->sh_old_max) {
+ /* Can't actually restore. */
+ /* XXXX.*/
+ return 0;
+ }
+
/* restore previous handler */
sh = sig->sh_old[evsignal];
sig->sh_old[evsignal] = NULL;
-#ifdef EVENT__HAVE_SIGACTION
+#ifdef EVENT__HAVE_SIGACTION
if (sigaction(evsignal, sh, NULL) == -1) {
event_warn("sigaction");
ret = -1;
@@ -372,14 +372,14 @@ evsig_del(struct event_base *base, evutil_socket_t evsignal, short old, short ev
--base->sig.ev_n_signals_added;
EVSIGBASE_UNLOCK();
- return (evsig_restore_handler_(base, (int)evsignal));
+ return (evsig_restore_handler_(base, (int)evsignal));
}
static void __cdecl
evsig_handler(int sig)
{
int save_errno = errno;
-#ifdef _WIN32
+#ifdef _WIN32
int socket_errno = EVUTIL_SOCKET_ERROR();
#endif
ev_uint8_t msg;
@@ -391,41 +391,41 @@ evsig_handler(int sig)
return;
}
-#ifndef EVENT__HAVE_SIGACTION
+#ifndef EVENT__HAVE_SIGACTION
signal(sig, evsig_handler);
#endif
/* Wake up our notification mechanism */
msg = sig;
-#ifdef _WIN32
+#ifdef _WIN32
send(evsig_base_fd, (char*)&msg, 1, 0);
-#else
- {
- int r = write(evsig_base_fd, (char*)&msg, 1);
- (void)r; /* Suppress 'unused return value' and 'unused var' */
- }
-#endif
+#else
+ {
+ int r = write(evsig_base_fd, (char*)&msg, 1);
+ (void)r; /* Suppress 'unused return value' and 'unused var' */
+ }
+#endif
errno = save_errno;
-#ifdef _WIN32
+#ifdef _WIN32
EVUTIL_SET_SOCKET_ERROR(socket_errno);
#endif
}
void
-evsig_dealloc_(struct event_base *base)
+evsig_dealloc_(struct event_base *base)
{
int i = 0;
if (base->sig.ev_signal_added) {
event_del(&base->sig.ev_signal);
base->sig.ev_signal_added = 0;
}
- /* debug event is created in evsig_init_/event_assign even when
+ /* debug event is created in evsig_init_/event_assign even when
* ev_signal_added == 0, so unassign is required */
event_debug_unassign(&base->sig.ev_signal);
for (i = 0; i < NSIG; ++i) {
if (i < base->sig.sh_old_max && base->sig.sh_old[i] != NULL)
- evsig_restore_handler_(base, i);
+ evsig_restore_handler_(base, i);
}
EVSIGBASE_LOCK();
if (base == evsig_base) {
@@ -452,30 +452,30 @@ evsig_dealloc_(struct event_base *base)
}
}
-static void
-evsig_free_globals_locks(void)
-{
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
- if (evsig_base_lock != NULL) {
- EVTHREAD_FREE_LOCK(evsig_base_lock, 0);
- evsig_base_lock = NULL;
- }
-#endif
- return;
-}
-
-void
-evsig_free_globals_(void)
-{
- evsig_free_globals_locks();
-}
-
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
+static void
+evsig_free_globals_locks(void)
+{
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
+ if (evsig_base_lock != NULL) {
+ EVTHREAD_FREE_LOCK(evsig_base_lock, 0);
+ evsig_base_lock = NULL;
+ }
+#endif
+ return;
+}
+
+void
+evsig_free_globals_(void)
+{
+ evsig_free_globals_locks();
+}
+
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
int
evsig_global_setup_locks_(const int enable_locks)
{
EVTHREAD_SETUP_GLOBAL_LOCK(evsig_base_lock, 0);
return 0;
}
-
+
#endif
diff --git a/contrib/libs/libevent/strlcpy-internal.h b/contrib/libs/libevent/strlcpy-internal.h
index 4151d601d0..308f039d04 100644
--- a/contrib/libs/libevent/strlcpy-internal.h
+++ b/contrib/libs/libevent/strlcpy-internal.h
@@ -1,19 +1,19 @@
-#ifndef STRLCPY_INTERNAL_H_INCLUDED_
-#define STRLCPY_INTERNAL_H_INCLUDED_
+#ifndef STRLCPY_INTERNAL_H_INCLUDED_
+#define STRLCPY_INTERNAL_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
#endif
#include "event2/event-config.h"
-#include "event2/visibility.h"
-#include "evconfig-private.h"
+#include "event2/visibility.h"
+#include "evconfig-private.h"
-#ifndef EVENT__HAVE_STRLCPY
+#ifndef EVENT__HAVE_STRLCPY
#include <string.h>
-EVENT2_EXPORT_SYMBOL
-size_t event_strlcpy_(char *dst, const char *src, size_t siz);
-#define strlcpy event_strlcpy_
+EVENT2_EXPORT_SYMBOL
+size_t event_strlcpy_(char *dst, const char *src, size_t siz);
+#define strlcpy event_strlcpy_
#endif
#ifdef __cplusplus
diff --git a/contrib/libs/libevent/time-internal.h b/contrib/libs/libevent/time-internal.h
index e79e6a528d..eaad36d53e 100644
--- a/contrib/libs/libevent/time-internal.h
+++ b/contrib/libs/libevent/time-internal.h
@@ -1,101 +1,101 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef TIME_INTERNAL_H_INCLUDED_
-#define TIME_INTERNAL_H_INCLUDED_
-
-#include "event2/event-config.h"
-#include "evconfig-private.h"
-
-#ifdef EVENT__HAVE_MACH_MACH_TIME_H
-/* For mach_timebase_info */
-#include <mach/mach_time.h>
-#endif
-
-#include <time.h>
-
-#include "event2/util.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(EVENT__HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
-#define HAVE_POSIX_MONOTONIC
-#elif defined(EVENT__HAVE_MACH_ABSOLUTE_TIME)
-#define HAVE_MACH_MONOTONIC
-#elif defined(_WIN32)
-#define HAVE_WIN32_MONOTONIC
-#else
-#define HAVE_FALLBACK_MONOTONIC
-#endif
-
-long evutil_tv_to_msec_(const struct timeval *tv);
-EVENT2_EXPORT_SYMBOL
-void evutil_usleep_(const struct timeval *tv);
-
-#ifdef _WIN32
-typedef ULONGLONG (WINAPI *ev_GetTickCount_func)(void);
-#endif
-
-struct evutil_monotonic_timer {
-
-#ifdef HAVE_MACH_MONOTONIC
- struct mach_timebase_info mach_timebase_units;
-#endif
-
-#ifdef HAVE_POSIX_MONOTONIC
- int monotonic_clock;
-#endif
-
-#ifdef HAVE_WIN32_MONOTONIC
- ev_GetTickCount_func GetTickCount64_fn;
- ev_GetTickCount_func GetTickCount_fn;
- ev_uint64_t last_tick_count;
- ev_uint64_t adjust_tick_count;
-
- ev_uint64_t first_tick;
- ev_uint64_t first_counter;
- double usec_per_count;
- int use_performance_counter;
-#endif
-
- struct timeval adjust_monotonic_clock;
- struct timeval last_time;
-};
-
-EVENT2_EXPORT_SYMBOL
-int evutil_configure_monotonic_time_(struct evutil_monotonic_timer *mt,
- int flags);
-EVENT2_EXPORT_SYMBOL
-int evutil_gettime_monotonic_(struct evutil_monotonic_timer *mt, struct timeval *tv);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT_INTERNAL_H_INCLUDED_ */
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef TIME_INTERNAL_H_INCLUDED_
+#define TIME_INTERNAL_H_INCLUDED_
+
+#include "event2/event-config.h"
+#include "evconfig-private.h"
+
+#ifdef EVENT__HAVE_MACH_MACH_TIME_H
+/* For mach_timebase_info */
+#include <mach/mach_time.h>
+#endif
+
+#include <time.h>
+
+#include "event2/util.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(EVENT__HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
+#define HAVE_POSIX_MONOTONIC
+#elif defined(EVENT__HAVE_MACH_ABSOLUTE_TIME)
+#define HAVE_MACH_MONOTONIC
+#elif defined(_WIN32)
+#define HAVE_WIN32_MONOTONIC
+#else
+#define HAVE_FALLBACK_MONOTONIC
+#endif
+
+long evutil_tv_to_msec_(const struct timeval *tv);
+EVENT2_EXPORT_SYMBOL
+void evutil_usleep_(const struct timeval *tv);
+
+#ifdef _WIN32
+typedef ULONGLONG (WINAPI *ev_GetTickCount_func)(void);
+#endif
+
+struct evutil_monotonic_timer {
+
+#ifdef HAVE_MACH_MONOTONIC
+ struct mach_timebase_info mach_timebase_units;
+#endif
+
+#ifdef HAVE_POSIX_MONOTONIC
+ int monotonic_clock;
+#endif
+
+#ifdef HAVE_WIN32_MONOTONIC
+ ev_GetTickCount_func GetTickCount64_fn;
+ ev_GetTickCount_func GetTickCount_fn;
+ ev_uint64_t last_tick_count;
+ ev_uint64_t adjust_tick_count;
+
+ ev_uint64_t first_tick;
+ ev_uint64_t first_counter;
+ double usec_per_count;
+ int use_performance_counter;
+#endif
+
+ struct timeval adjust_monotonic_clock;
+ struct timeval last_time;
+};
+
+EVENT2_EXPORT_SYMBOL
+int evutil_configure_monotonic_time_(struct evutil_monotonic_timer *mt,
+ int flags);
+EVENT2_EXPORT_SYMBOL
+int evutil_gettime_monotonic_(struct evutil_monotonic_timer *mt, struct timeval *tv);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* EVENT_INTERNAL_H_INCLUDED_ */
diff --git a/contrib/libs/libevent/util-internal.h b/contrib/libs/libevent/util-internal.h
index 39576c71ca..6eac196626 100644
--- a/contrib/libs/libevent/util-internal.h
+++ b/contrib/libs/libevent/util-internal.h
@@ -23,77 +23,77 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef UTIL_INTERNAL_H_INCLUDED_
-#define UTIL_INTERNAL_H_INCLUDED_
+#ifndef UTIL_INTERNAL_H_INCLUDED_
+#define UTIL_INTERNAL_H_INCLUDED_
#include "event2/event-config.h"
-#include "evconfig-private.h"
-
+#include "evconfig-private.h"
+
#include <errno.h>
/* For EVUTIL_ASSERT */
#include "log-internal.h"
#include <stdio.h>
#include <stdlib.h>
-#ifdef EVENT__HAVE_SYS_SOCKET_H
+#ifdef EVENT__HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#ifdef EVENT__HAVE_SYS_EVENTFD_H
-#include <sys/eventfd.h>
-#endif
+#ifdef EVENT__HAVE_SYS_EVENTFD_H
+#include <sys/eventfd.h>
+#endif
#include "event2/util.h"
-#include "time-internal.h"
+#include "time-internal.h"
#include "ipv6-internal.h"
#ifdef __cplusplus
extern "C" {
#endif
-/* __has_attribute() wrapper */
-#ifdef __has_attribute
-# define EVUTIL_HAS_ATTRIBUTE __has_attribute
-#endif
-/** clang 3 __has_attribute misbehaves in some versions */
-#if defined(__clang__) && __clang__ == 1
-# if defined(__apple_build_version__)
-# if __clang_major__ <= 6
-# undef EVUTIL_HAS_ATTRIBUTE
-# endif
-# else /* !__apple_build_version__ */
-# if __clang_major__ == 3 && __clang_minor__ >= 2 && __clang_minor__ <= 5
-# undef EVUTIL_HAS_ATTRIBUTE
-# endif
-# endif /* __apple_build_version__ */
-#endif /*\ defined(__clang__) && __clang__ == 1 */
-#ifndef EVUTIL_HAS_ATTRIBUTE
-# define EVUTIL_HAS_ATTRIBUTE(x) 0
-#endif
-
+/* __has_attribute() wrapper */
+#ifdef __has_attribute
+# define EVUTIL_HAS_ATTRIBUTE __has_attribute
+#endif
+/** clang 3 __has_attribute misbehaves in some versions */
+#if defined(__clang__) && __clang__ == 1
+# if defined(__apple_build_version__)
+# if __clang_major__ <= 6
+# undef EVUTIL_HAS_ATTRIBUTE
+# endif
+# else /* !__apple_build_version__ */
+# if __clang_major__ == 3 && __clang_minor__ >= 2 && __clang_minor__ <= 5
+# undef EVUTIL_HAS_ATTRIBUTE
+# endif
+# endif /* __apple_build_version__ */
+#endif /*\ defined(__clang__) && __clang__ == 1 */
+#ifndef EVUTIL_HAS_ATTRIBUTE
+# define EVUTIL_HAS_ATTRIBUTE(x) 0
+#endif
+
/* If we need magic to say "inline", get it for free internally. */
-#ifdef EVENT__inline
-#define inline EVENT__inline
+#ifdef EVENT__inline
+#define inline EVENT__inline
#endif
-
-/* Define to appropriate substitute if compiler doesnt have __func__ */
-#if defined(EVENT__HAVE___func__)
-# ifndef __func__
-# define __func__ __func__
-# endif
-#elif defined(EVENT__HAVE___FUNCTION__)
-# define __func__ __FUNCTION__
-#else
-# define __func__ __FILE__
+
+/* Define to appropriate substitute if compiler doesnt have __func__ */
+#if defined(EVENT__HAVE___func__)
+# ifndef __func__
+# define __func__ __func__
+# endif
+#elif defined(EVENT__HAVE___FUNCTION__)
+# define __func__ __FUNCTION__
+#else
+# define __func__ __FILE__
#endif
/* A good no-op to use in macro definitions. */
-#define EVUTIL_NIL_STMT_ ((void)0)
+#define EVUTIL_NIL_STMT_ ((void)0)
/* A no-op that tricks the compiler into thinking a condition is used while
* definitely not making any code for it. Used to compile out asserts while
* avoiding "unused variable" warnings. The "!" forces the compiler to
* do the sizeof() on an int, in case "condition" is a bitfield value.
*/
-#define EVUTIL_NIL_CONDITION_(condition) do { \
+#define EVUTIL_NIL_CONDITION_(condition) do { \
(void)sizeof(!(condition)); \
} while(0)
@@ -105,36 +105,36 @@ extern "C" {
data," and we need to look at the error code. Second, Windows defines
a different set of error codes for sockets. */
-#ifndef _WIN32
-
-#if EAGAIN == EWOULDBLOCK
-#define EVUTIL_ERR_IS_EAGAIN(e) \
- ((e) == EAGAIN)
-#else
-#define EVUTIL_ERR_IS_EAGAIN(e) \
- ((e) == EAGAIN || (e) == EWOULDBLOCK)
-#endif
+#ifndef _WIN32
+#if EAGAIN == EWOULDBLOCK
+#define EVUTIL_ERR_IS_EAGAIN(e) \
+ ((e) == EAGAIN)
+#else
+#define EVUTIL_ERR_IS_EAGAIN(e) \
+ ((e) == EAGAIN || (e) == EWOULDBLOCK)
+#endif
+
/* True iff e is an error that means a read/write operation can be retried. */
#define EVUTIL_ERR_RW_RETRIABLE(e) \
- ((e) == EINTR || EVUTIL_ERR_IS_EAGAIN(e))
+ ((e) == EINTR || EVUTIL_ERR_IS_EAGAIN(e))
/* True iff e is an error that means an connect can be retried. */
#define EVUTIL_ERR_CONNECT_RETRIABLE(e) \
((e) == EINTR || (e) == EINPROGRESS)
/* True iff e is an error that means a accept can be retried. */
#define EVUTIL_ERR_ACCEPT_RETRIABLE(e) \
- ((e) == EINTR || EVUTIL_ERR_IS_EAGAIN(e) || (e) == ECONNABORTED)
+ ((e) == EINTR || EVUTIL_ERR_IS_EAGAIN(e) || (e) == ECONNABORTED)
/* True iff e is an error that means the connection was refused */
#define EVUTIL_ERR_CONNECT_REFUSED(e) \
((e) == ECONNREFUSED)
#else
-/* Win32 */
-
-#define EVUTIL_ERR_IS_EAGAIN(e) \
- ((e) == WSAEWOULDBLOCK || (e) == EAGAIN)
+/* Win32 */
+#define EVUTIL_ERR_IS_EAGAIN(e) \
+ ((e) == WSAEWOULDBLOCK || (e) == EAGAIN)
+
#define EVUTIL_ERR_RW_RETRIABLE(e) \
((e) == WSAEWOULDBLOCK || \
(e) == WSAEINTR)
@@ -162,7 +162,7 @@ extern "C" {
#ifdef SHUT_WR
#define EVUTIL_SHUT_WR SHUT_WR
#else
-#define EVUTIL_SHUT_WR 1 /* SD_SEND */
+#define EVUTIL_SHUT_WR 1 /* SD_SEND */
#endif
#ifdef SHUT_BOTH
#define EVUTIL_SHUT_BOTH SHUT_BOTH
@@ -170,106 +170,106 @@ extern "C" {
#define EVUTIL_SHUT_BOTH 2
#endif
-/* Helper: Verify that all the elements in 'dlist' are internally consistent.
- * Checks for circular lists and bad prev/next pointers.
- *
- * Example usage:
- * EVUTIL_ASSERT_LIST_OK(eventlist, event, ev_next);
- */
-#define EVUTIL_ASSERT_LIST_OK(dlist, type, field) do { \
- struct type *elm1, *elm2, **nextp; \
- if (LIST_EMPTY((dlist))) \
- break; \
- \
- /* Check list for circularity using Floyd's */ \
- /* 'Tortoise and Hare' algorithm */ \
- elm1 = LIST_FIRST((dlist)); \
- elm2 = LIST_NEXT(elm1, field); \
- while (elm1 && elm2) { \
- EVUTIL_ASSERT(elm1 != elm2); \
- elm1 = LIST_NEXT(elm1, field); \
- elm2 = LIST_NEXT(elm2, field); \
- if (!elm2) \
- break; \
- EVUTIL_ASSERT(elm1 != elm2); \
- elm2 = LIST_NEXT(elm2, field); \
- } \
- \
- /* Now check next and prev pointers for consistency. */ \
- nextp = &LIST_FIRST((dlist)); \
- elm1 = LIST_FIRST((dlist)); \
- while (elm1) { \
- EVUTIL_ASSERT(*nextp == elm1); \
- EVUTIL_ASSERT(nextp == elm1->field.le_prev); \
- nextp = &LIST_NEXT(elm1, field); \
- elm1 = *nextp; \
- } \
- } while (0)
-
-/* Helper: Verify that all the elements in a TAILQ are internally consistent.
- * Checks for circular lists and bad prev/next pointers.
- *
- * Example usage:
- * EVUTIL_ASSERT_TAILQ_OK(activelist, event, ev_active_next);
- */
-#define EVUTIL_ASSERT_TAILQ_OK(tailq, type, field) do { \
- struct type *elm1, *elm2, **nextp; \
- if (TAILQ_EMPTY((tailq))) \
- break; \
- \
- /* Check list for circularity using Floyd's */ \
- /* 'Tortoise and Hare' algorithm */ \
- elm1 = TAILQ_FIRST((tailq)); \
- elm2 = TAILQ_NEXT(elm1, field); \
- while (elm1 && elm2) { \
- EVUTIL_ASSERT(elm1 != elm2); \
- elm1 = TAILQ_NEXT(elm1, field); \
- elm2 = TAILQ_NEXT(elm2, field); \
- if (!elm2) \
- break; \
- EVUTIL_ASSERT(elm1 != elm2); \
- elm2 = TAILQ_NEXT(elm2, field); \
- } \
- \
- /* Now check next and prev pointers for consistency. */ \
- nextp = &TAILQ_FIRST((tailq)); \
- elm1 = TAILQ_FIRST((tailq)); \
- while (elm1) { \
- EVUTIL_ASSERT(*nextp == elm1); \
- EVUTIL_ASSERT(nextp == elm1->field.tqe_prev); \
- nextp = &TAILQ_NEXT(elm1, field); \
- elm1 = *nextp; \
- } \
- EVUTIL_ASSERT(nextp == (tailq)->tqh_last); \
- } while (0)
-
+/* Helper: Verify that all the elements in 'dlist' are internally consistent.
+ * Checks for circular lists and bad prev/next pointers.
+ *
+ * Example usage:
+ * EVUTIL_ASSERT_LIST_OK(eventlist, event, ev_next);
+ */
+#define EVUTIL_ASSERT_LIST_OK(dlist, type, field) do { \
+ struct type *elm1, *elm2, **nextp; \
+ if (LIST_EMPTY((dlist))) \
+ break; \
+ \
+ /* Check list for circularity using Floyd's */ \
+ /* 'Tortoise and Hare' algorithm */ \
+ elm1 = LIST_FIRST((dlist)); \
+ elm2 = LIST_NEXT(elm1, field); \
+ while (elm1 && elm2) { \
+ EVUTIL_ASSERT(elm1 != elm2); \
+ elm1 = LIST_NEXT(elm1, field); \
+ elm2 = LIST_NEXT(elm2, field); \
+ if (!elm2) \
+ break; \
+ EVUTIL_ASSERT(elm1 != elm2); \
+ elm2 = LIST_NEXT(elm2, field); \
+ } \
+ \
+ /* Now check next and prev pointers for consistency. */ \
+ nextp = &LIST_FIRST((dlist)); \
+ elm1 = LIST_FIRST((dlist)); \
+ while (elm1) { \
+ EVUTIL_ASSERT(*nextp == elm1); \
+ EVUTIL_ASSERT(nextp == elm1->field.le_prev); \
+ nextp = &LIST_NEXT(elm1, field); \
+ elm1 = *nextp; \
+ } \
+ } while (0)
+
+/* Helper: Verify that all the elements in a TAILQ are internally consistent.
+ * Checks for circular lists and bad prev/next pointers.
+ *
+ * Example usage:
+ * EVUTIL_ASSERT_TAILQ_OK(activelist, event, ev_active_next);
+ */
+#define EVUTIL_ASSERT_TAILQ_OK(tailq, type, field) do { \
+ struct type *elm1, *elm2, **nextp; \
+ if (TAILQ_EMPTY((tailq))) \
+ break; \
+ \
+ /* Check list for circularity using Floyd's */ \
+ /* 'Tortoise and Hare' algorithm */ \
+ elm1 = TAILQ_FIRST((tailq)); \
+ elm2 = TAILQ_NEXT(elm1, field); \
+ while (elm1 && elm2) { \
+ EVUTIL_ASSERT(elm1 != elm2); \
+ elm1 = TAILQ_NEXT(elm1, field); \
+ elm2 = TAILQ_NEXT(elm2, field); \
+ if (!elm2) \
+ break; \
+ EVUTIL_ASSERT(elm1 != elm2); \
+ elm2 = TAILQ_NEXT(elm2, field); \
+ } \
+ \
+ /* Now check next and prev pointers for consistency. */ \
+ nextp = &TAILQ_FIRST((tailq)); \
+ elm1 = TAILQ_FIRST((tailq)); \
+ while (elm1) { \
+ EVUTIL_ASSERT(*nextp == elm1); \
+ EVUTIL_ASSERT(nextp == elm1->field.tqe_prev); \
+ nextp = &TAILQ_NEXT(elm1, field); \
+ elm1 = *nextp; \
+ } \
+ EVUTIL_ASSERT(nextp == (tailq)->tqh_last); \
+ } while (0)
+
/* Locale-independent replacements for some ctypes functions. Use these
* when you care about ASCII's notion of character types, because you are about
* to send those types onto the wire.
*/
-EVENT2_EXPORT_SYMBOL
-int EVUTIL_ISALPHA_(char c);
-EVENT2_EXPORT_SYMBOL
-int EVUTIL_ISALNUM_(char c);
-int EVUTIL_ISSPACE_(char c);
-EVENT2_EXPORT_SYMBOL
-int EVUTIL_ISDIGIT_(char c);
-EVENT2_EXPORT_SYMBOL
-int EVUTIL_ISXDIGIT_(char c);
-int EVUTIL_ISPRINT_(char c);
-int EVUTIL_ISLOWER_(char c);
-int EVUTIL_ISUPPER_(char c);
-EVENT2_EXPORT_SYMBOL
-char EVUTIL_TOUPPER_(char c);
-EVENT2_EXPORT_SYMBOL
-char EVUTIL_TOLOWER_(char c);
-
-/** Remove all trailing horizontal whitespace (space or tab) from the end of a
- * string */
-EVENT2_EXPORT_SYMBOL
-void evutil_rtrim_lws_(char *);
-
-
+EVENT2_EXPORT_SYMBOL
+int EVUTIL_ISALPHA_(char c);
+EVENT2_EXPORT_SYMBOL
+int EVUTIL_ISALNUM_(char c);
+int EVUTIL_ISSPACE_(char c);
+EVENT2_EXPORT_SYMBOL
+int EVUTIL_ISDIGIT_(char c);
+EVENT2_EXPORT_SYMBOL
+int EVUTIL_ISXDIGIT_(char c);
+int EVUTIL_ISPRINT_(char c);
+int EVUTIL_ISLOWER_(char c);
+int EVUTIL_ISUPPER_(char c);
+EVENT2_EXPORT_SYMBOL
+char EVUTIL_TOUPPER_(char c);
+EVENT2_EXPORT_SYMBOL
+char EVUTIL_TOLOWER_(char c);
+
+/** Remove all trailing horizontal whitespace (space or tab) from the end of a
+ * string */
+EVENT2_EXPORT_SYMBOL
+void evutil_rtrim_lws_(char *);
+
+
/** Helper macro. If we know that a given pointer points to a field in a
structure, return a pointer to the structure itself. Used to implement
our half-baked C OO. Example:
@@ -291,56 +291,56 @@ void evutil_rtrim_lws_(char *);
/* As open(pathname, flags, mode), except that the file is always opened with
* the close-on-exec flag set. (And the mode argument is mandatory.)
*/
-int evutil_open_closeonexec_(const char *pathname, int flags, unsigned mode);
+int evutil_open_closeonexec_(const char *pathname, int flags, unsigned mode);
-EVENT2_EXPORT_SYMBOL
-int evutil_read_file_(const char *filename, char **content_out, size_t *len_out,
+EVENT2_EXPORT_SYMBOL
+int evutil_read_file_(const char *filename, char **content_out, size_t *len_out,
int is_binary);
-EVENT2_EXPORT_SYMBOL
-int evutil_socket_connect_(evutil_socket_t *fd_ptr, const struct sockaddr *sa, int socklen);
+EVENT2_EXPORT_SYMBOL
+int evutil_socket_connect_(evutil_socket_t *fd_ptr, const struct sockaddr *sa, int socklen);
-int evutil_socket_finished_connecting_(evutil_socket_t fd);
+int evutil_socket_finished_connecting_(evutil_socket_t fd);
-EVENT2_EXPORT_SYMBOL
-int evutil_ersatz_socketpair_(int, int , int, evutil_socket_t[]);
+EVENT2_EXPORT_SYMBOL
+int evutil_ersatz_socketpair_(int, int , int, evutil_socket_t[]);
-int evutil_resolve_(int family, const char *hostname, struct sockaddr *sa,
+int evutil_resolve_(int family, const char *hostname, struct sockaddr *sa,
ev_socklen_t *socklen, int port);
-const char *evutil_getenv_(const char *name);
-
-/* Structure to hold the state of our weak random number generator.
- */
-struct evutil_weakrand_state {
- ev_uint32_t seed;
-};
-
-#define EVUTIL_WEAKRAND_MAX EV_INT32_MAX
-
-/* Initialize the state of a week random number generator based on 'seed'. If
- * the seed is 0, construct a new seed based on not-very-strong platform
- * entropy, like the PID and the time of day.
- *
- * This function, and the other evutil_weakrand* functions, are meant for
- * speed, not security or statistical strength. If you need a RNG which an
- * attacker can't predict, or which passes strong statistical tests, use the
- * evutil_secure_rng* functions instead.
- */
-EVENT2_EXPORT_SYMBOL
-ev_uint32_t evutil_weakrand_seed_(struct evutil_weakrand_state *state, ev_uint32_t seed);
-/* Return a pseudorandom value between 0 and EVUTIL_WEAKRAND_MAX inclusive.
- * Updates the state in 'seed' as needed -- this value must be protected by a
- * lock.
- */
-EVENT2_EXPORT_SYMBOL
-ev_int32_t evutil_weakrand_(struct evutil_weakrand_state *seed);
-/* Return a pseudorandom value x such that 0 <= x < top. top must be no more
- * than EVUTIL_WEAKRAND_MAX. Updates the state in 'seed' as needed -- this
- * value must be proteced by a lock */
-EVENT2_EXPORT_SYMBOL
-ev_int32_t evutil_weakrand_range_(struct evutil_weakrand_state *seed, ev_int32_t top);
-
+const char *evutil_getenv_(const char *name);
+
+/* Structure to hold the state of our weak random number generator.
+ */
+struct evutil_weakrand_state {
+ ev_uint32_t seed;
+};
+
+#define EVUTIL_WEAKRAND_MAX EV_INT32_MAX
+
+/* Initialize the state of a week random number generator based on 'seed'. If
+ * the seed is 0, construct a new seed based on not-very-strong platform
+ * entropy, like the PID and the time of day.
+ *
+ * This function, and the other evutil_weakrand* functions, are meant for
+ * speed, not security or statistical strength. If you need a RNG which an
+ * attacker can't predict, or which passes strong statistical tests, use the
+ * evutil_secure_rng* functions instead.
+ */
+EVENT2_EXPORT_SYMBOL
+ev_uint32_t evutil_weakrand_seed_(struct evutil_weakrand_state *state, ev_uint32_t seed);
+/* Return a pseudorandom value between 0 and EVUTIL_WEAKRAND_MAX inclusive.
+ * Updates the state in 'seed' as needed -- this value must be protected by a
+ * lock.
+ */
+EVENT2_EXPORT_SYMBOL
+ev_int32_t evutil_weakrand_(struct evutil_weakrand_state *seed);
+/* Return a pseudorandom value x such that 0 <= x < top. top must be no more
+ * than EVUTIL_WEAKRAND_MAX. Updates the state in 'seed' as needed -- this
+ * value must be proteced by a lock */
+EVENT2_EXPORT_SYMBOL
+ev_int32_t evutil_weakrand_range_(struct evutil_weakrand_state *seed, ev_int32_t top);
+
/* Evaluates to the same boolean value as 'p', and hints to the compiler that
* we expect this value to be false. */
#if defined(__GNUC__) && __GNUC__ >= 3 /* gcc 3.0 or later */
@@ -349,21 +349,21 @@ ev_int32_t evutil_weakrand_range_(struct evutil_weakrand_state *seed, ev_int32_t
#define EVUTIL_UNLIKELY(p) (p)
#endif
-#if EVUTIL_HAS_ATTRIBUTE(fallthrough)
-#define EVUTIL_FALLTHROUGH __attribute__((fallthrough))
-#else
-#define EVUTIL_FALLTHROUGH /* fallthrough */
-#endif
-
+#if EVUTIL_HAS_ATTRIBUTE(fallthrough)
+#define EVUTIL_FALLTHROUGH __attribute__((fallthrough))
+#else
+#define EVUTIL_FALLTHROUGH /* fallthrough */
+#endif
+
/* Replacement for assert() that calls event_errx on failure. */
#ifdef NDEBUG
-#define EVUTIL_ASSERT(cond) EVUTIL_NIL_CONDITION_(cond)
+#define EVUTIL_ASSERT(cond) EVUTIL_NIL_CONDITION_(cond)
#define EVUTIL_FAILURE_CHECK(cond) 0
#else
#define EVUTIL_ASSERT(cond) \
do { \
if (EVUTIL_UNLIKELY(!(cond))) { \
- event_errx(EVENT_ERR_ABORT_, \
+ event_errx(EVENT_ERR_ABORT_, \
"%s:%d: Assertion %s failed in %s", \
__FILE__,__LINE__,#cond,__func__); \
/* In case a user-supplied handler tries to */ \
@@ -377,7 +377,7 @@ ev_int32_t evutil_weakrand_range_(struct evutil_weakrand_state *seed, ev_int32_t
#define EVUTIL_FAILURE_CHECK(cond) EVUTIL_UNLIKELY(cond)
#endif
-#ifndef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE
+#ifndef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE
/* Replacement for sockaddr storage that we can use internally on platforms
* that lack it. It is not space-efficient, but neither is sockaddr_storage.
*/
@@ -393,7 +393,7 @@ struct sockaddr_storage {
#endif
/* Internal addrinfo error code. This one is returned from only from
- * evutil_getaddrinfo_common_, when we are sure that we'll have to hit a DNS
+ * evutil_getaddrinfo_common_, when we are sure that we'll have to hit a DNS
* server. */
#define EVUTIL_EAI_NEED_RESOLVE -90002
@@ -404,36 +404,36 @@ typedef struct evdns_getaddrinfo_request* (*evdns_getaddrinfo_fn)(
const char *nodename, const char *servname,
const struct evutil_addrinfo *hints_in,
void (*cb)(int, struct evutil_addrinfo *, void *), void *arg);
-EVENT2_EXPORT_SYMBOL
-void evutil_set_evdns_getaddrinfo_fn_(evdns_getaddrinfo_fn fn);
-typedef void (*evdns_getaddrinfo_cancel_fn)(
- struct evdns_getaddrinfo_request *req);
-EVENT2_EXPORT_SYMBOL
-void evutil_set_evdns_getaddrinfo_cancel_fn_(evdns_getaddrinfo_cancel_fn fn);
-
-EVENT2_EXPORT_SYMBOL
-struct evutil_addrinfo *evutil_new_addrinfo_(struct sockaddr *sa,
+EVENT2_EXPORT_SYMBOL
+void evutil_set_evdns_getaddrinfo_fn_(evdns_getaddrinfo_fn fn);
+typedef void (*evdns_getaddrinfo_cancel_fn)(
+ struct evdns_getaddrinfo_request *req);
+EVENT2_EXPORT_SYMBOL
+void evutil_set_evdns_getaddrinfo_cancel_fn_(evdns_getaddrinfo_cancel_fn fn);
+
+EVENT2_EXPORT_SYMBOL
+struct evutil_addrinfo *evutil_new_addrinfo_(struct sockaddr *sa,
ev_socklen_t socklen, const struct evutil_addrinfo *hints);
-EVENT2_EXPORT_SYMBOL
-struct evutil_addrinfo *evutil_addrinfo_append_(struct evutil_addrinfo *first,
+EVENT2_EXPORT_SYMBOL
+struct evutil_addrinfo *evutil_addrinfo_append_(struct evutil_addrinfo *first,
struct evutil_addrinfo *append);
-EVENT2_EXPORT_SYMBOL
-void evutil_adjust_hints_for_addrconfig_(struct evutil_addrinfo *hints);
-EVENT2_EXPORT_SYMBOL
-int evutil_getaddrinfo_common_(const char *nodename, const char *servname,
+EVENT2_EXPORT_SYMBOL
+void evutil_adjust_hints_for_addrconfig_(struct evutil_addrinfo *hints);
+EVENT2_EXPORT_SYMBOL
+int evutil_getaddrinfo_common_(const char *nodename, const char *servname,
struct evutil_addrinfo *hints, struct evutil_addrinfo **res, int *portnum);
-struct evdns_getaddrinfo_request *evutil_getaddrinfo_async_(
- struct evdns_base *dns_base,
+struct evdns_getaddrinfo_request *evutil_getaddrinfo_async_(
+ struct evdns_base *dns_base,
const char *nodename, const char *servname,
const struct evutil_addrinfo *hints_in,
void (*cb)(int, struct evutil_addrinfo *, void *), void *arg);
-void evutil_getaddrinfo_cancel_async_(struct evdns_getaddrinfo_request *data);
+void evutil_getaddrinfo_cancel_async_(struct evdns_getaddrinfo_request *data);
/** Return true iff sa is a looback address. (That is, it is 127.0.0.1/8, or
* ::1). */
-EVENT2_EXPORT_SYMBOL
-int evutil_sockaddr_is_loopback_(const struct sockaddr *sa);
+EVENT2_EXPORT_SYMBOL
+int evutil_sockaddr_is_loopback_(const struct sockaddr *sa);
/**
@@ -441,18 +441,18 @@ int evutil_sockaddr_is_loopback_(const struct sockaddr *sa);
Returns a pointer to out. Always writes something into out, so it's safe
to use the output of this function without checking it for NULL.
*/
-EVENT2_EXPORT_SYMBOL
-const char *evutil_format_sockaddr_port_(const struct sockaddr *sa, char *out, size_t outlen);
-
-int evutil_hex_char_to_int_(char c);
+EVENT2_EXPORT_SYMBOL
+const char *evutil_format_sockaddr_port_(const struct sockaddr *sa, char *out, size_t outlen);
+int evutil_hex_char_to_int_(char c);
-void evutil_free_secure_rng_globals_(void);
-void evutil_free_globals_(void);
-#ifdef _WIN32
-EVENT2_EXPORT_SYMBOL
-HMODULE evutil_load_windows_system_library_(const TCHAR *library_name);
+void evutil_free_secure_rng_globals_(void);
+void evutil_free_globals_(void);
+
+#ifdef _WIN32
+EVENT2_EXPORT_SYMBOL
+HMODULE evutil_load_windows_system_library_(const TCHAR *library_name);
#endif
#ifndef EV_SIZE_FMT
@@ -477,7 +477,7 @@ HMODULE evutil_load_windows_system_library_(const TCHAR *library_name);
#define EV_SOCK_ARG(x) (x)
#endif
-#if defined(__STDC__) && defined(__STDC_VERSION__) && !defined(__MINGW64_VERSION_MAJOR)
+#if defined(__STDC__) && defined(__STDC_VERSION__) && !defined(__MINGW64_VERSION_MAJOR)
#if (__STDC_VERSION__ >= 199901L)
#define EV_SIZE_FMT "%zu"
#define EV_SSIZE_FMT "%zd"
@@ -487,7 +487,7 @@ HMODULE evutil_load_windows_system_library_(const TCHAR *library_name);
#endif
#ifndef EV_SIZE_FMT
-#if (EVENT__SIZEOF_SIZE_T <= EVENT__SIZEOF_LONG)
+#if (EVENT__SIZEOF_SIZE_T <= EVENT__SIZEOF_LONG)
#define EV_SIZE_FMT "%lu"
#define EV_SSIZE_FMT "%ld"
#define EV_SIZE_ARG(x) ((unsigned long)(x))
@@ -500,50 +500,50 @@ HMODULE evutil_load_windows_system_library_(const TCHAR *library_name);
#endif
#endif
-EVENT2_EXPORT_SYMBOL
-evutil_socket_t evutil_socket_(int domain, int type, int protocol);
-evutil_socket_t evutil_accept4_(evutil_socket_t sockfd, struct sockaddr *addr,
- ev_socklen_t *addrlen, int flags);
-
- /* used by one of the test programs.. */
-EVENT2_EXPORT_SYMBOL
-int evutil_make_internal_pipe_(evutil_socket_t fd[2]);
-evutil_socket_t evutil_eventfd_(unsigned initval, int flags);
-
-#ifdef SOCK_NONBLOCK
-#define EVUTIL_SOCK_NONBLOCK SOCK_NONBLOCK
-#else
-#define EVUTIL_SOCK_NONBLOCK 0x4000000
-#endif
-#ifdef SOCK_CLOEXEC
-#define EVUTIL_SOCK_CLOEXEC SOCK_CLOEXEC
-#else
-#define EVUTIL_SOCK_CLOEXEC 0x80000000
-#endif
-#ifdef EFD_NONBLOCK
-#define EVUTIL_EFD_NONBLOCK EFD_NONBLOCK
-#else
-#define EVUTIL_EFD_NONBLOCK 0x4000
-#endif
-#ifdef EFD_CLOEXEC
-#define EVUTIL_EFD_CLOEXEC EFD_CLOEXEC
-#else
-#define EVUTIL_EFD_CLOEXEC 0x8000
-#endif
-
+EVENT2_EXPORT_SYMBOL
+evutil_socket_t evutil_socket_(int domain, int type, int protocol);
+evutil_socket_t evutil_accept4_(evutil_socket_t sockfd, struct sockaddr *addr,
+ ev_socklen_t *addrlen, int flags);
+
+ /* used by one of the test programs.. */
+EVENT2_EXPORT_SYMBOL
+int evutil_make_internal_pipe_(evutil_socket_t fd[2]);
+evutil_socket_t evutil_eventfd_(unsigned initval, int flags);
+
+#ifdef SOCK_NONBLOCK
+#define EVUTIL_SOCK_NONBLOCK SOCK_NONBLOCK
+#else
+#define EVUTIL_SOCK_NONBLOCK 0x4000000
+#endif
+#ifdef SOCK_CLOEXEC
+#define EVUTIL_SOCK_CLOEXEC SOCK_CLOEXEC
+#else
+#define EVUTIL_SOCK_CLOEXEC 0x80000000
+#endif
+#ifdef EFD_NONBLOCK
+#define EVUTIL_EFD_NONBLOCK EFD_NONBLOCK
+#else
+#define EVUTIL_EFD_NONBLOCK 0x4000
+#endif
+#ifdef EFD_CLOEXEC
+#define EVUTIL_EFD_CLOEXEC EFD_CLOEXEC
+#else
+#define EVUTIL_EFD_CLOEXEC 0x8000
+#endif
+
void evutil_memclear_(void *mem, size_t len);
-struct in_addr;
-struct in6_addr;
-
-/* This is a any, loopback, link-local, multicast */
-EVENT2_EXPORT_SYMBOL
-int evutil_v4addr_is_local_(const struct in_addr *in);
-/* This is a reserved, ipv4compat, ipv4map, loopback,
- * link-local, multicast, or unspecified address. */
-EVENT2_EXPORT_SYMBOL
-int evutil_v6addr_is_local_(const struct in6_addr *in);
-
+struct in_addr;
+struct in6_addr;
+
+/* This is a any, loopback, link-local, multicast */
+EVENT2_EXPORT_SYMBOL
+int evutil_v4addr_is_local_(const struct in_addr *in);
+/* This is a reserved, ipv4compat, ipv4map, loopback,
+ * link-local, multicast, or unspecified address. */
+EVENT2_EXPORT_SYMBOL
+int evutil_v6addr_is_local_(const struct in6_addr *in);
+
#ifdef __cplusplus
}
#endif
diff --git a/contrib/libs/libevent/whatsnew-2.0.txt b/contrib/libs/libevent/whatsnew-2.0.txt
index 3561fcb94c..1f685ecd45 100644
--- a/contrib/libs/libevent/whatsnew-2.0.txt
+++ b/contrib/libs/libevent/whatsnew-2.0.txt
@@ -358,7 +358,7 @@ What's New In Libevent 2.0 so far:
any means provided to create an evbuffer except via evbuffer_new which
heap-allocated the buffer.
- If you need access to the whole buffer as a linear chunk of memory, the
+ If you need access to the whole buffer as a linear chunk of memory, the
EVBUFFER_DATA() function still works. Watch out, though: it needs to copy
the buffer's contents in a linear chunk before you can use it.
diff --git a/contrib/libs/libevent/win32select.c b/contrib/libs/libevent/win32select.c
index d005b587d4..ce8b7cee75 100644
--- a/contrib/libs/libevent/win32select.c
+++ b/contrib/libs/libevent/win32select.c
@@ -25,11 +25,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "event2/event-config.h"
-#include "evconfig-private.h"
-
-#ifdef _WIN32
+#include "event2/event-config.h"
+#include "evconfig-private.h"
+#ifdef _WIN32
+
#include <winsock2.h>
#include <windows.h>
#include <sys/types.h>
@@ -49,7 +49,7 @@
#include "evmap-internal.h"
#include "event2/thread.h"
#include "evthread-internal.h"
-#include "time-internal.h"
+#include "time-internal.h"
#define XFREE(ptr) do { if (ptr) mm_free(ptr); } while (0)
@@ -57,7 +57,7 @@ extern struct event_list timequeue;
extern struct event_list addqueue;
struct win_fd_set {
- unsigned int fd_count;
+ unsigned int fd_count;
SOCKET fd_array[1];
};
@@ -81,8 +81,8 @@ struct win32op {
};
static void *win32_init(struct event_base *);
-static int win32_add(struct event_base *, evutil_socket_t, short old, short events, void *idx_);
-static int win32_del(struct event_base *, evutil_socket_t, short old, short events, void *idx_);
+static int win32_add(struct event_base *, evutil_socket_t, short old, short events, void *idx_);
+static int win32_del(struct event_base *, evutil_socket_t, short old, short events, void *idx_);
static int win32_dispatch(struct event_base *base, struct timeval *);
static void win32_dealloc(struct event_base *);
@@ -164,7 +164,7 @@ do_fd_clear(struct event_base *base,
SOCKET s2;
s2 = set->fd_array[i] = set->fd_array[set->fd_count];
- ent2 = evmap_io_get_fdinfo_(&base->io, s2);
+ ent2 = evmap_io_get_fdinfo_(&base->io, s2);
if (!ent2) /* This indicates a bug. */
return (0);
@@ -178,7 +178,7 @@ do_fd_clear(struct event_base *base,
#define NEVENT 32
void *
-win32_init(struct event_base *base)
+win32_init(struct event_base *base)
{
struct win32op *winop;
size_t size;
@@ -200,11 +200,11 @@ win32_init(struct event_base *base)
winop->readset_out->fd_count = winop->writeset_out->fd_count
= winop->exset_out->fd_count = 0;
- if (evsig_init_(base) < 0)
+ if (evsig_init_(base) < 0)
winop->signals_are_broken = 1;
- evutil_weakrand_seed_(&base->weakrand_seed, 0);
-
+ evutil_weakrand_seed_(&base->weakrand_seed, 0);
+
return (winop);
err:
XFREE(winop->readset_in);
@@ -218,10 +218,10 @@ win32_init(struct event_base *base)
int
win32_add(struct event_base *base, evutil_socket_t fd,
- short old, short events, void *idx_)
+ short old, short events, void *idx_)
{
struct win32op *win32op = base->evbase;
- struct idx_info *idx = idx_;
+ struct idx_info *idx = idx_;
if ((events & EV_SIGNAL) && win32op->signals_are_broken)
return (-1);
@@ -243,10 +243,10 @@ win32_add(struct event_base *base, evutil_socket_t fd,
int
win32_del(struct event_base *base, evutil_socket_t fd, short old, short events,
- void *idx_)
+ void *idx_)
{
struct win32op *win32op = base->evbase;
- struct idx_info *idx = idx_;
+ struct idx_info *idx = idx_;
event_debug(("%s: Removing event for "EV_SOCK_FMT,
__func__, EV_SOCK_ARG(fd)));
@@ -305,7 +305,7 @@ win32_dispatch(struct event_base *base, struct timeval *tv)
win32op->readset_out->fd_count : win32op->writeset_out->fd_count;
if (!fd_count) {
- long msec = tv ? evutil_tv_to_msec_(tv) : LONG_MAX;
+ long msec = tv ? evutil_tv_to_msec_(tv) : LONG_MAX;
/* Sleep's DWORD argument is unsigned long */
if (msec < 0)
msec = LONG_MAX;
@@ -326,50 +326,50 @@ win32_dispatch(struct event_base *base, struct timeval *tv)
event_debug(("%s: select returned %d", __func__, res));
if (res <= 0) {
- event_debug(("%s: %s", __func__,
- evutil_socket_error_to_string(EVUTIL_SOCKET_ERROR())));
+ event_debug(("%s: %s", __func__,
+ evutil_socket_error_to_string(EVUTIL_SOCKET_ERROR())));
return res;
}
if (win32op->readset_out->fd_count) {
- i = evutil_weakrand_range_(&base->weakrand_seed,
- win32op->readset_out->fd_count);
+ i = evutil_weakrand_range_(&base->weakrand_seed,
+ win32op->readset_out->fd_count);
for (j=0; j<win32op->readset_out->fd_count; ++j) {
if (++i >= win32op->readset_out->fd_count)
i = 0;
s = win32op->readset_out->fd_array[i];
- evmap_io_active_(base, s, EV_READ);
+ evmap_io_active_(base, s, EV_READ);
}
}
if (win32op->exset_out->fd_count) {
- i = evutil_weakrand_range_(&base->weakrand_seed,
- win32op->exset_out->fd_count);
+ i = evutil_weakrand_range_(&base->weakrand_seed,
+ win32op->exset_out->fd_count);
for (j=0; j<win32op->exset_out->fd_count; ++j) {
if (++i >= win32op->exset_out->fd_count)
i = 0;
s = win32op->exset_out->fd_array[i];
- evmap_io_active_(base, s, EV_WRITE);
+ evmap_io_active_(base, s, EV_WRITE);
}
}
if (win32op->writeset_out->fd_count) {
- i = evutil_weakrand_range_(&base->weakrand_seed,
- win32op->writeset_out->fd_count);
+ i = evutil_weakrand_range_(&base->weakrand_seed,
+ win32op->writeset_out->fd_count);
for (j=0; j<win32op->writeset_out->fd_count; ++j) {
if (++i >= win32op->writeset_out->fd_count)
i = 0;
s = win32op->writeset_out->fd_array[i];
- evmap_io_active_(base, s, EV_WRITE);
+ evmap_io_active_(base, s, EV_WRITE);
}
}
return (0);
}
void
-win32_dealloc(struct event_base *base)
+win32_dealloc(struct event_base *base)
{
- struct win32op *win32op = base->evbase;
+ struct win32op *win32op = base->evbase;
- evsig_dealloc_(base);
+ evsig_dealloc_(base);
if (win32op->readset_in)
mm_free(win32op->readset_in);
if (win32op->writeset_in)
@@ -385,5 +385,5 @@ win32_dealloc(struct event_base *base)
memset(win32op, 0, sizeof(*win32op));
mm_free(win32op);
}
-
-#endif
+
+#endif
diff --git a/contrib/libs/libevent/ya.make b/contrib/libs/libevent/ya.make
index acfe9868c6..617b52b4b4 100644
--- a/contrib/libs/libevent/ya.make
+++ b/contrib/libs/libevent/ya.make
@@ -1,5 +1,5 @@
# Generated by devtools/yamaker from nixpkgs d78cb9fc184bc9f4e3d046ed0175734950fd0342.
-
+
LIBRARY()
OWNER(
@@ -8,9 +8,9 @@ OWNER(
kikht
g:cpp-contrib
)
-
+
VERSION(2.1.12)
-
+
ORIGINAL_SOURCE(https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz)
LICENSE(
@@ -22,32 +22,32 @@ LICENSE(
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-PEERDIR(
- contrib/libs/libevent/event_core
- contrib/libs/libevent/event_extra
- contrib/libs/libevent/event_openssl
- contrib/libs/libevent/event_thread
+PEERDIR(
+ contrib/libs/libevent/event_core
+ contrib/libs/libevent/event_extra
+ contrib/libs/libevent/event_openssl
+ contrib/libs/libevent/event_thread
)
ADDINCL(
GLOBAL contrib/libs/libevent/include
- contrib/libs/libevent
+ contrib/libs/libevent
)
-NO_COMPILER_WARNINGS()
+NO_COMPILER_WARNINGS()
-NO_RUNTIME()
+NO_RUNTIME()
-CFLAGS(
- -DHAVE_CONFIG_H
- -DEVENT__HAVE_STRLCPY=1
+CFLAGS(
+ -DHAVE_CONFIG_H
+ -DEVENT__HAVE_STRLCPY=1
)
-END()
+END()
-RECURSE(
- event_core
- event_extra
- event_openssl
- event_thread
+RECURSE(
+ event_core
+ event_extra
+ event_openssl
+ event_thread
)
diff --git a/contrib/libs/libiconv/ya.make b/contrib/libs/libiconv/ya.make
index e7c4e35e4c..ae4eaa9486 100644
--- a/contrib/libs/libiconv/ya.make
+++ b/contrib/libs/libiconv/ya.make
@@ -11,20 +11,20 @@ LICENSE(Service-Dll-Harness)
WITHOUT_LICENSE_TEXTS()
-NO_RUNTIME()
+NO_RUNTIME()
IF (USE_DYNAMIC_ICONV)
PEERDIR(
contrib/libs/libiconv/dynamic
- )
+ )
ELSE()
PEERDIR(
contrib/libs/libiconv/static
)
-ENDIF()
-
+ENDIF()
+
END()
-
+
RECURSE(
dynamic
static
diff --git a/contrib/libs/libxml/xmlIO.c b/contrib/libs/libxml/xmlIO.c
index 7921e793a0..1bdd610d6a 100644
--- a/contrib/libs/libxml/xmlIO.c
+++ b/contrib/libs/libxml/xmlIO.c
@@ -37,7 +37,7 @@
#include <zlib.h>
#endif
#ifdef LIBXML_LZMA_ENABLED
-#error #include <lzma.h>
+#error #include <lzma.h>
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
diff --git a/contrib/libs/libxml/xzlib.c b/contrib/libs/libxml/xzlib.c
index 1068963869..bc069e0d04 100644
--- a/contrib/libs/libxml/xzlib.c
+++ b/contrib/libs/libxml/xzlib.c
@@ -35,7 +35,7 @@
#include <zlib.h>
#endif
#ifdef LIBXML_LZMA_ENABLED
-#error #include <lzma.h>
+#error #include <lzma.h>
#endif
#error #include "xzlib.h"
diff --git a/contrib/libs/xz/common/ya.make b/contrib/libs/xz/common/ya.make
index ce25e6a230..e7c77091b7 100644
--- a/contrib/libs/xz/common/ya.make
+++ b/contrib/libs/xz/common/ya.make
@@ -19,7 +19,7 @@ CFLAGS(-DTUKLIB_SYMBOL_PREFIX=lzma_)
ADDINCL(
contrib/libs/xz
- contrib/libs/xz/common
+ contrib/libs/xz/common
)
SRCS(
diff --git a/contrib/libs/xz/liblzma/ya.make b/contrib/libs/xz/liblzma/ya.make
index d548283a2b..49cae5423c 100644
--- a/contrib/libs/xz/liblzma/ya.make
+++ b/contrib/libs/xz/liblzma/ya.make
@@ -20,7 +20,7 @@ NO_COMPILER_WARNINGS()
NO_UTIL()
CFLAGS(
- GLOBAL -DLZMA_API_STATIC
+ GLOBAL -DLZMA_API_STATIC
-DHAVE_CONFIG_H
-DTUKLIB_SYMBOL_PREFIX=lzma_
)
diff --git a/contrib/libs/ya.make b/contrib/libs/ya.make
index 9c4640fdcf..a460492d75 100644
--- a/contrib/libs/ya.make
+++ b/contrib/libs/ya.make
@@ -130,7 +130,7 @@ RECURSE(
kyotocabinet
lang_detect
lbfgs
- lcms2
+ lcms2
lepton
leveldb
libarchive
@@ -140,24 +140,24 @@ RECURSE(
libc_userver_workarounds
libcpuid
libcroco
- libde265
+ libde265
libdivide
libdivsufsort2
libeatmydata/dynamic
libev
- libevent
+ libevent
libexslt
libfdk-aac
libfuzzer12
libgeotiff
libgit2
libgraphqlparser
- libheif
+ libheif
libical
libiconv
libidn
libidn2
- libjpeg-turbo
+ libjpeg-turbo
libjwt
liblinear
libm
@@ -174,7 +174,7 @@ RECURSE(
libpq
libpqxx
libpsl
- libraw
+ libraw
librdkafka
librosa-cpp
librsvg
@@ -338,7 +338,7 @@ RECURSE(
tf-2.4/tensorflow/python
thrax
tinyalsa
- tlsh
+ tlsh
trace_viewer
tralics
tree_sitter
diff --git a/contrib/python/ya.make b/contrib/python/ya.make
index d01ced9f3a..e1b3de931f 100644
--- a/contrib/python/ya.make
+++ b/contrib/python/ya.make
@@ -391,7 +391,7 @@ RECURSE(
flask-cors
flask_graphql
Flask-Humanize
- Flask-Log-Request-ID
+ Flask-Log-Request-ID
Flask-Login
Flask-Mail
flask-marshmallow
@@ -415,7 +415,7 @@ RECURSE(
Flask-Table
Flask-UUID
Flask-WTF
- flatbuffers
+ flatbuffers
flex
flup
frozendict
@@ -465,7 +465,7 @@ RECURSE(
greenify
greenlet
grequests
- grpcio-opentracing
+ grpcio-opentracing
gspread
gunicorn
h11
diff --git a/contrib/restricted/uriparser/config.h b/contrib/restricted/uriparser/config.h
index ebb62f778d..ce701cad6d 100644
--- a/contrib/restricted/uriparser/config.h
+++ b/contrib/restricted/uriparser/config.h
@@ -35,17 +35,17 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
+
#if !defined(URI_CONFIG_H)
# define URI_CONFIG_H 1
-
-
-
+
+
+
#define PACKAGE_VERSION "0.9.6"
-
+
#define HAVE_WPRINTF
#define HAVE_REALLOCARRAY
-
-
-
+
+
+
#endif /* !defined(URI_CONFIG_H) */
diff --git a/contrib/restricted/uriparser/include/uriparser/Uri.h b/contrib/restricted/uriparser/include/uriparser/Uri.h
index ea4a913029..223d8749db 100644
--- a/contrib/restricted/uriparser/include/uriparser/Uri.h
+++ b/contrib/restricted/uriparser/include/uriparser/Uri.h
@@ -1,30 +1,30 @@
/* 0beb20dace01f4b2fa24c3bf9f7e8e616f621e4697260805a2b63a4d190e64c0 (0.9.6+)
- *
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+ *
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -32,1054 +32,1054 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file Uri.h
- * Holds the RFC 3986 %URI parser interface.
- * NOTE: This header includes itself twice.
- */
-
-#if (defined(URI_PASS_ANSI) && !defined(URI_H_ANSI)) \
- || (defined(URI_PASS_UNICODE) && !defined(URI_H_UNICODE)) \
- || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* What encodings are enabled? */
-#include "UriDefsConfig.h"
-#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* Include SELF twice */
-# ifdef URI_ENABLE_ANSI
-# define URI_PASS_ANSI 1
-# include "Uri.h"
-# undef URI_PASS_ANSI
-# endif
-# ifdef URI_ENABLE_UNICODE
-# define URI_PASS_UNICODE 1
-# include "Uri.h"
-# undef URI_PASS_UNICODE
-# endif
-/* Only one pass for each encoding */
-#elif (defined(URI_PASS_ANSI) && !defined(URI_H_ANSI) \
- && defined(URI_ENABLE_ANSI)) || (defined(URI_PASS_UNICODE) \
- && !defined(URI_H_UNICODE) && defined(URI_ENABLE_UNICODE))
-# ifdef URI_PASS_ANSI
-# define URI_H_ANSI 1
-# include "UriDefsAnsi.h"
-# else
-# define URI_H_UNICODE 1
-# include "UriDefsUnicode.h"
-# endif
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-#ifndef URI_DOXYGEN
-# include "UriBase.h"
-#endif
-
-
-
-/**
- * Specifies a range of characters within a string.
- * The range includes all characters from <c>first</c>
- * to one before <c>afterLast</c>. So if both are
- * non-NULL the difference is the length of the text range.
- *
- * @see UriUriA
- * @see UriPathSegmentA
- * @see UriHostDataA
- * @since 0.3.0
- */
-typedef struct URI_TYPE(TextRangeStruct) {
- const URI_CHAR * first; /**< Pointer to first character */
- const URI_CHAR * afterLast; /**< Pointer to character after the last one still in */
-} URI_TYPE(TextRange); /**< @copydoc UriTextRangeStructA */
-
-
-
-/**
- * Represents a path segment within a %URI path.
- * More precisely it is a node in a linked
- * list of path segments.
- *
- * @see UriUriA
- * @since 0.3.0
- */
-typedef struct URI_TYPE(PathSegmentStruct) {
- URI_TYPE(TextRange) text; /**< Path segment name */
- struct URI_TYPE(PathSegmentStruct) * next; /**< Pointer to the next path segment in the list, can be NULL if last already */
-
- void * reserved; /**< Reserved to the parser */
-} URI_TYPE(PathSegment); /**< @copydoc UriPathSegmentStructA */
-
-
-
-/**
- * Holds structured host information.
- * This is either a IPv4, IPv6, plain
- * text for IPvFuture or all zero for
- * a registered name.
- *
- * @see UriUriA
- * @since 0.3.0
- */
-typedef struct URI_TYPE(HostDataStruct) {
- UriIp4 * ip4; /**< IPv4 address */
- UriIp6 * ip6; /**< IPv6 address */
- URI_TYPE(TextRange) ipFuture; /**< IPvFuture address */
-} URI_TYPE(HostData); /**< @copydoc UriHostDataStructA */
-
-
-
-/**
- * Represents an RFC 3986 %URI.
- * Missing components can be {NULL, NULL} ranges.
- *
- * @see uriFreeUriMembersA
- * @see uriFreeUriMembersMmA
- * @see UriParserStateA
- * @since 0.3.0
- */
-typedef struct URI_TYPE(UriStruct) {
- URI_TYPE(TextRange) scheme; /**< Scheme (e.g. "http") */
- URI_TYPE(TextRange) userInfo; /**< User info (e.g. "user:pass") */
- URI_TYPE(TextRange) hostText; /**< Host text (set for all hosts, excluding square brackets) */
- URI_TYPE(HostData) hostData; /**< Structured host type specific data */
- URI_TYPE(TextRange) portText; /**< Port (e.g. "80") */
- URI_TYPE(PathSegment) * pathHead; /**< Head of a linked list of path segments */
- URI_TYPE(PathSegment) * pathTail; /**< Tail of the list behind pathHead */
- URI_TYPE(TextRange) query; /**< Query without leading "?" */
- URI_TYPE(TextRange) fragment; /**< Query without leading "#" */
- UriBool absolutePath; /**< Absolute path flag, distincting "a" and "/a";
- always <c>URI_FALSE</c> for URIs with host */
- UriBool owner; /**< Memory owner flag */
-
- void * reserved; /**< Reserved to the parser */
-} URI_TYPE(Uri); /**< @copydoc UriUriStructA */
-
-
-
-/**
- * Represents a state of the %URI parser.
- * Missing components can be NULL to reflect
- * a components absence.
- *
- * @see uriFreeUriMembersA
- * @see uriFreeUriMembersMmA
- * @since 0.3.0
- */
-typedef struct URI_TYPE(ParserStateStruct) {
- URI_TYPE(Uri) * uri; /**< Plug in the %URI structure to be filled while parsing here */
- int errorCode; /**< Code identifying the error which occurred */
- const URI_CHAR * errorPos; /**< Pointer to position in case of a syntax error */
-
- void * reserved; /**< Reserved to the parser */
-} URI_TYPE(ParserState); /**< @copydoc UriParserStateStructA */
-
-
-
-/**
- * Represents a query element.
- * More precisely it is a node in a linked
- * list of query elements.
- *
- * @since 0.7.0
- */
-typedef struct URI_TYPE(QueryListStruct) {
- const URI_CHAR * key; /**< Key of the query element */
- const URI_CHAR * value; /**< Value of the query element, can be NULL */
-
- struct URI_TYPE(QueryListStruct) * next; /**< Pointer to the next key/value pair in the list, can be NULL if last already */
-} URI_TYPE(QueryList); /**< @copydoc UriQueryListStructA */
-
-
-
-/**
- * Parses a RFC 3986 %URI.
- * Uses default libc-based memory manager.
- *
- * @param state <b>INOUT</b>: Parser state with set output %URI, must not be NULL
- * @param first <b>IN</b>: Pointer to the first character to parse, must not be NULL
- * @param afterLast <b>IN</b>: Pointer to the character after the last to parse, must not be NULL
- * @return 0 on success, error code otherwise
- *
- * @see uriParseUriA
- * @see uriParseSingleUriA
- * @see uriParseSingleUriExA
- * @see uriToStringA
- * @since 0.3.0
- * @deprecated Deprecated since 0.9.0, please migrate to uriParseSingleUriExA (with "Single").
- */
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file Uri.h
+ * Holds the RFC 3986 %URI parser interface.
+ * NOTE: This header includes itself twice.
+ */
+
+#if (defined(URI_PASS_ANSI) && !defined(URI_H_ANSI)) \
+ || (defined(URI_PASS_UNICODE) && !defined(URI_H_UNICODE)) \
+ || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* What encodings are enabled? */
+#include "UriDefsConfig.h"
+#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* Include SELF twice */
+# ifdef URI_ENABLE_ANSI
+# define URI_PASS_ANSI 1
+# include "Uri.h"
+# undef URI_PASS_ANSI
+# endif
+# ifdef URI_ENABLE_UNICODE
+# define URI_PASS_UNICODE 1
+# include "Uri.h"
+# undef URI_PASS_UNICODE
+# endif
+/* Only one pass for each encoding */
+#elif (defined(URI_PASS_ANSI) && !defined(URI_H_ANSI) \
+ && defined(URI_ENABLE_ANSI)) || (defined(URI_PASS_UNICODE) \
+ && !defined(URI_H_UNICODE) && defined(URI_ENABLE_UNICODE))
+# ifdef URI_PASS_ANSI
+# define URI_H_ANSI 1
+# include "UriDefsAnsi.h"
+# else
+# define URI_H_UNICODE 1
+# include "UriDefsUnicode.h"
+# endif
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#ifndef URI_DOXYGEN
+# include "UriBase.h"
+#endif
+
+
+
+/**
+ * Specifies a range of characters within a string.
+ * The range includes all characters from <c>first</c>
+ * to one before <c>afterLast</c>. So if both are
+ * non-NULL the difference is the length of the text range.
+ *
+ * @see UriUriA
+ * @see UriPathSegmentA
+ * @see UriHostDataA
+ * @since 0.3.0
+ */
+typedef struct URI_TYPE(TextRangeStruct) {
+ const URI_CHAR * first; /**< Pointer to first character */
+ const URI_CHAR * afterLast; /**< Pointer to character after the last one still in */
+} URI_TYPE(TextRange); /**< @copydoc UriTextRangeStructA */
+
+
+
+/**
+ * Represents a path segment within a %URI path.
+ * More precisely it is a node in a linked
+ * list of path segments.
+ *
+ * @see UriUriA
+ * @since 0.3.0
+ */
+typedef struct URI_TYPE(PathSegmentStruct) {
+ URI_TYPE(TextRange) text; /**< Path segment name */
+ struct URI_TYPE(PathSegmentStruct) * next; /**< Pointer to the next path segment in the list, can be NULL if last already */
+
+ void * reserved; /**< Reserved to the parser */
+} URI_TYPE(PathSegment); /**< @copydoc UriPathSegmentStructA */
+
+
+
+/**
+ * Holds structured host information.
+ * This is either a IPv4, IPv6, plain
+ * text for IPvFuture or all zero for
+ * a registered name.
+ *
+ * @see UriUriA
+ * @since 0.3.0
+ */
+typedef struct URI_TYPE(HostDataStruct) {
+ UriIp4 * ip4; /**< IPv4 address */
+ UriIp6 * ip6; /**< IPv6 address */
+ URI_TYPE(TextRange) ipFuture; /**< IPvFuture address */
+} URI_TYPE(HostData); /**< @copydoc UriHostDataStructA */
+
+
+
+/**
+ * Represents an RFC 3986 %URI.
+ * Missing components can be {NULL, NULL} ranges.
+ *
+ * @see uriFreeUriMembersA
+ * @see uriFreeUriMembersMmA
+ * @see UriParserStateA
+ * @since 0.3.0
+ */
+typedef struct URI_TYPE(UriStruct) {
+ URI_TYPE(TextRange) scheme; /**< Scheme (e.g. "http") */
+ URI_TYPE(TextRange) userInfo; /**< User info (e.g. "user:pass") */
+ URI_TYPE(TextRange) hostText; /**< Host text (set for all hosts, excluding square brackets) */
+ URI_TYPE(HostData) hostData; /**< Structured host type specific data */
+ URI_TYPE(TextRange) portText; /**< Port (e.g. "80") */
+ URI_TYPE(PathSegment) * pathHead; /**< Head of a linked list of path segments */
+ URI_TYPE(PathSegment) * pathTail; /**< Tail of the list behind pathHead */
+ URI_TYPE(TextRange) query; /**< Query without leading "?" */
+ URI_TYPE(TextRange) fragment; /**< Query without leading "#" */
+ UriBool absolutePath; /**< Absolute path flag, distincting "a" and "/a";
+ always <c>URI_FALSE</c> for URIs with host */
+ UriBool owner; /**< Memory owner flag */
+
+ void * reserved; /**< Reserved to the parser */
+} URI_TYPE(Uri); /**< @copydoc UriUriStructA */
+
+
+
+/**
+ * Represents a state of the %URI parser.
+ * Missing components can be NULL to reflect
+ * a components absence.
+ *
+ * @see uriFreeUriMembersA
+ * @see uriFreeUriMembersMmA
+ * @since 0.3.0
+ */
+typedef struct URI_TYPE(ParserStateStruct) {
+ URI_TYPE(Uri) * uri; /**< Plug in the %URI structure to be filled while parsing here */
+ int errorCode; /**< Code identifying the error which occurred */
+ const URI_CHAR * errorPos; /**< Pointer to position in case of a syntax error */
+
+ void * reserved; /**< Reserved to the parser */
+} URI_TYPE(ParserState); /**< @copydoc UriParserStateStructA */
+
+
+
+/**
+ * Represents a query element.
+ * More precisely it is a node in a linked
+ * list of query elements.
+ *
+ * @since 0.7.0
+ */
+typedef struct URI_TYPE(QueryListStruct) {
+ const URI_CHAR * key; /**< Key of the query element */
+ const URI_CHAR * value; /**< Value of the query element, can be NULL */
+
+ struct URI_TYPE(QueryListStruct) * next; /**< Pointer to the next key/value pair in the list, can be NULL if last already */
+} URI_TYPE(QueryList); /**< @copydoc UriQueryListStructA */
+
+
+
+/**
+ * Parses a RFC 3986 %URI.
+ * Uses default libc-based memory manager.
+ *
+ * @param state <b>INOUT</b>: Parser state with set output %URI, must not be NULL
+ * @param first <b>IN</b>: Pointer to the first character to parse, must not be NULL
+ * @param afterLast <b>IN</b>: Pointer to the character after the last to parse, must not be NULL
+ * @return 0 on success, error code otherwise
+ *
+ * @see uriParseUriA
+ * @see uriParseSingleUriA
+ * @see uriParseSingleUriExA
+ * @see uriToStringA
+ * @since 0.3.0
+ * @deprecated Deprecated since 0.9.0, please migrate to uriParseSingleUriExA (with "Single").
+ */
URI_PUBLIC int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast);
-
-
-
-/**
- * Parses a RFC 3986 %URI.
- * Uses default libc-based memory manager.
- *
- * @param state <b>INOUT</b>: Parser state with set output %URI, must not be NULL
- * @param text <b>IN</b>: Text to parse, must not be NULL
- * @return 0 on success, error code otherwise
- *
- * @see uriParseUriExA
- * @see uriParseSingleUriA
- * @see uriParseSingleUriExA
- * @see uriToStringA
- * @since 0.3.0
- * @deprecated Deprecated since 0.9.0, please migrate to uriParseSingleUriA (with "Single").
- */
+ const URI_CHAR * first, const URI_CHAR * afterLast);
+
+
+
+/**
+ * Parses a RFC 3986 %URI.
+ * Uses default libc-based memory manager.
+ *
+ * @param state <b>INOUT</b>: Parser state with set output %URI, must not be NULL
+ * @param text <b>IN</b>: Text to parse, must not be NULL
+ * @return 0 on success, error code otherwise
+ *
+ * @see uriParseUriExA
+ * @see uriParseSingleUriA
+ * @see uriParseSingleUriExA
+ * @see uriToStringA
+ * @since 0.3.0
+ * @deprecated Deprecated since 0.9.0, please migrate to uriParseSingleUriA (with "Single").
+ */
URI_PUBLIC int URI_FUNC(ParseUri)(URI_TYPE(ParserState) * state,
- const URI_CHAR * text);
-
-
-
-/**
- * Parses a single RFC 3986 %URI.
- * Uses default libc-based memory manager.
- *
- * @param uri <b>OUT</b>: Output %URI, must not be NULL
- * @param text <b>IN</b>: Pointer to the first character to parse,
- * must not be NULL
- * @param errorPos <b>OUT</b>: Pointer to a pointer to the first character
- * causing a syntax error, can be NULL;
- * only set when URI_ERROR_SYNTAX was returned
- * @return 0 on success, error code otherwise
- *
- * @see uriParseSingleUriExA
- * @see uriParseSingleUriExMmA
- * @see uriToStringA
- * @since 0.9.0
- */
+ const URI_CHAR * text);
+
+
+
+/**
+ * Parses a single RFC 3986 %URI.
+ * Uses default libc-based memory manager.
+ *
+ * @param uri <b>OUT</b>: Output %URI, must not be NULL
+ * @param text <b>IN</b>: Pointer to the first character to parse,
+ * must not be NULL
+ * @param errorPos <b>OUT</b>: Pointer to a pointer to the first character
+ * causing a syntax error, can be NULL;
+ * only set when URI_ERROR_SYNTAX was returned
+ * @return 0 on success, error code otherwise
+ *
+ * @see uriParseSingleUriExA
+ * @see uriParseSingleUriExMmA
+ * @see uriToStringA
+ * @since 0.9.0
+ */
URI_PUBLIC int URI_FUNC(ParseSingleUri)(URI_TYPE(Uri) * uri,
const URI_CHAR * text, const URI_CHAR ** errorPos);
-
-
-
-/**
- * Parses a single RFC 3986 %URI.
- * Uses default libc-based memory manager.
- *
- * @param uri <b>OUT</b>: Output %URI, must not be NULL
- * @param first <b>IN</b>: Pointer to the first character to parse,
- * must not be NULL
- * @param afterLast <b>IN</b>: Pointer to the character after the last to
- * parse, can be NULL
- * (to use first + strlen(first))
- * @param errorPos <b>OUT</b>: Pointer to a pointer to the first character
- * causing a syntax error, can be NULL;
- * only set when URI_ERROR_SYNTAX was returned
- * @return 0 on success, error code otherwise
- *
- * @see uriParseSingleUriA
- * @see uriParseSingleUriExMmA
- * @see uriToStringA
- * @since 0.9.0
- */
+
+
+
+/**
+ * Parses a single RFC 3986 %URI.
+ * Uses default libc-based memory manager.
+ *
+ * @param uri <b>OUT</b>: Output %URI, must not be NULL
+ * @param first <b>IN</b>: Pointer to the first character to parse,
+ * must not be NULL
+ * @param afterLast <b>IN</b>: Pointer to the character after the last to
+ * parse, can be NULL
+ * (to use first + strlen(first))
+ * @param errorPos <b>OUT</b>: Pointer to a pointer to the first character
+ * causing a syntax error, can be NULL;
+ * only set when URI_ERROR_SYNTAX was returned
+ * @return 0 on success, error code otherwise
+ *
+ * @see uriParseSingleUriA
+ * @see uriParseSingleUriExMmA
+ * @see uriToStringA
+ * @since 0.9.0
+ */
URI_PUBLIC int URI_FUNC(ParseSingleUriEx)(URI_TYPE(Uri) * uri,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- const URI_CHAR ** errorPos);
-
-
-
-/**
- * Parses a single RFC 3986 %URI.
- *
- * @param uri <b>OUT</b>: Output %URI, must not be NULL
- * @param first <b>IN</b>: Pointer to the first character to parse,
- * must not be NULL
- * @param afterLast <b>IN</b>: Pointer to the character after the last to
- * parse, can be NULL
- * (to use first + strlen(first))
- * @param errorPos <b>OUT</b>: Pointer to a pointer to the first character
- * causing a syntax error, can be NULL;
- * only set when URI_ERROR_SYNTAX was returned
- * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
- * @return 0 on success, error code otherwise
- *
- * @see uriParseSingleUriA
- * @see uriParseSingleUriExA
- * @see uriToStringA
- * @since 0.9.0
- */
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ const URI_CHAR ** errorPos);
+
+
+
+/**
+ * Parses a single RFC 3986 %URI.
+ *
+ * @param uri <b>OUT</b>: Output %URI, must not be NULL
+ * @param first <b>IN</b>: Pointer to the first character to parse,
+ * must not be NULL
+ * @param afterLast <b>IN</b>: Pointer to the character after the last to
+ * parse, can be NULL
+ * (to use first + strlen(first))
+ * @param errorPos <b>OUT</b>: Pointer to a pointer to the first character
+ * causing a syntax error, can be NULL;
+ * only set when URI_ERROR_SYNTAX was returned
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return 0 on success, error code otherwise
+ *
+ * @see uriParseSingleUriA
+ * @see uriParseSingleUriExA
+ * @see uriToStringA
+ * @since 0.9.0
+ */
URI_PUBLIC int URI_FUNC(ParseSingleUriExMm)(URI_TYPE(Uri) * uri,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- const URI_CHAR ** errorPos, UriMemoryManager * memory);
-
-
-
-/**
- * Frees all memory associated with the members
- * of the %URI structure. Note that the structure
- * itself is not freed, only its members.
- * Uses default libc-based memory manager.
- *
- * @param uri <b>INOUT</b>: %URI structure whose members should be freed
- *
- * @see uriFreeUriMembersMmA
- * @since 0.3.0
- */
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ const URI_CHAR ** errorPos, UriMemoryManager * memory);
+
+
+
+/**
+ * Frees all memory associated with the members
+ * of the %URI structure. Note that the structure
+ * itself is not freed, only its members.
+ * Uses default libc-based memory manager.
+ *
+ * @param uri <b>INOUT</b>: %URI structure whose members should be freed
+ *
+ * @see uriFreeUriMembersMmA
+ * @since 0.3.0
+ */
URI_PUBLIC void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri);
-
-
-
-/**
- * Frees all memory associated with the members
- * of the %URI structure. Note that the structure
- * itself is not freed, only its members.
- *
- * @param uri <b>INOUT</b>: %URI structure whose members should be freed
- * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
- * @return 0 on success, error code otherwise
- *
- * @see uriFreeUriMembersA
- * @since 0.9.0
- */
+
+
+
+/**
+ * Frees all memory associated with the members
+ * of the %URI structure. Note that the structure
+ * itself is not freed, only its members.
+ *
+ * @param uri <b>INOUT</b>: %URI structure whose members should be freed
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return 0 on success, error code otherwise
+ *
+ * @see uriFreeUriMembersA
+ * @since 0.9.0
+ */
URI_PUBLIC int URI_FUNC(FreeUriMembersMm)(URI_TYPE(Uri) * uri,
- UriMemoryManager * memory);
-
-
-
-/**
- * Percent-encodes all unreserved characters from the input string and
- * writes the encoded version to the output string.
- * Be sure to allocate <b>3 times</b> the space of the input buffer for
- * the output buffer for <c>normalizeBreaks == URI_FALSE</c> and <b>6 times</b>
- * the space for <c>normalizeBreaks == URI_TRUE</c>
- * (since e.g. "\x0d" becomes "%0D%0A" in that case)
- *
- * @param inFirst <b>IN</b>: Pointer to first character of the input text
- * @param inAfterLast <b>IN</b>: Pointer after the last character of the input text
- * @param out <b>OUT</b>: Encoded text destination
- * @param spaceToPlus <b>IN</b>: Whether to convert ' ' to '+' or not
- * @param normalizeBreaks <b>IN</b>: Whether to convert CR and LF to CR-LF or not.
- * @return Position of terminator in output string
- *
- * @see uriEscapeA
- * @see uriUnescapeInPlaceExA
- * @since 0.5.2
- */
+ UriMemoryManager * memory);
+
+
+
+/**
+ * Percent-encodes all unreserved characters from the input string and
+ * writes the encoded version to the output string.
+ * Be sure to allocate <b>3 times</b> the space of the input buffer for
+ * the output buffer for <c>normalizeBreaks == URI_FALSE</c> and <b>6 times</b>
+ * the space for <c>normalizeBreaks == URI_TRUE</c>
+ * (since e.g. "\x0d" becomes "%0D%0A" in that case)
+ *
+ * @param inFirst <b>IN</b>: Pointer to first character of the input text
+ * @param inAfterLast <b>IN</b>: Pointer after the last character of the input text
+ * @param out <b>OUT</b>: Encoded text destination
+ * @param spaceToPlus <b>IN</b>: Whether to convert ' ' to '+' or not
+ * @param normalizeBreaks <b>IN</b>: Whether to convert CR and LF to CR-LF or not.
+ * @return Position of terminator in output string
+ *
+ * @see uriEscapeA
+ * @see uriUnescapeInPlaceExA
+ * @since 0.5.2
+ */
URI_PUBLIC URI_CHAR * URI_FUNC(EscapeEx)(const URI_CHAR * inFirst,
- const URI_CHAR * inAfterLast, URI_CHAR * out,
- UriBool spaceToPlus, UriBool normalizeBreaks);
-
-
-
-/**
- * Percent-encodes all unreserved characters from the input string and
- * writes the encoded version to the output string.
- * Be sure to allocate <b>3 times</b> the space of the input buffer for
- * the output buffer for <c>normalizeBreaks == URI_FALSE</c> and <b>6 times</b>
- * the space for <c>normalizeBreaks == URI_TRUE</c>
- * (since e.g. "\x0d" becomes "%0D%0A" in that case)
- *
- * @param in <b>IN</b>: Text source
- * @param out <b>OUT</b>: Encoded text destination
- * @param spaceToPlus <b>IN</b>: Whether to convert ' ' to '+' or not
- * @param normalizeBreaks <b>IN</b>: Whether to convert CR and LF to CR-LF or not.
- * @return Position of terminator in output string
- *
- * @see uriEscapeExA
- * @see uriUnescapeInPlaceA
- * @since 0.5.0
- */
+ const URI_CHAR * inAfterLast, URI_CHAR * out,
+ UriBool spaceToPlus, UriBool normalizeBreaks);
+
+
+
+/**
+ * Percent-encodes all unreserved characters from the input string and
+ * writes the encoded version to the output string.
+ * Be sure to allocate <b>3 times</b> the space of the input buffer for
+ * the output buffer for <c>normalizeBreaks == URI_FALSE</c> and <b>6 times</b>
+ * the space for <c>normalizeBreaks == URI_TRUE</c>
+ * (since e.g. "\x0d" becomes "%0D%0A" in that case)
+ *
+ * @param in <b>IN</b>: Text source
+ * @param out <b>OUT</b>: Encoded text destination
+ * @param spaceToPlus <b>IN</b>: Whether to convert ' ' to '+' or not
+ * @param normalizeBreaks <b>IN</b>: Whether to convert CR and LF to CR-LF or not.
+ * @return Position of terminator in output string
+ *
+ * @see uriEscapeExA
+ * @see uriUnescapeInPlaceA
+ * @since 0.5.0
+ */
URI_PUBLIC URI_CHAR * URI_FUNC(Escape)(const URI_CHAR * in, URI_CHAR * out,
- UriBool spaceToPlus, UriBool normalizeBreaks);
-
-
-
-/**
- * Unescapes percent-encoded groups in a given string.
- * E.g. "%20" will become " ". Unescaping is done in place.
- * The return value will be point to the new position
- * of the terminating zero. Use this value to get the new
- * length of the string. NULL is only returned if <c>inout</c>
- * is NULL.
- *
- * @param inout <b>INOUT</b>: Text to unescape/decode
- * @param plusToSpace <b>IN</b>: Whether to convert '+' to ' ' or not
- * @param breakConversion <b>IN</b>: Line break conversion mode
- * @return Pointer to new position of the terminating zero
- *
- * @see uriUnescapeInPlaceA
- * @see uriEscapeExA
- * @since 0.5.0
- */
+ UriBool spaceToPlus, UriBool normalizeBreaks);
+
+
+
+/**
+ * Unescapes percent-encoded groups in a given string.
+ * E.g. "%20" will become " ". Unescaping is done in place.
+ * The return value will be point to the new position
+ * of the terminating zero. Use this value to get the new
+ * length of the string. NULL is only returned if <c>inout</c>
+ * is NULL.
+ *
+ * @param inout <b>INOUT</b>: Text to unescape/decode
+ * @param plusToSpace <b>IN</b>: Whether to convert '+' to ' ' or not
+ * @param breakConversion <b>IN</b>: Line break conversion mode
+ * @return Pointer to new position of the terminating zero
+ *
+ * @see uriUnescapeInPlaceA
+ * @see uriEscapeExA
+ * @since 0.5.0
+ */
URI_PUBLIC const URI_CHAR * URI_FUNC(UnescapeInPlaceEx)(URI_CHAR * inout,
- UriBool plusToSpace, UriBreakConversion breakConversion);
-
-
-
-/**
- * Unescapes percent-encoded groups in a given string.
- * E.g. "%20" will become " ". Unescaping is done in place.
- * The return value will be point to the new position
- * of the terminating zero. Use this value to get the new
- * length of the string. NULL is only returned if <c>inout</c>
- * is NULL.
- *
- * NOTE: '+' is not decoded to ' ' and line breaks are not converted.
- * Use the more advanced UnescapeInPlaceEx for that features instead.
- *
- * @param inout <b>INOUT</b>: Text to unescape/decode
- * @return Pointer to new position of the terminating zero
- *
- * @see uriUnescapeInPlaceExA
- * @see uriEscapeA
- * @since 0.3.0
- */
+ UriBool plusToSpace, UriBreakConversion breakConversion);
+
+
+
+/**
+ * Unescapes percent-encoded groups in a given string.
+ * E.g. "%20" will become " ". Unescaping is done in place.
+ * The return value will be point to the new position
+ * of the terminating zero. Use this value to get the new
+ * length of the string. NULL is only returned if <c>inout</c>
+ * is NULL.
+ *
+ * NOTE: '+' is not decoded to ' ' and line breaks are not converted.
+ * Use the more advanced UnescapeInPlaceEx for that features instead.
+ *
+ * @param inout <b>INOUT</b>: Text to unescape/decode
+ * @return Pointer to new position of the terminating zero
+ *
+ * @see uriUnescapeInPlaceExA
+ * @see uriEscapeA
+ * @since 0.3.0
+ */
URI_PUBLIC const URI_CHAR * URI_FUNC(UnescapeInPlace)(URI_CHAR * inout);
-
-
-
-/**
- * Performs reference resolution as described in
- * <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2 of RFC 3986</a>.
- * Uses default libc-based memory manager.
- * NOTE: On success you have to call uriFreeUriMembersA on \p absoluteDest manually later.
- *
- * @param absoluteDest <b>OUT</b>: Result %URI
- * @param relativeSource <b>IN</b>: Reference to resolve
- * @param absoluteBase <b>IN</b>: Base %URI to apply
- * @return Error code or 0 on success
- *
- * @see uriRemoveBaseUriA
- * @see uriRemoveBaseUriMmA
- * @see uriAddBaseUriExA
- * @see uriAddBaseUriExMmA
- * @since 0.4.0
- */
+
+
+
+/**
+ * Performs reference resolution as described in
+ * <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2 of RFC 3986</a>.
+ * Uses default libc-based memory manager.
+ * NOTE: On success you have to call uriFreeUriMembersA on \p absoluteDest manually later.
+ *
+ * @param absoluteDest <b>OUT</b>: Result %URI
+ * @param relativeSource <b>IN</b>: Reference to resolve
+ * @param absoluteBase <b>IN</b>: Base %URI to apply
+ * @return Error code or 0 on success
+ *
+ * @see uriRemoveBaseUriA
+ * @see uriRemoveBaseUriMmA
+ * @see uriAddBaseUriExA
+ * @see uriAddBaseUriExMmA
+ * @since 0.4.0
+ */
URI_PUBLIC int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absoluteDest,
- const URI_TYPE(Uri) * relativeSource,
- const URI_TYPE(Uri) * absoluteBase);
-
-
-
-/**
- * Performs reference resolution as described in
- * <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2 of RFC 3986</a>.
- * Uses default libc-based memory manager.
- * NOTE: On success you have to call uriFreeUriMembersA on \p absoluteDest manually later.
- *
- * @param absoluteDest <b>OUT</b>: Result %URI
- * @param relativeSource <b>IN</b>: Reference to resolve
- * @param absoluteBase <b>IN</b>: Base %URI to apply
- * @param options <b>IN</b>: Configuration to apply
- * @return Error code or 0 on success
- *
- * @see uriRemoveBaseUriA
- * @see uriAddBaseUriA
- * @see uriAddBaseUriExMmA
- * @since 0.8.1
- */
+ const URI_TYPE(Uri) * relativeSource,
+ const URI_TYPE(Uri) * absoluteBase);
+
+
+
+/**
+ * Performs reference resolution as described in
+ * <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2 of RFC 3986</a>.
+ * Uses default libc-based memory manager.
+ * NOTE: On success you have to call uriFreeUriMembersA on \p absoluteDest manually later.
+ *
+ * @param absoluteDest <b>OUT</b>: Result %URI
+ * @param relativeSource <b>IN</b>: Reference to resolve
+ * @param absoluteBase <b>IN</b>: Base %URI to apply
+ * @param options <b>IN</b>: Configuration to apply
+ * @return Error code or 0 on success
+ *
+ * @see uriRemoveBaseUriA
+ * @see uriAddBaseUriA
+ * @see uriAddBaseUriExMmA
+ * @since 0.8.1
+ */
URI_PUBLIC int URI_FUNC(AddBaseUriEx)(URI_TYPE(Uri) * absoluteDest,
- const URI_TYPE(Uri) * relativeSource,
- const URI_TYPE(Uri) * absoluteBase,
- UriResolutionOptions options);
-
-
-
-/**
- * Performs reference resolution as described in
- * <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2 of RFC 3986</a>.
- * NOTE: On success you have to call uriFreeUriMembersMmA on \p absoluteDest manually later.
- *
- * @param absoluteDest <b>OUT</b>: Result %URI
- * @param relativeSource <b>IN</b>: Reference to resolve
- * @param absoluteBase <b>IN</b>: Base %URI to apply
- * @param options <b>IN</b>: Configuration to apply
- * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
- * @return Error code or 0 on success
- *
- * @see uriRemoveBaseUriA
- * @see uriRemoveBaseUriMmA
- * @see uriAddBaseUriA
- * @see uriAddBaseUriExA
- * @since 0.9.0
- */
+ const URI_TYPE(Uri) * relativeSource,
+ const URI_TYPE(Uri) * absoluteBase,
+ UriResolutionOptions options);
+
+
+
+/**
+ * Performs reference resolution as described in
+ * <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2 of RFC 3986</a>.
+ * NOTE: On success you have to call uriFreeUriMembersMmA on \p absoluteDest manually later.
+ *
+ * @param absoluteDest <b>OUT</b>: Result %URI
+ * @param relativeSource <b>IN</b>: Reference to resolve
+ * @param absoluteBase <b>IN</b>: Base %URI to apply
+ * @param options <b>IN</b>: Configuration to apply
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return Error code or 0 on success
+ *
+ * @see uriRemoveBaseUriA
+ * @see uriRemoveBaseUriMmA
+ * @see uriAddBaseUriA
+ * @see uriAddBaseUriExA
+ * @since 0.9.0
+ */
URI_PUBLIC int URI_FUNC(AddBaseUriExMm)(URI_TYPE(Uri) * absoluteDest,
- const URI_TYPE(Uri) * relativeSource,
- const URI_TYPE(Uri) * absoluteBase,
- UriResolutionOptions options, UriMemoryManager * memory);
-
-
-
-/**
- * Tries to make a relative %URI (a reference) from an
- * absolute %URI and a given base %URI. The resulting %URI is going to be
- * relative if the absolute %URI and base %UI share both scheme and authority.
- * If that is not the case, the result will still be
- * an absolute URI (with scheme part if necessary).
- * Uses default libc-based memory manager.
- * NOTE: On success you have to call uriFreeUriMembersA on
- * \p dest manually later.
- *
- * @param dest <b>OUT</b>: Result %URI
- * @param absoluteSource <b>IN</b>: Absolute %URI to make relative
- * @param absoluteBase <b>IN</b>: Base %URI
- * @param domainRootMode <b>IN</b>: Create %URI with path relative to domain root
- * @return Error code or 0 on success
- *
- * @see uriRemoveBaseUriMmA
- * @see uriAddBaseUriA
- * @see uriAddBaseUriExA
- * @see uriAddBaseUriExMmA
- * @since 0.5.2
- */
+ const URI_TYPE(Uri) * relativeSource,
+ const URI_TYPE(Uri) * absoluteBase,
+ UriResolutionOptions options, UriMemoryManager * memory);
+
+
+
+/**
+ * Tries to make a relative %URI (a reference) from an
+ * absolute %URI and a given base %URI. The resulting %URI is going to be
+ * relative if the absolute %URI and base %UI share both scheme and authority.
+ * If that is not the case, the result will still be
+ * an absolute URI (with scheme part if necessary).
+ * Uses default libc-based memory manager.
+ * NOTE: On success you have to call uriFreeUriMembersA on
+ * \p dest manually later.
+ *
+ * @param dest <b>OUT</b>: Result %URI
+ * @param absoluteSource <b>IN</b>: Absolute %URI to make relative
+ * @param absoluteBase <b>IN</b>: Base %URI
+ * @param domainRootMode <b>IN</b>: Create %URI with path relative to domain root
+ * @return Error code or 0 on success
+ *
+ * @see uriRemoveBaseUriMmA
+ * @see uriAddBaseUriA
+ * @see uriAddBaseUriExA
+ * @see uriAddBaseUriExMmA
+ * @since 0.5.2
+ */
URI_PUBLIC int URI_FUNC(RemoveBaseUri)(URI_TYPE(Uri) * dest,
- const URI_TYPE(Uri) * absoluteSource,
- const URI_TYPE(Uri) * absoluteBase,
- UriBool domainRootMode);
-
-
-
-/**
- * Tries to make a relative %URI (a reference) from an
- * absolute %URI and a given base %URI. The resulting %URI is going to be
- * relative if the absolute %URI and base %UI share both scheme and authority.
- * If that is not the case, the result will still be
- * an absolute URI (with scheme part if necessary).
- * NOTE: On success you have to call uriFreeUriMembersMmA on
- * \p dest manually later.
- *
- * @param dest <b>OUT</b>: Result %URI
- * @param absoluteSource <b>IN</b>: Absolute %URI to make relative
- * @param absoluteBase <b>IN</b>: Base %URI
- * @param domainRootMode <b>IN</b>: Create %URI with path relative to domain root
- * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
- * @return Error code or 0 on success
- *
- * @see uriRemoveBaseUriA
- * @see uriAddBaseUriA
- * @see uriAddBaseUriExA
- * @see uriAddBaseUriExMmA
- * @since 0.9.0
- */
+ const URI_TYPE(Uri) * absoluteSource,
+ const URI_TYPE(Uri) * absoluteBase,
+ UriBool domainRootMode);
+
+
+
+/**
+ * Tries to make a relative %URI (a reference) from an
+ * absolute %URI and a given base %URI. The resulting %URI is going to be
+ * relative if the absolute %URI and base %UI share both scheme and authority.
+ * If that is not the case, the result will still be
+ * an absolute URI (with scheme part if necessary).
+ * NOTE: On success you have to call uriFreeUriMembersMmA on
+ * \p dest manually later.
+ *
+ * @param dest <b>OUT</b>: Result %URI
+ * @param absoluteSource <b>IN</b>: Absolute %URI to make relative
+ * @param absoluteBase <b>IN</b>: Base %URI
+ * @param domainRootMode <b>IN</b>: Create %URI with path relative to domain root
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return Error code or 0 on success
+ *
+ * @see uriRemoveBaseUriA
+ * @see uriAddBaseUriA
+ * @see uriAddBaseUriExA
+ * @see uriAddBaseUriExMmA
+ * @since 0.9.0
+ */
URI_PUBLIC int URI_FUNC(RemoveBaseUriMm)(URI_TYPE(Uri) * dest,
- const URI_TYPE(Uri) * absoluteSource,
- const URI_TYPE(Uri) * absoluteBase,
- UriBool domainRootMode, UriMemoryManager * memory);
-
-
-
-/**
- * Checks two URIs for equivalence. Comparison is done
- * the naive way, without prior normalization.
- * NOTE: Two <c>NULL</c> URIs are equal as well.
- *
- * @param a <b>IN</b>: First %URI
- * @param b <b>IN</b>: Second %URI
- * @return <c>URI_TRUE</c> when equal, <c>URI_FAlSE</c> else
- *
- * @since 0.4.0
- */
+ const URI_TYPE(Uri) * absoluteSource,
+ const URI_TYPE(Uri) * absoluteBase,
+ UriBool domainRootMode, UriMemoryManager * memory);
+
+
+
+/**
+ * Checks two URIs for equivalence. Comparison is done
+ * the naive way, without prior normalization.
+ * NOTE: Two <c>NULL</c> URIs are equal as well.
+ *
+ * @param a <b>IN</b>: First %URI
+ * @param b <b>IN</b>: Second %URI
+ * @return <c>URI_TRUE</c> when equal, <c>URI_FAlSE</c> else
+ *
+ * @since 0.4.0
+ */
URI_PUBLIC UriBool URI_FUNC(EqualsUri)(const URI_TYPE(Uri) * a,
const URI_TYPE(Uri) * b);
-
-
-
-/**
- * Calculates the number of characters needed to store the
- * string representation of the given %URI excluding the
- * terminator.
- *
- * @param uri <b>IN</b>: %URI to measure
- * @param charsRequired <b>OUT</b>: Length of the string representation in characters <b>excluding</b> terminator
- * @return Error code or 0 on success
- *
- * @see uriToStringA
- * @since 0.5.0
- */
+
+
+
+/**
+ * Calculates the number of characters needed to store the
+ * string representation of the given %URI excluding the
+ * terminator.
+ *
+ * @param uri <b>IN</b>: %URI to measure
+ * @param charsRequired <b>OUT</b>: Length of the string representation in characters <b>excluding</b> terminator
+ * @return Error code or 0 on success
+ *
+ * @see uriToStringA
+ * @since 0.5.0
+ */
URI_PUBLIC int URI_FUNC(ToStringCharsRequired)(const URI_TYPE(Uri) * uri,
- int * charsRequired);
-
-
-
-/**
- * Converts a %URI structure back to text as described in
- * <a href="http://tools.ietf.org/html/rfc3986#section-5.3">section 5.3 of RFC 3986</a>.
- *
- * @param dest <b>OUT</b>: Output destination
- * @param uri <b>IN</b>: %URI to convert
- * @param maxChars <b>IN</b>: Maximum number of characters to copy <b>including</b> terminator
- * @param charsWritten <b>OUT</b>: Number of characters written, can be lower than maxChars even if the %URI is too long!
- * @return Error code or 0 on success
- *
- * @see uriToStringCharsRequiredA
- * @since 0.4.0
- */
+ int * charsRequired);
+
+
+
+/**
+ * Converts a %URI structure back to text as described in
+ * <a href="http://tools.ietf.org/html/rfc3986#section-5.3">section 5.3 of RFC 3986</a>.
+ *
+ * @param dest <b>OUT</b>: Output destination
+ * @param uri <b>IN</b>: %URI to convert
+ * @param maxChars <b>IN</b>: Maximum number of characters to copy <b>including</b> terminator
+ * @param charsWritten <b>OUT</b>: Number of characters written, can be lower than maxChars even if the %URI is too long!
+ * @return Error code or 0 on success
+ *
+ * @see uriToStringCharsRequiredA
+ * @since 0.4.0
+ */
URI_PUBLIC int URI_FUNC(ToString)(URI_CHAR * dest, const URI_TYPE(Uri) * uri,
int maxChars, int * charsWritten);
-
-
-
-/**
- * Determines the components of a %URI that are not normalized.
- *
- * @param uri <b>IN</b>: %URI to check
- * @return Normalization job mask
- *
- * @see uriNormalizeSyntaxA
- * @see uriNormalizeSyntaxExA
- * @see uriNormalizeSyntaxExMmA
- * @see uriNormalizeSyntaxMaskRequiredExA
- * @since 0.5.0
- * @deprecated Deprecated since 0.9.0, please migrate to uriNormalizeSyntaxMaskRequiredExA (with "Ex").
- */
+
+
+
+/**
+ * Determines the components of a %URI that are not normalized.
+ *
+ * @param uri <b>IN</b>: %URI to check
+ * @return Normalization job mask
+ *
+ * @see uriNormalizeSyntaxA
+ * @see uriNormalizeSyntaxExA
+ * @see uriNormalizeSyntaxExMmA
+ * @see uriNormalizeSyntaxMaskRequiredExA
+ * @since 0.5.0
+ * @deprecated Deprecated since 0.9.0, please migrate to uriNormalizeSyntaxMaskRequiredExA (with "Ex").
+ */
URI_PUBLIC unsigned int URI_FUNC(NormalizeSyntaxMaskRequired)(
const URI_TYPE(Uri) * uri);
-
-
-
-/**
- * Determines the components of a %URI that are not normalized.
- *
- * @param uri <b>IN</b>: %URI to check
- * @param outMask <b>OUT</b>: Normalization job mask
- * @return Error code or 0 on success
- *
- * @see uriNormalizeSyntaxA
- * @see uriNormalizeSyntaxExA
- * @see uriNormalizeSyntaxExMmA
- * @see uriNormalizeSyntaxMaskRequiredA
- * @since 0.9.0
- */
+
+
+
+/**
+ * Determines the components of a %URI that are not normalized.
+ *
+ * @param uri <b>IN</b>: %URI to check
+ * @param outMask <b>OUT</b>: Normalization job mask
+ * @return Error code or 0 on success
+ *
+ * @see uriNormalizeSyntaxA
+ * @see uriNormalizeSyntaxExA
+ * @see uriNormalizeSyntaxExMmA
+ * @see uriNormalizeSyntaxMaskRequiredA
+ * @since 0.9.0
+ */
URI_PUBLIC int URI_FUNC(NormalizeSyntaxMaskRequiredEx)(
const URI_TYPE(Uri) * uri, unsigned int * outMask);
-
-
-
-/**
- * Normalizes a %URI using a normalization mask.
- * The normalization mask decides what components are normalized.
- *
- * NOTE: If necessary the %URI becomes owner of all memory
- * behind the text pointed to. Text is duplicated in that case.
- * Uses default libc-based memory manager.
- *
- * @param uri <b>INOUT</b>: %URI to normalize
- * @param mask <b>IN</b>: Normalization mask
- * @return Error code or 0 on success
- *
- * @see uriNormalizeSyntaxA
- * @see uriNormalizeSyntaxExMmA
- * @see uriNormalizeSyntaxMaskRequiredA
- * @since 0.5.0
- */
+
+
+
+/**
+ * Normalizes a %URI using a normalization mask.
+ * The normalization mask decides what components are normalized.
+ *
+ * NOTE: If necessary the %URI becomes owner of all memory
+ * behind the text pointed to. Text is duplicated in that case.
+ * Uses default libc-based memory manager.
+ *
+ * @param uri <b>INOUT</b>: %URI to normalize
+ * @param mask <b>IN</b>: Normalization mask
+ * @return Error code or 0 on success
+ *
+ * @see uriNormalizeSyntaxA
+ * @see uriNormalizeSyntaxExMmA
+ * @see uriNormalizeSyntaxMaskRequiredA
+ * @since 0.5.0
+ */
URI_PUBLIC int URI_FUNC(NormalizeSyntaxEx)(URI_TYPE(Uri) * uri,
unsigned int mask);
-
-
-
-/**
- * Normalizes a %URI using a normalization mask.
- * The normalization mask decides what components are normalized.
- *
- * NOTE: If necessary the %URI becomes owner of all memory
- * behind the text pointed to. Text is duplicated in that case.
- *
- * @param uri <b>INOUT</b>: %URI to normalize
- * @param mask <b>IN</b>: Normalization mask
- * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
- * @return Error code or 0 on success
- *
- * @see uriNormalizeSyntaxA
- * @see uriNormalizeSyntaxExA
- * @see uriNormalizeSyntaxMaskRequiredA
- * @since 0.9.0
- */
+
+
+
+/**
+ * Normalizes a %URI using a normalization mask.
+ * The normalization mask decides what components are normalized.
+ *
+ * NOTE: If necessary the %URI becomes owner of all memory
+ * behind the text pointed to. Text is duplicated in that case.
+ *
+ * @param uri <b>INOUT</b>: %URI to normalize
+ * @param mask <b>IN</b>: Normalization mask
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return Error code or 0 on success
+ *
+ * @see uriNormalizeSyntaxA
+ * @see uriNormalizeSyntaxExA
+ * @see uriNormalizeSyntaxMaskRequiredA
+ * @since 0.9.0
+ */
URI_PUBLIC int URI_FUNC(NormalizeSyntaxExMm)(URI_TYPE(Uri) * uri,
unsigned int mask, UriMemoryManager * memory);
-
-
-
-/**
- * Normalizes all components of a %URI.
- *
- * NOTE: If necessary the %URI becomes owner of all memory
- * behind the text pointed to. Text is duplicated in that case.
- * Uses default libc-based memory manager.
- *
- * @param uri <b>INOUT</b>: %URI to normalize
- * @return Error code or 0 on success
- *
- * @see uriNormalizeSyntaxExA
- * @see uriNormalizeSyntaxExMmA
- * @see uriNormalizeSyntaxMaskRequiredA
- * @since 0.5.0
- */
+
+
+
+/**
+ * Normalizes all components of a %URI.
+ *
+ * NOTE: If necessary the %URI becomes owner of all memory
+ * behind the text pointed to. Text is duplicated in that case.
+ * Uses default libc-based memory manager.
+ *
+ * @param uri <b>INOUT</b>: %URI to normalize
+ * @return Error code or 0 on success
+ *
+ * @see uriNormalizeSyntaxExA
+ * @see uriNormalizeSyntaxExMmA
+ * @see uriNormalizeSyntaxMaskRequiredA
+ * @since 0.5.0
+ */
URI_PUBLIC int URI_FUNC(NormalizeSyntax)(URI_TYPE(Uri) * uri);
-
-
-
-/**
- * Converts a Unix filename to a %URI string.
- * The destination buffer must be large enough to hold 7 + 3 * len(filename) + 1
- * characters in case of an absolute filename or 3 * len(filename) + 1 in case
- * of a relative filename.
- *
- * EXAMPLE
- * Input: "/bin/bash"
- * Output: "file:///bin/bash"
- *
- * @param filename <b>IN</b>: Unix filename to convert
- * @param uriString <b>OUT</b>: Destination to write %URI string to
- * @return Error code or 0 on success
- *
- * @see uriUriStringToUnixFilenameA
- * @see uriWindowsFilenameToUriStringA
- * @since 0.5.2
- */
+
+
+
+/**
+ * Converts a Unix filename to a %URI string.
+ * The destination buffer must be large enough to hold 7 + 3 * len(filename) + 1
+ * characters in case of an absolute filename or 3 * len(filename) + 1 in case
+ * of a relative filename.
+ *
+ * EXAMPLE
+ * Input: "/bin/bash"
+ * Output: "file:///bin/bash"
+ *
+ * @param filename <b>IN</b>: Unix filename to convert
+ * @param uriString <b>OUT</b>: Destination to write %URI string to
+ * @return Error code or 0 on success
+ *
+ * @see uriUriStringToUnixFilenameA
+ * @see uriWindowsFilenameToUriStringA
+ * @since 0.5.2
+ */
URI_PUBLIC int URI_FUNC(UnixFilenameToUriString)(const URI_CHAR * filename,
- URI_CHAR * uriString);
-
-
-
-/**
- * Converts a Windows filename to a %URI string.
- * The destination buffer must be large enough to hold 8 + 3 * len(filename) + 1
- * characters in case of an absolute filename or 3 * len(filename) + 1 in case
- * of a relative filename.
- *
- * EXAMPLE
- * Input: "E:\\Documents and Settings"
- * Output: "file:///E:/Documents%20and%20Settings"
- *
- * @param filename <b>IN</b>: Windows filename to convert
- * @param uriString <b>OUT</b>: Destination to write %URI string to
- * @return Error code or 0 on success
- *
- * @see uriUriStringToWindowsFilenameA
- * @see uriUnixFilenameToUriStringA
- * @since 0.5.2
- */
+ URI_CHAR * uriString);
+
+
+
+/**
+ * Converts a Windows filename to a %URI string.
+ * The destination buffer must be large enough to hold 8 + 3 * len(filename) + 1
+ * characters in case of an absolute filename or 3 * len(filename) + 1 in case
+ * of a relative filename.
+ *
+ * EXAMPLE
+ * Input: "E:\\Documents and Settings"
+ * Output: "file:///E:/Documents%20and%20Settings"
+ *
+ * @param filename <b>IN</b>: Windows filename to convert
+ * @param uriString <b>OUT</b>: Destination to write %URI string to
+ * @return Error code or 0 on success
+ *
+ * @see uriUriStringToWindowsFilenameA
+ * @see uriUnixFilenameToUriStringA
+ * @since 0.5.2
+ */
URI_PUBLIC int URI_FUNC(WindowsFilenameToUriString)(const URI_CHAR * filename,
- URI_CHAR * uriString);
-
-
-
-/**
- * Extracts a Unix filename from a %URI string.
+ URI_CHAR * uriString);
+
+
+
+/**
+ * Extracts a Unix filename from a %URI string.
* The destination buffer must be large enough to hold len(uriString) + 1 - 5
- * characters in case of an absolute %URI or len(uriString) + 1 in case
- * of a relative %URI.
- *
- * @param uriString <b>IN</b>: %URI string to convert
- * @param filename <b>OUT</b>: Destination to write filename to
- * @return Error code or 0 on success
- *
- * @see uriUnixFilenameToUriStringA
- * @see uriUriStringToWindowsFilenameA
- * @since 0.5.2
- */
+ * characters in case of an absolute %URI or len(uriString) + 1 in case
+ * of a relative %URI.
+ *
+ * @param uriString <b>IN</b>: %URI string to convert
+ * @param filename <b>OUT</b>: Destination to write filename to
+ * @return Error code or 0 on success
+ *
+ * @see uriUnixFilenameToUriStringA
+ * @see uriUriStringToWindowsFilenameA
+ * @since 0.5.2
+ */
URI_PUBLIC int URI_FUNC(UriStringToUnixFilename)(const URI_CHAR * uriString,
- URI_CHAR * filename);
-
-
-
-/**
- * Extracts a Windows filename from a %URI string.
- * The destination buffer must be large enough to hold len(uriString) + 1 - 5
- * characters in case of an absolute %URI or len(uriString) + 1 in case
- * of a relative %URI.
- *
- * @param uriString <b>IN</b>: %URI string to convert
- * @param filename <b>OUT</b>: Destination to write filename to
- * @return Error code or 0 on success
- *
- * @see uriWindowsFilenameToUriStringA
- * @see uriUriStringToUnixFilenameA
- * @since 0.5.2
- */
+ URI_CHAR * filename);
+
+
+
+/**
+ * Extracts a Windows filename from a %URI string.
+ * The destination buffer must be large enough to hold len(uriString) + 1 - 5
+ * characters in case of an absolute %URI or len(uriString) + 1 in case
+ * of a relative %URI.
+ *
+ * @param uriString <b>IN</b>: %URI string to convert
+ * @param filename <b>OUT</b>: Destination to write filename to
+ * @return Error code or 0 on success
+ *
+ * @see uriWindowsFilenameToUriStringA
+ * @see uriUriStringToUnixFilenameA
+ * @since 0.5.2
+ */
URI_PUBLIC int URI_FUNC(UriStringToWindowsFilename)(const URI_CHAR * uriString,
- URI_CHAR * filename);
-
-
-
-/**
- * Calculates the number of characters needed to store the
- * string representation of the given query list excluding the
- * terminator. It is assumed that line breaks are will be
- * normalized to "%0D%0A".
- *
- * @param queryList <b>IN</b>: Query list to measure
- * @param charsRequired <b>OUT</b>: Length of the string representation in characters <b>excluding</b> terminator
- * @return Error code or 0 on success
- *
- * @see uriComposeQueryCharsRequiredExA
- * @see uriComposeQueryA
- * @since 0.7.0
- */
+ URI_CHAR * filename);
+
+
+
+/**
+ * Calculates the number of characters needed to store the
+ * string representation of the given query list excluding the
+ * terminator. It is assumed that line breaks are will be
+ * normalized to "%0D%0A".
+ *
+ * @param queryList <b>IN</b>: Query list to measure
+ * @param charsRequired <b>OUT</b>: Length of the string representation in characters <b>excluding</b> terminator
+ * @return Error code or 0 on success
+ *
+ * @see uriComposeQueryCharsRequiredExA
+ * @see uriComposeQueryA
+ * @since 0.7.0
+ */
URI_PUBLIC int URI_FUNC(ComposeQueryCharsRequired)(
const URI_TYPE(QueryList) * queryList, int * charsRequired);
-
-
-
-/**
- * Calculates the number of characters needed to store the
- * string representation of the given query list excluding the
- * terminator.
- *
- * @param queryList <b>IN</b>: Query list to measure
- * @param charsRequired <b>OUT</b>: Length of the string representation in characters <b>excluding</b> terminator
- * @param spaceToPlus <b>IN</b>: Whether to convert ' ' to '+' or not
- * @param normalizeBreaks <b>IN</b>: Whether to convert CR and LF to CR-LF or not.
- * @return Error code or 0 on success
- *
- * @see uriComposeQueryCharsRequiredA
- * @see uriComposeQueryExA
- * @since 0.7.0
- */
+
+
+
+/**
+ * Calculates the number of characters needed to store the
+ * string representation of the given query list excluding the
+ * terminator.
+ *
+ * @param queryList <b>IN</b>: Query list to measure
+ * @param charsRequired <b>OUT</b>: Length of the string representation in characters <b>excluding</b> terminator
+ * @param spaceToPlus <b>IN</b>: Whether to convert ' ' to '+' or not
+ * @param normalizeBreaks <b>IN</b>: Whether to convert CR and LF to CR-LF or not.
+ * @return Error code or 0 on success
+ *
+ * @see uriComposeQueryCharsRequiredA
+ * @see uriComposeQueryExA
+ * @since 0.7.0
+ */
URI_PUBLIC int URI_FUNC(ComposeQueryCharsRequiredEx)(
const URI_TYPE(QueryList) * queryList,
- int * charsRequired, UriBool spaceToPlus, UriBool normalizeBreaks);
-
-
-
-/**
- * Converts a query list structure back to a query string.
- * The composed string does not start with '?',
- * on the way ' ' is converted to '+' and line breaks are
- * normalized to "%0D%0A".
- *
- * @param dest <b>OUT</b>: Output destination
- * @param queryList <b>IN</b>: Query list to convert
- * @param maxChars <b>IN</b>: Maximum number of characters to copy <b>including</b> terminator
- * @param charsWritten <b>OUT</b>: Number of characters written, can be lower than maxChars even if the query list is too long!
- * @return Error code or 0 on success
- *
- * @see uriComposeQueryExA
- * @see uriComposeQueryMallocA
- * @see uriComposeQueryMallocExA
- * @see uriComposeQueryMallocExMmA
- * @see uriComposeQueryCharsRequiredA
- * @see uriDissectQueryMallocA
- * @see uriDissectQueryMallocExA
- * @see uriDissectQueryMallocExMmA
- * @since 0.7.0
- */
+ int * charsRequired, UriBool spaceToPlus, UriBool normalizeBreaks);
+
+
+
+/**
+ * Converts a query list structure back to a query string.
+ * The composed string does not start with '?',
+ * on the way ' ' is converted to '+' and line breaks are
+ * normalized to "%0D%0A".
+ *
+ * @param dest <b>OUT</b>: Output destination
+ * @param queryList <b>IN</b>: Query list to convert
+ * @param maxChars <b>IN</b>: Maximum number of characters to copy <b>including</b> terminator
+ * @param charsWritten <b>OUT</b>: Number of characters written, can be lower than maxChars even if the query list is too long!
+ * @return Error code or 0 on success
+ *
+ * @see uriComposeQueryExA
+ * @see uriComposeQueryMallocA
+ * @see uriComposeQueryMallocExA
+ * @see uriComposeQueryMallocExMmA
+ * @see uriComposeQueryCharsRequiredA
+ * @see uriDissectQueryMallocA
+ * @see uriDissectQueryMallocExA
+ * @see uriDissectQueryMallocExMmA
+ * @since 0.7.0
+ */
URI_PUBLIC int URI_FUNC(ComposeQuery)(URI_CHAR * dest,
- const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten);
-
-
-
-/**
- * Converts a query list structure back to a query string.
- * The composed string does not start with '?'.
- *
- * @param dest <b>OUT</b>: Output destination
- * @param queryList <b>IN</b>: Query list to convert
- * @param maxChars <b>IN</b>: Maximum number of characters to copy <b>including</b> terminator
- * @param charsWritten <b>OUT</b>: Number of characters written, can be lower than maxChars even if the query list is too long!
- * @param spaceToPlus <b>IN</b>: Whether to convert ' ' to '+' or not
- * @param normalizeBreaks <b>IN</b>: Whether to convert CR and LF to CR-LF or not.
- * @return Error code or 0 on success
- *
- * @see uriComposeQueryA
- * @see uriComposeQueryMallocA
- * @see uriComposeQueryMallocExA
- * @see uriComposeQueryMallocExMmA
- * @see uriComposeQueryCharsRequiredExA
- * @see uriDissectQueryMallocA
- * @see uriDissectQueryMallocExA
- * @see uriDissectQueryMallocExMmA
- * @since 0.7.0
- */
+ const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten);
+
+
+
+/**
+ * Converts a query list structure back to a query string.
+ * The composed string does not start with '?'.
+ *
+ * @param dest <b>OUT</b>: Output destination
+ * @param queryList <b>IN</b>: Query list to convert
+ * @param maxChars <b>IN</b>: Maximum number of characters to copy <b>including</b> terminator
+ * @param charsWritten <b>OUT</b>: Number of characters written, can be lower than maxChars even if the query list is too long!
+ * @param spaceToPlus <b>IN</b>: Whether to convert ' ' to '+' or not
+ * @param normalizeBreaks <b>IN</b>: Whether to convert CR and LF to CR-LF or not.
+ * @return Error code or 0 on success
+ *
+ * @see uriComposeQueryA
+ * @see uriComposeQueryMallocA
+ * @see uriComposeQueryMallocExA
+ * @see uriComposeQueryMallocExMmA
+ * @see uriComposeQueryCharsRequiredExA
+ * @see uriDissectQueryMallocA
+ * @see uriDissectQueryMallocExA
+ * @see uriDissectQueryMallocExMmA
+ * @since 0.7.0
+ */
URI_PUBLIC int URI_FUNC(ComposeQueryEx)(URI_CHAR * dest,
- const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten,
- UriBool spaceToPlus, UriBool normalizeBreaks);
-
-
-
-/**
- * Converts a query list structure back to a query string.
- * Memory for this string is allocated internally.
- * The composed string does not start with '?',
- * on the way ' ' is converted to '+' and line breaks are
- * normalized to "%0D%0A".
- * Uses default libc-based memory manager.
- *
- * @param dest <b>OUT</b>: Output destination
- * @param queryList <b>IN</b>: Query list to convert
- * @return Error code or 0 on success
- *
- * @see uriComposeQueryMallocExA
- * @see uriComposeQueryMallocExMmA
- * @see uriComposeQueryA
- * @see uriDissectQueryMallocA
- * @see uriDissectQueryMallocExA
- * @see uriDissectQueryMallocExMmA
- * @since 0.7.0
- */
+ const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten,
+ UriBool spaceToPlus, UriBool normalizeBreaks);
+
+
+
+/**
+ * Converts a query list structure back to a query string.
+ * Memory for this string is allocated internally.
+ * The composed string does not start with '?',
+ * on the way ' ' is converted to '+' and line breaks are
+ * normalized to "%0D%0A".
+ * Uses default libc-based memory manager.
+ *
+ * @param dest <b>OUT</b>: Output destination
+ * @param queryList <b>IN</b>: Query list to convert
+ * @return Error code or 0 on success
+ *
+ * @see uriComposeQueryMallocExA
+ * @see uriComposeQueryMallocExMmA
+ * @see uriComposeQueryA
+ * @see uriDissectQueryMallocA
+ * @see uriDissectQueryMallocExA
+ * @see uriDissectQueryMallocExMmA
+ * @since 0.7.0
+ */
URI_PUBLIC int URI_FUNC(ComposeQueryMalloc)(URI_CHAR ** dest,
- const URI_TYPE(QueryList) * queryList);
-
-
-
-/**
- * Converts a query list structure back to a query string.
- * Memory for this string is allocated internally.
- * The composed string does not start with '?'.
- * Uses default libc-based memory manager.
- *
- * @param dest <b>OUT</b>: Output destination
- * @param queryList <b>IN</b>: Query list to convert
- * @param spaceToPlus <b>IN</b>: Whether to convert ' ' to '+' or not
- * @param normalizeBreaks <b>IN</b>: Whether to convert CR and LF to CR-LF or not.
- * @return Error code or 0 on success
- *
- * @see uriComposeQueryMallocA
- * @see uriComposeQueryMallocExMmA
- * @see uriComposeQueryExA
- * @see uriDissectQueryMallocA
- * @see uriDissectQueryMallocExA
- * @see uriDissectQueryMallocExMmA
- * @since 0.7.0
- */
+ const URI_TYPE(QueryList) * queryList);
+
+
+
+/**
+ * Converts a query list structure back to a query string.
+ * Memory for this string is allocated internally.
+ * The composed string does not start with '?'.
+ * Uses default libc-based memory manager.
+ *
+ * @param dest <b>OUT</b>: Output destination
+ * @param queryList <b>IN</b>: Query list to convert
+ * @param spaceToPlus <b>IN</b>: Whether to convert ' ' to '+' or not
+ * @param normalizeBreaks <b>IN</b>: Whether to convert CR and LF to CR-LF or not.
+ * @return Error code or 0 on success
+ *
+ * @see uriComposeQueryMallocA
+ * @see uriComposeQueryMallocExMmA
+ * @see uriComposeQueryExA
+ * @see uriDissectQueryMallocA
+ * @see uriDissectQueryMallocExA
+ * @see uriDissectQueryMallocExMmA
+ * @since 0.7.0
+ */
URI_PUBLIC int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest,
- const URI_TYPE(QueryList) * queryList,
- UriBool spaceToPlus, UriBool normalizeBreaks);
-
-
-
-/**
- * Converts a query list structure back to a query string.
- * Memory for this string is allocated internally.
- * The composed string does not start with '?'.
- *
- * @param dest <b>OUT</b>: Output destination
- * @param queryList <b>IN</b>: Query list to convert
- * @param spaceToPlus <b>IN</b>: Whether to convert ' ' to '+' or not
- * @param normalizeBreaks <b>IN</b>: Whether to convert CR and LF to CR-LF or not.
- * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
- * @return Error code or 0 on success
- *
- * @see uriComposeQueryMallocA
- * @see uriComposeQueryMallocExA
- * @see uriComposeQueryExA
- * @see uriDissectQueryMallocA
- * @see uriDissectQueryMallocExA
- * @see uriDissectQueryMallocExMmA
- * @since 0.9.0
- */
+ const URI_TYPE(QueryList) * queryList,
+ UriBool spaceToPlus, UriBool normalizeBreaks);
+
+
+
+/**
+ * Converts a query list structure back to a query string.
+ * Memory for this string is allocated internally.
+ * The composed string does not start with '?'.
+ *
+ * @param dest <b>OUT</b>: Output destination
+ * @param queryList <b>IN</b>: Query list to convert
+ * @param spaceToPlus <b>IN</b>: Whether to convert ' ' to '+' or not
+ * @param normalizeBreaks <b>IN</b>: Whether to convert CR and LF to CR-LF or not.
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return Error code or 0 on success
+ *
+ * @see uriComposeQueryMallocA
+ * @see uriComposeQueryMallocExA
+ * @see uriComposeQueryExA
+ * @see uriDissectQueryMallocA
+ * @see uriDissectQueryMallocExA
+ * @see uriDissectQueryMallocExMmA
+ * @since 0.9.0
+ */
URI_PUBLIC int URI_FUNC(ComposeQueryMallocExMm)(URI_CHAR ** dest,
- const URI_TYPE(QueryList) * queryList,
- UriBool spaceToPlus, UriBool normalizeBreaks,
- UriMemoryManager * memory);
-
-
-
-/**
- * Constructs a query list from the raw query string of a given URI.
- * On the way '+' is converted back to ' ', line breaks are not modified.
- * Uses default libc-based memory manager.
- *
- * @param dest <b>OUT</b>: Output destination
- * @param itemCount <b>OUT</b>: Number of items found, can be NULL
- * @param first <b>IN</b>: Pointer to first character <b>after</b> '?'
- * @param afterLast <b>IN</b>: Pointer to character after the last one still in
- * @return Error code or 0 on success
- *
- * @see uriDissectQueryMallocExA
- * @see uriDissectQueryMallocExMmA
- * @see uriComposeQueryA
- * @see uriFreeQueryListA
- * @see uriFreeQueryListMmA
- * @since 0.7.0
- */
+ const URI_TYPE(QueryList) * queryList,
+ UriBool spaceToPlus, UriBool normalizeBreaks,
+ UriMemoryManager * memory);
+
+
+
+/**
+ * Constructs a query list from the raw query string of a given URI.
+ * On the way '+' is converted back to ' ', line breaks are not modified.
+ * Uses default libc-based memory manager.
+ *
+ * @param dest <b>OUT</b>: Output destination
+ * @param itemCount <b>OUT</b>: Number of items found, can be NULL
+ * @param first <b>IN</b>: Pointer to first character <b>after</b> '?'
+ * @param afterLast <b>IN</b>: Pointer to character after the last one still in
+ * @return Error code or 0 on success
+ *
+ * @see uriDissectQueryMallocExA
+ * @see uriDissectQueryMallocExMmA
+ * @see uriComposeQueryA
+ * @see uriFreeQueryListA
+ * @see uriFreeQueryListMmA
+ * @since 0.7.0
+ */
URI_PUBLIC int URI_FUNC(DissectQueryMalloc)(URI_TYPE(QueryList) ** dest,
int * itemCount, const URI_CHAR * first, const URI_CHAR * afterLast);
-
-
-
-/**
- * Constructs a query list from the raw query string of a given URI.
- * Uses default libc-based memory manager.
- *
- * @param dest <b>OUT</b>: Output destination
- * @param itemCount <b>OUT</b>: Number of items found, can be NULL
- * @param first <b>IN</b>: Pointer to first character <b>after</b> '?'
- * @param afterLast <b>IN</b>: Pointer to character after the last one still in
- * @param plusToSpace <b>IN</b>: Whether to convert '+' to ' ' or not
- * @param breakConversion <b>IN</b>: Line break conversion mode
- * @return Error code or 0 on success
- *
- * @see uriDissectQueryMallocA
- * @see uriDissectQueryMallocExMmA
- * @see uriComposeQueryExA
- * @see uriFreeQueryListA
- * @since 0.7.0
- */
+
+
+
+/**
+ * Constructs a query list from the raw query string of a given URI.
+ * Uses default libc-based memory manager.
+ *
+ * @param dest <b>OUT</b>: Output destination
+ * @param itemCount <b>OUT</b>: Number of items found, can be NULL
+ * @param first <b>IN</b>: Pointer to first character <b>after</b> '?'
+ * @param afterLast <b>IN</b>: Pointer to character after the last one still in
+ * @param plusToSpace <b>IN</b>: Whether to convert '+' to ' ' or not
+ * @param breakConversion <b>IN</b>: Line break conversion mode
+ * @return Error code or 0 on success
+ *
+ * @see uriDissectQueryMallocA
+ * @see uriDissectQueryMallocExMmA
+ * @see uriComposeQueryExA
+ * @see uriFreeQueryListA
+ * @since 0.7.0
+ */
URI_PUBLIC int URI_FUNC(DissectQueryMallocEx)(URI_TYPE(QueryList) ** dest,
int * itemCount, const URI_CHAR * first, const URI_CHAR * afterLast,
- UriBool plusToSpace, UriBreakConversion breakConversion);
-
-
-
-/**
- * Constructs a query list from the raw query string of a given URI.
- *
- * @param dest <b>OUT</b>: Output destination
- * @param itemCount <b>OUT</b>: Number of items found, can be NULL
- * @param first <b>IN</b>: Pointer to first character <b>after</b> '?'
- * @param afterLast <b>IN</b>: Pointer to character after the last one still in
- * @param plusToSpace <b>IN</b>: Whether to convert '+' to ' ' or not
- * @param breakConversion <b>IN</b>: Line break conversion mode
- * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
- * @return Error code or 0 on success
- *
- * @see uriDissectQueryMallocA
- * @see uriDissectQueryMallocExA
- * @see uriComposeQueryExA
- * @see uriFreeQueryListA
- * @see uriFreeQueryListMmA
- * @since 0.9.0
- */
+ UriBool plusToSpace, UriBreakConversion breakConversion);
+
+
+
+/**
+ * Constructs a query list from the raw query string of a given URI.
+ *
+ * @param dest <b>OUT</b>: Output destination
+ * @param itemCount <b>OUT</b>: Number of items found, can be NULL
+ * @param first <b>IN</b>: Pointer to first character <b>after</b> '?'
+ * @param afterLast <b>IN</b>: Pointer to character after the last one still in
+ * @param plusToSpace <b>IN</b>: Whether to convert '+' to ' ' or not
+ * @param breakConversion <b>IN</b>: Line break conversion mode
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return Error code or 0 on success
+ *
+ * @see uriDissectQueryMallocA
+ * @see uriDissectQueryMallocExA
+ * @see uriComposeQueryExA
+ * @see uriFreeQueryListA
+ * @see uriFreeQueryListMmA
+ * @since 0.9.0
+ */
URI_PUBLIC int URI_FUNC(DissectQueryMallocExMm)(URI_TYPE(QueryList) ** dest,
int * itemCount, const URI_CHAR * first, const URI_CHAR * afterLast,
- UriBool plusToSpace, UriBreakConversion breakConversion,
- UriMemoryManager * memory);
-
-
-
-/**
- * Frees all memory associated with the given query list.
- * The structure itself is freed as well.
- *
- * @param queryList <b>INOUT</b>: Query list to free
- *
- * @see uriFreeQueryListMmA
- * @since 0.7.0
- */
+ UriBool plusToSpace, UriBreakConversion breakConversion,
+ UriMemoryManager * memory);
+
+
+
+/**
+ * Frees all memory associated with the given query list.
+ * The structure itself is freed as well.
+ *
+ * @param queryList <b>INOUT</b>: Query list to free
+ *
+ * @see uriFreeQueryListMmA
+ * @since 0.7.0
+ */
URI_PUBLIC void URI_FUNC(FreeQueryList)(URI_TYPE(QueryList) * queryList);
-
-
-
-/**
- * Frees all memory associated with the given query list.
- * The structure itself is freed as well.
- *
- * @param queryList <b>INOUT</b>: Query list to free
- * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
- * @return Error code or 0 on success
- *
- * @see uriFreeQueryListA
- * @since 0.9.0
- */
+
+
+
+/**
+ * Frees all memory associated with the given query list.
+ * The structure itself is freed as well.
+ *
+ * @param queryList <b>INOUT</b>: Query list to free
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return Error code or 0 on success
+ *
+ * @see uriFreeQueryListA
+ * @since 0.9.0
+ */
URI_PUBLIC int URI_FUNC(FreeQueryListMm)(URI_TYPE(QueryList) * queryList,
- UriMemoryManager * memory);
-
-
-
+ UriMemoryManager * memory);
+
+
+
/**
* Makes the %URI hold copies of strings so that it no longer depends
* on the original %URI string. If the %URI is already owner of copies,
@@ -1114,11 +1114,11 @@ URI_PUBLIC int URI_FUNC(MakeOwnerMm)(URI_TYPE(Uri) * uri,
-#ifdef __cplusplus
-}
-#endif
-
-
-
-#endif
-#endif
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#endif
+#endif
diff --git a/contrib/restricted/uriparser/include/uriparser/UriBase.h b/contrib/restricted/uriparser/include/uriparser/UriBase.h
index 2e63f92c86..273a987495 100644
--- a/contrib/restricted/uriparser/include/uriparser/UriBase.h
+++ b/contrib/restricted/uriparser/include/uriparser/UriBase.h
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,72 +31,72 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file UriBase.h
- * Holds definitions independent of the encoding pass.
- */
-
-#ifndef URI_BASE_H
-#define URI_BASE_H 1
-
-
-
-/* Version helper macro */
-#define URI_ANSI_TO_UNICODE(x) L##x
-
-
-
-/* Version */
-#define URI_VER_MAJOR 0
-#define URI_VER_MINOR 9
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file UriBase.h
+ * Holds definitions independent of the encoding pass.
+ */
+
+#ifndef URI_BASE_H
+#define URI_BASE_H 1
+
+
+
+/* Version helper macro */
+#define URI_ANSI_TO_UNICODE(x) L##x
+
+
+
+/* Version */
+#define URI_VER_MAJOR 0
+#define URI_VER_MINOR 9
#define URI_VER_RELEASE 6
-#define URI_VER_SUFFIX_ANSI ""
-#define URI_VER_SUFFIX_UNICODE URI_ANSI_TO_UNICODE(URI_VER_SUFFIX_ANSI)
-
-
-
-/* More version helper macros */
-#define URI_INT_TO_ANSI_HELPER(x) #x
-#define URI_INT_TO_ANSI(x) URI_INT_TO_ANSI_HELPER(x)
-
-#define URI_INT_TO_UNICODE_HELPER(x) URI_ANSI_TO_UNICODE(#x)
-#define URI_INT_TO_UNICODE(x) URI_INT_TO_UNICODE_HELPER(x)
-
-#define URI_VER_ANSI_HELPER(ma, mi, r, s) \
- URI_INT_TO_ANSI(ma) "." \
- URI_INT_TO_ANSI(mi) "." \
- URI_INT_TO_ANSI(r) \
- s
-
-#define URI_VER_UNICODE_HELPER(ma, mi, r, s) \
- URI_INT_TO_UNICODE(ma) L"." \
- URI_INT_TO_UNICODE(mi) L"." \
- URI_INT_TO_UNICODE(r) \
- s
-
-
-
-/* Full version strings */
-#define URI_VER_ANSI URI_VER_ANSI_HELPER(URI_VER_MAJOR, URI_VER_MINOR, URI_VER_RELEASE, URI_VER_SUFFIX_ANSI)
-#define URI_VER_UNICODE URI_VER_UNICODE_HELPER(URI_VER_MAJOR, URI_VER_MINOR, URI_VER_RELEASE, URI_VER_SUFFIX_UNICODE)
-
-
-
-/* Unused parameter macro */
-#ifdef __GNUC__
-# define URI_UNUSED(x) unused_##x __attribute__((unused))
-#else
-# define URI_UNUSED(x) x
-#endif
-
-
-
+#define URI_VER_SUFFIX_ANSI ""
+#define URI_VER_SUFFIX_UNICODE URI_ANSI_TO_UNICODE(URI_VER_SUFFIX_ANSI)
+
+
+
+/* More version helper macros */
+#define URI_INT_TO_ANSI_HELPER(x) #x
+#define URI_INT_TO_ANSI(x) URI_INT_TO_ANSI_HELPER(x)
+
+#define URI_INT_TO_UNICODE_HELPER(x) URI_ANSI_TO_UNICODE(#x)
+#define URI_INT_TO_UNICODE(x) URI_INT_TO_UNICODE_HELPER(x)
+
+#define URI_VER_ANSI_HELPER(ma, mi, r, s) \
+ URI_INT_TO_ANSI(ma) "." \
+ URI_INT_TO_ANSI(mi) "." \
+ URI_INT_TO_ANSI(r) \
+ s
+
+#define URI_VER_UNICODE_HELPER(ma, mi, r, s) \
+ URI_INT_TO_UNICODE(ma) L"." \
+ URI_INT_TO_UNICODE(mi) L"." \
+ URI_INT_TO_UNICODE(r) \
+ s
+
+
+
+/* Full version strings */
+#define URI_VER_ANSI URI_VER_ANSI_HELPER(URI_VER_MAJOR, URI_VER_MINOR, URI_VER_RELEASE, URI_VER_SUFFIX_ANSI)
+#define URI_VER_UNICODE URI_VER_UNICODE_HELPER(URI_VER_MAJOR, URI_VER_MINOR, URI_VER_RELEASE, URI_VER_SUFFIX_UNICODE)
+
+
+
+/* Unused parameter macro */
+#ifdef __GNUC__
+# define URI_UNUSED(x) unused_##x __attribute__((unused))
+#else
+# define URI_UNUSED(x) x
+#endif
+
+
+
/* Import/export decorator */
#define URI_STATIC_BUILD
#if defined(URI_STATIC_BUILD)
@@ -121,258 +121,258 @@
-typedef int UriBool; /**< Boolean type */
-
-#define URI_TRUE 1
-#define URI_FALSE 0
-
-
-
-/* Shared errors */
-#define URI_SUCCESS 0
-#define URI_ERROR_SYNTAX 1 /* Parsed text violates expected format */
-#define URI_ERROR_NULL 2 /* One of the params passed was NULL
- although it mustn't be */
-#define URI_ERROR_MALLOC 3 /* Requested memory could not be allocated */
-#define URI_ERROR_OUTPUT_TOO_LARGE 4 /* Some output is to large for the receiving buffer */
-#define URI_ERROR_NOT_IMPLEMENTED 8 /* The called function is not implemented yet */
-#define URI_ERROR_RANGE_INVALID 9 /* The parameters passed contained invalid ranges */
-#define URI_ERROR_MEMORY_MANAGER_INCOMPLETE 10 /* [>=0.9.0] The UriMemoryManager passed does not implement all needed functions */
-
-
-/* Errors specific to ToString */
-#define URI_ERROR_TOSTRING_TOO_LONG URI_ERROR_OUTPUT_TOO_LARGE /* Deprecated, test for URI_ERROR_OUTPUT_TOO_LARGE instead */
-
-/* Errors specific to AddBaseUri */
-#define URI_ERROR_ADDBASE_REL_BASE 5 /* Given base is not absolute */
-
-/* Errors specific to RemoveBaseUri */
-#define URI_ERROR_REMOVEBASE_REL_BASE 6 /* Given base is not absolute */
-#define URI_ERROR_REMOVEBASE_REL_SOURCE 7 /* Given base is not absolute */
-
-/* Error specific to uriTestMemoryManager */
-#define URI_ERROR_MEMORY_MANAGER_FAULTY 11 /* [>=0.9.0] The UriMemoryManager given did not pass the test suite */
-
-
-#ifndef URI_DOXYGEN
-# include <stdio.h> /* For NULL, snprintf */
-# include <ctype.h> /* For wchar_t */
-# include <string.h> /* For strlen, memset, memcpy */
-# include <stdlib.h> /* For malloc */
-#endif /* URI_DOXYGEN */
-
-
-
-/**
- * Holds an IPv4 address.
- */
-typedef struct UriIp4Struct {
- unsigned char data[4]; /**< Each octet in one byte */
-} UriIp4; /**< @copydoc UriIp4Struct */
-
-
-
-/**
- * Holds an IPv6 address.
- */
-typedef struct UriIp6Struct {
- unsigned char data[16]; /**< Each quad in two bytes */
-} UriIp6; /**< @copydoc UriIp6Struct */
-
-
-struct UriMemoryManagerStruct; /* foward declaration to break loop */
-
-
-/**
- * Function signature that custom malloc(3) functions must conform to
- *
- * @since 0.9.0
- */
-typedef void * (*UriFuncMalloc)(struct UriMemoryManagerStruct *, size_t);
-
-/**
- * Function signature that custom calloc(3) functions must conform to
- *
- * @since 0.9.0
- */
-typedef void * (*UriFuncCalloc)(struct UriMemoryManagerStruct *, size_t, size_t);
-
-/**
- * Function signature that custom realloc(3) functions must conform to
- *
- * @since 0.9.0
- */
-typedef void * (*UriFuncRealloc)(struct UriMemoryManagerStruct *, void *, size_t);
-
-/**
- * Function signature that custom reallocarray(3) functions must conform to
- *
- * @since 0.9.0
- */
-typedef void * (*UriFuncReallocarray)(struct UriMemoryManagerStruct *, void *, size_t, size_t);
-
-/**
- * Function signature that custom free(3) functions must conform to
- *
- * @since 0.9.0
- */
-typedef void (*UriFuncFree)(struct UriMemoryManagerStruct *, void *);
-
-
-/**
- * Class-like interface of custom memory managers
- *
- * @see uriCompleteMemoryManager
- * @see uriEmulateCalloc
- * @see uriEmulateReallocarray
- * @see uriTestMemoryManager
- * @since 0.9.0
- */
-typedef struct UriMemoryManagerStruct {
- UriFuncMalloc malloc; /**< Pointer to custom malloc(3) */
- UriFuncCalloc calloc; /**< Pointer to custom calloc(3); to emulate using malloc and memset see uriEmulateCalloc */
- UriFuncRealloc realloc; /**< Pointer to custom realloc(3) */
- UriFuncReallocarray reallocarray; /**< Pointer to custom reallocarray(3); to emulate using realloc see uriEmulateReallocarray */
- UriFuncFree free; /**< Pointer to custom free(3) */
- void * userData; /**< Pointer to data that the other function members need access to */
-} UriMemoryManager; /**< @copydoc UriMemoryManagerStruct */
-
-
-/**
- * Specifies a line break conversion mode.
- */
-typedef enum UriBreakConversionEnum {
- URI_BR_TO_LF, /**< Convert to Unix line breaks ("\\x0a") */
- URI_BR_TO_CRLF, /**< Convert to Windows line breaks ("\\x0d\\x0a") */
- URI_BR_TO_CR, /**< Convert to Macintosh line breaks ("\\x0d") */
- URI_BR_TO_UNIX = URI_BR_TO_LF, /**< @copydoc UriBreakConversionEnum::URI_BR_TO_LF */
- URI_BR_TO_WINDOWS = URI_BR_TO_CRLF, /**< @copydoc UriBreakConversionEnum::URI_BR_TO_CRLF */
- URI_BR_TO_MAC = URI_BR_TO_CR, /**< @copydoc UriBreakConversionEnum::URI_BR_TO_CR */
- URI_BR_DONT_TOUCH /**< Copy line breaks unmodified */
-} UriBreakConversion; /**< @copydoc UriBreakConversionEnum */
-
-
-
-/**
- * Specifies which component of a %URI has to be normalized.
- */
-typedef enum UriNormalizationMaskEnum {
- URI_NORMALIZED = 0, /**< Do not normalize anything */
- URI_NORMALIZE_SCHEME = 1 << 0, /**< Normalize scheme (fix uppercase letters) */
- URI_NORMALIZE_USER_INFO = 1 << 1, /**< Normalize user info (fix uppercase percent-encodings) */
- URI_NORMALIZE_HOST = 1 << 2, /**< Normalize host (fix uppercase letters) */
- URI_NORMALIZE_PATH = 1 << 3, /**< Normalize path (fix uppercase percent-encodings and redundant dot segments) */
- URI_NORMALIZE_QUERY = 1 << 4, /**< Normalize query (fix uppercase percent-encodings) */
- URI_NORMALIZE_FRAGMENT = 1 << 5 /**< Normalize fragment (fix uppercase percent-encodings) */
-} UriNormalizationMask; /**< @copydoc UriNormalizationMaskEnum */
-
-
-
-/**
- * Specifies how to resolve %URI references.
- */
-typedef enum UriResolutionOptionsEnum {
- URI_RESOLVE_STRICTLY = 0, /**< Full RFC conformance */
- URI_RESOLVE_IDENTICAL_SCHEME_COMPAT = 1 << 0 /**< Treat %URI to resolve with identical scheme as having no scheme */
-} UriResolutionOptions; /**< @copydoc UriResolutionOptionsEnum */
-
-
-
-/**
- * Wraps a memory manager backend that only provides malloc and free
- * to make a complete memory manager ready to be used.
- *
- * The core feature of this wrapper is that you don't need to implement
- * realloc if you don't want to. The wrapped memory manager uses
- * backend->malloc, memcpy, and backend->free and soieof(size_t) extra
- * bytes per allocation to emulate fallback realloc for you.
- *
- * memory->calloc is uriEmulateCalloc.
- * memory->free uses backend->free and handles the size header.
- * memory->malloc uses backend->malloc and adds a size header.
- * memory->realloc uses memory->malloc, memcpy, and memory->free and reads
- * the size header.
- * memory->reallocarray is uriEmulateReallocarray.
- *
- * The internal workings behind memory->free, memory->malloc, and
- * memory->realloc may change so the functions exposed by these function
- * pointer sshould be consided internal and not public API.
- *
- * @param memory <b>OUT</b>: Where to write the wrapped memory manager to
- * @param backend <b>IN</b>: Memory manager to use as a backend
- * @return Error code or 0 on success
- *
- * @see uriEmulateCalloc
- * @see uriEmulateReallocarray
- * @see UriMemoryManager
- * @since 0.9.0
- */
+typedef int UriBool; /**< Boolean type */
+
+#define URI_TRUE 1
+#define URI_FALSE 0
+
+
+
+/* Shared errors */
+#define URI_SUCCESS 0
+#define URI_ERROR_SYNTAX 1 /* Parsed text violates expected format */
+#define URI_ERROR_NULL 2 /* One of the params passed was NULL
+ although it mustn't be */
+#define URI_ERROR_MALLOC 3 /* Requested memory could not be allocated */
+#define URI_ERROR_OUTPUT_TOO_LARGE 4 /* Some output is to large for the receiving buffer */
+#define URI_ERROR_NOT_IMPLEMENTED 8 /* The called function is not implemented yet */
+#define URI_ERROR_RANGE_INVALID 9 /* The parameters passed contained invalid ranges */
+#define URI_ERROR_MEMORY_MANAGER_INCOMPLETE 10 /* [>=0.9.0] The UriMemoryManager passed does not implement all needed functions */
+
+
+/* Errors specific to ToString */
+#define URI_ERROR_TOSTRING_TOO_LONG URI_ERROR_OUTPUT_TOO_LARGE /* Deprecated, test for URI_ERROR_OUTPUT_TOO_LARGE instead */
+
+/* Errors specific to AddBaseUri */
+#define URI_ERROR_ADDBASE_REL_BASE 5 /* Given base is not absolute */
+
+/* Errors specific to RemoveBaseUri */
+#define URI_ERROR_REMOVEBASE_REL_BASE 6 /* Given base is not absolute */
+#define URI_ERROR_REMOVEBASE_REL_SOURCE 7 /* Given base is not absolute */
+
+/* Error specific to uriTestMemoryManager */
+#define URI_ERROR_MEMORY_MANAGER_FAULTY 11 /* [>=0.9.0] The UriMemoryManager given did not pass the test suite */
+
+
+#ifndef URI_DOXYGEN
+# include <stdio.h> /* For NULL, snprintf */
+# include <ctype.h> /* For wchar_t */
+# include <string.h> /* For strlen, memset, memcpy */
+# include <stdlib.h> /* For malloc */
+#endif /* URI_DOXYGEN */
+
+
+
+/**
+ * Holds an IPv4 address.
+ */
+typedef struct UriIp4Struct {
+ unsigned char data[4]; /**< Each octet in one byte */
+} UriIp4; /**< @copydoc UriIp4Struct */
+
+
+
+/**
+ * Holds an IPv6 address.
+ */
+typedef struct UriIp6Struct {
+ unsigned char data[16]; /**< Each quad in two bytes */
+} UriIp6; /**< @copydoc UriIp6Struct */
+
+
+struct UriMemoryManagerStruct; /* foward declaration to break loop */
+
+
+/**
+ * Function signature that custom malloc(3) functions must conform to
+ *
+ * @since 0.9.0
+ */
+typedef void * (*UriFuncMalloc)(struct UriMemoryManagerStruct *, size_t);
+
+/**
+ * Function signature that custom calloc(3) functions must conform to
+ *
+ * @since 0.9.0
+ */
+typedef void * (*UriFuncCalloc)(struct UriMemoryManagerStruct *, size_t, size_t);
+
+/**
+ * Function signature that custom realloc(3) functions must conform to
+ *
+ * @since 0.9.0
+ */
+typedef void * (*UriFuncRealloc)(struct UriMemoryManagerStruct *, void *, size_t);
+
+/**
+ * Function signature that custom reallocarray(3) functions must conform to
+ *
+ * @since 0.9.0
+ */
+typedef void * (*UriFuncReallocarray)(struct UriMemoryManagerStruct *, void *, size_t, size_t);
+
+/**
+ * Function signature that custom free(3) functions must conform to
+ *
+ * @since 0.9.0
+ */
+typedef void (*UriFuncFree)(struct UriMemoryManagerStruct *, void *);
+
+
+/**
+ * Class-like interface of custom memory managers
+ *
+ * @see uriCompleteMemoryManager
+ * @see uriEmulateCalloc
+ * @see uriEmulateReallocarray
+ * @see uriTestMemoryManager
+ * @since 0.9.0
+ */
+typedef struct UriMemoryManagerStruct {
+ UriFuncMalloc malloc; /**< Pointer to custom malloc(3) */
+ UriFuncCalloc calloc; /**< Pointer to custom calloc(3); to emulate using malloc and memset see uriEmulateCalloc */
+ UriFuncRealloc realloc; /**< Pointer to custom realloc(3) */
+ UriFuncReallocarray reallocarray; /**< Pointer to custom reallocarray(3); to emulate using realloc see uriEmulateReallocarray */
+ UriFuncFree free; /**< Pointer to custom free(3) */
+ void * userData; /**< Pointer to data that the other function members need access to */
+} UriMemoryManager; /**< @copydoc UriMemoryManagerStruct */
+
+
+/**
+ * Specifies a line break conversion mode.
+ */
+typedef enum UriBreakConversionEnum {
+ URI_BR_TO_LF, /**< Convert to Unix line breaks ("\\x0a") */
+ URI_BR_TO_CRLF, /**< Convert to Windows line breaks ("\\x0d\\x0a") */
+ URI_BR_TO_CR, /**< Convert to Macintosh line breaks ("\\x0d") */
+ URI_BR_TO_UNIX = URI_BR_TO_LF, /**< @copydoc UriBreakConversionEnum::URI_BR_TO_LF */
+ URI_BR_TO_WINDOWS = URI_BR_TO_CRLF, /**< @copydoc UriBreakConversionEnum::URI_BR_TO_CRLF */
+ URI_BR_TO_MAC = URI_BR_TO_CR, /**< @copydoc UriBreakConversionEnum::URI_BR_TO_CR */
+ URI_BR_DONT_TOUCH /**< Copy line breaks unmodified */
+} UriBreakConversion; /**< @copydoc UriBreakConversionEnum */
+
+
+
+/**
+ * Specifies which component of a %URI has to be normalized.
+ */
+typedef enum UriNormalizationMaskEnum {
+ URI_NORMALIZED = 0, /**< Do not normalize anything */
+ URI_NORMALIZE_SCHEME = 1 << 0, /**< Normalize scheme (fix uppercase letters) */
+ URI_NORMALIZE_USER_INFO = 1 << 1, /**< Normalize user info (fix uppercase percent-encodings) */
+ URI_NORMALIZE_HOST = 1 << 2, /**< Normalize host (fix uppercase letters) */
+ URI_NORMALIZE_PATH = 1 << 3, /**< Normalize path (fix uppercase percent-encodings and redundant dot segments) */
+ URI_NORMALIZE_QUERY = 1 << 4, /**< Normalize query (fix uppercase percent-encodings) */
+ URI_NORMALIZE_FRAGMENT = 1 << 5 /**< Normalize fragment (fix uppercase percent-encodings) */
+} UriNormalizationMask; /**< @copydoc UriNormalizationMaskEnum */
+
+
+
+/**
+ * Specifies how to resolve %URI references.
+ */
+typedef enum UriResolutionOptionsEnum {
+ URI_RESOLVE_STRICTLY = 0, /**< Full RFC conformance */
+ URI_RESOLVE_IDENTICAL_SCHEME_COMPAT = 1 << 0 /**< Treat %URI to resolve with identical scheme as having no scheme */
+} UriResolutionOptions; /**< @copydoc UriResolutionOptionsEnum */
+
+
+
+/**
+ * Wraps a memory manager backend that only provides malloc and free
+ * to make a complete memory manager ready to be used.
+ *
+ * The core feature of this wrapper is that you don't need to implement
+ * realloc if you don't want to. The wrapped memory manager uses
+ * backend->malloc, memcpy, and backend->free and soieof(size_t) extra
+ * bytes per allocation to emulate fallback realloc for you.
+ *
+ * memory->calloc is uriEmulateCalloc.
+ * memory->free uses backend->free and handles the size header.
+ * memory->malloc uses backend->malloc and adds a size header.
+ * memory->realloc uses memory->malloc, memcpy, and memory->free and reads
+ * the size header.
+ * memory->reallocarray is uriEmulateReallocarray.
+ *
+ * The internal workings behind memory->free, memory->malloc, and
+ * memory->realloc may change so the functions exposed by these function
+ * pointer sshould be consided internal and not public API.
+ *
+ * @param memory <b>OUT</b>: Where to write the wrapped memory manager to
+ * @param backend <b>IN</b>: Memory manager to use as a backend
+ * @return Error code or 0 on success
+ *
+ * @see uriEmulateCalloc
+ * @see uriEmulateReallocarray
+ * @see UriMemoryManager
+ * @since 0.9.0
+ */
URI_PUBLIC int uriCompleteMemoryManager(UriMemoryManager * memory,
- UriMemoryManager * backend);
-
-
-
-/**
- * Offers emulation of calloc(3) based on memory->malloc and memset.
- * See "man 3 calloc" as well.
- *
- * @param memory <b>IN</b>: Memory manager to use, should not be NULL
- * @param nmemb <b>IN</b>: Number of elements to allocate
- * @param size <b>IN</b>: Size in bytes per element
- * @return Pointer to allocated memory or NULL
- *
- * @see uriCompleteMemoryManager
- * @see uriEmulateReallocarray
- * @see UriMemoryManager
- * @since 0.9.0
- */
+ UriMemoryManager * backend);
+
+
+
+/**
+ * Offers emulation of calloc(3) based on memory->malloc and memset.
+ * See "man 3 calloc" as well.
+ *
+ * @param memory <b>IN</b>: Memory manager to use, should not be NULL
+ * @param nmemb <b>IN</b>: Number of elements to allocate
+ * @param size <b>IN</b>: Size in bytes per element
+ * @return Pointer to allocated memory or NULL
+ *
+ * @see uriCompleteMemoryManager
+ * @see uriEmulateReallocarray
+ * @see UriMemoryManager
+ * @since 0.9.0
+ */
URI_PUBLIC void * uriEmulateCalloc(UriMemoryManager * memory,
- size_t nmemb, size_t size);
-
-
-
-/**
- * Offers emulation of reallocarray(3) based on memory->realloc.
- * See "man 3 reallocarray" as well.
- *
- * @param memory <b>IN</b>: Memory manager to use, should not be NULL
- * @param ptr <b>IN</b>: Pointer allocated using memory->malloc/... or NULL
- * @param nmemb <b>IN</b>: Number of elements to allocate
- * @param size <b>IN</b>: Size in bytes per element
- * @return Pointer to allocated memory or NULL
- *
- * @see uriCompleteMemoryManager
- * @see uriEmulateCalloc
- * @see UriMemoryManager
- * @since 0.9.0
- */
+ size_t nmemb, size_t size);
+
+
+
+/**
+ * Offers emulation of reallocarray(3) based on memory->realloc.
+ * See "man 3 reallocarray" as well.
+ *
+ * @param memory <b>IN</b>: Memory manager to use, should not be NULL
+ * @param ptr <b>IN</b>: Pointer allocated using memory->malloc/... or NULL
+ * @param nmemb <b>IN</b>: Number of elements to allocate
+ * @param size <b>IN</b>: Size in bytes per element
+ * @return Pointer to allocated memory or NULL
+ *
+ * @see uriCompleteMemoryManager
+ * @see uriEmulateCalloc
+ * @see UriMemoryManager
+ * @since 0.9.0
+ */
URI_PUBLIC void * uriEmulateReallocarray(UriMemoryManager * memory,
- void * ptr, size_t nmemb, size_t size);
-
-
-
-/**
- * Run multiple tests against a given memory manager.
- * For example, one test
- * 1. allocates a small amount of memory,
- * 2. writes some magic bytes to it,
- * 3. reallocates it,
- * 4. checks that previous values are still present,
- * 5. and frees that memory.
- *
- * It is recommended to compile with AddressSanitizer enabled
- * to take full advantage of uriTestMemoryManager.
- *
- * @param memory <b>IN</b>: Memory manager to use, should not be NULL
- * @return Error code or 0 on success
- *
- * @see uriEmulateCalloc
- * @see uriEmulateReallocarray
- * @see UriMemoryManager
- * @since 0.9.0
- */
+ void * ptr, size_t nmemb, size_t size);
+
+
+
+/**
+ * Run multiple tests against a given memory manager.
+ * For example, one test
+ * 1. allocates a small amount of memory,
+ * 2. writes some magic bytes to it,
+ * 3. reallocates it,
+ * 4. checks that previous values are still present,
+ * 5. and frees that memory.
+ *
+ * It is recommended to compile with AddressSanitizer enabled
+ * to take full advantage of uriTestMemoryManager.
+ *
+ * @param memory <b>IN</b>: Memory manager to use, should not be NULL
+ * @return Error code or 0 on success
+ *
+ * @see uriEmulateCalloc
+ * @see uriEmulateReallocarray
+ * @see UriMemoryManager
+ * @since 0.9.0
+ */
URI_PUBLIC int uriTestMemoryManager(UriMemoryManager * memory);
-
-
-
-#endif /* URI_BASE_H */
+
+
+
+#endif /* URI_BASE_H */
diff --git a/contrib/restricted/uriparser/include/uriparser/UriDefsAnsi.h b/contrib/restricted/uriparser/include/uriparser/UriDefsAnsi.h
index af581b91a2..ff189e8fbc 100644
--- a/contrib/restricted/uriparser/include/uriparser/UriDefsAnsi.h
+++ b/contrib/restricted/uriparser/include/uriparser/UriDefsAnsi.h
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,52 +31,52 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file UriDefsAnsi.h
- * Holds definitions for the ANSI pass.
- * NOTE: This header is included N times, not once.
- */
-
-/* Allow multi inclusion */
-#include "UriDefsConfig.h"
-
-
-
-#undef URI_CHAR
-#define URI_CHAR char
-
-#undef _UT
-#define _UT(x) x
-
-
-
-#undef URI_FUNC
-#define URI_FUNC(x) uri##x##A
-
-#undef URI_TYPE
-#define URI_TYPE(x) Uri##x##A
-
-
-
-#undef URI_STRLEN
-#define URI_STRLEN strlen
-#undef URI_STRCPY
-#define URI_STRCPY strcpy
-#undef URI_STRCMP
-#define URI_STRCMP strcmp
-#undef URI_STRNCMP
-#define URI_STRNCMP strncmp
-
-/* TODO Remove on next source-compatibility break */
-#undef URI_SNPRINTF
-#if (defined(__WIN32__) || defined(_WIN32) || defined(WIN32))
-# define URI_SNPRINTF _snprintf
-#else
-# define URI_SNPRINTF snprintf
-#endif
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file UriDefsAnsi.h
+ * Holds definitions for the ANSI pass.
+ * NOTE: This header is included N times, not once.
+ */
+
+/* Allow multi inclusion */
+#include "UriDefsConfig.h"
+
+
+
+#undef URI_CHAR
+#define URI_CHAR char
+
+#undef _UT
+#define _UT(x) x
+
+
+
+#undef URI_FUNC
+#define URI_FUNC(x) uri##x##A
+
+#undef URI_TYPE
+#define URI_TYPE(x) Uri##x##A
+
+
+
+#undef URI_STRLEN
+#define URI_STRLEN strlen
+#undef URI_STRCPY
+#define URI_STRCPY strcpy
+#undef URI_STRCMP
+#define URI_STRCMP strcmp
+#undef URI_STRNCMP
+#define URI_STRNCMP strncmp
+
+/* TODO Remove on next source-compatibility break */
+#undef URI_SNPRINTF
+#if (defined(__WIN32__) || defined(_WIN32) || defined(WIN32))
+# define URI_SNPRINTF _snprintf
+#else
+# define URI_SNPRINTF snprintf
+#endif
diff --git a/contrib/restricted/uriparser/include/uriparser/UriDefsConfig.h b/contrib/restricted/uriparser/include/uriparser/UriDefsConfig.h
index 51bc93eedd..6b605afcc5 100644
--- a/contrib/restricted/uriparser/include/uriparser/UriDefsConfig.h
+++ b/contrib/restricted/uriparser/include/uriparser/UriDefsConfig.h
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,71 +31,71 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file UriDefsConfig.h
- * Adjusts the internal configuration after processing external definitions.
- */
-
-#ifndef URI_DEFS_CONFIG_H
-#define URI_DEFS_CONFIG_H 1
-
-
-
-/* Deny external overriding */
-#undef URI_ENABLE_ANSI /* Internal for !URI_NO_ANSI */
-#undef URI_ENABLE_UNICODE /* Internal for !URI_NO_UNICODE */
-
-
-
-/* Encoding */
-#ifdef URI_NO_ANSI
-# ifdef URI_NO_UNICODE
-/* No encoding at all */
-# error URI_NO_ANSI and URI_NO_UNICODE cannot go together.
-# else
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file UriDefsConfig.h
+ * Adjusts the internal configuration after processing external definitions.
+ */
+
+#ifndef URI_DEFS_CONFIG_H
+#define URI_DEFS_CONFIG_H 1
+
+
+
+/* Deny external overriding */
+#undef URI_ENABLE_ANSI /* Internal for !URI_NO_ANSI */
+#undef URI_ENABLE_UNICODE /* Internal for !URI_NO_UNICODE */
+
+
+
+/* Encoding */
+#ifdef URI_NO_ANSI
+# ifdef URI_NO_UNICODE
+/* No encoding at all */
+# error URI_NO_ANSI and URI_NO_UNICODE cannot go together.
+# else
/* Wide strings only */
-# define URI_ENABLE_UNICODE 1
-# endif
-#else
-# ifdef URI_NO_UNICODE
+# define URI_ENABLE_UNICODE 1
+# endif
+#else
+# ifdef URI_NO_UNICODE
/* Narrow strings only */
-# define URI_ENABLE_ANSI 1
-# else
+# define URI_ENABLE_ANSI 1
+# else
/* Both narrow and wide strings */
-# define URI_ENABLE_ANSI 1
-# define URI_ENABLE_UNICODE 1
-# endif
-#endif
-
-
-
-/* Function inlining, not ANSI/ISO C! */
-#if defined(URI_DOXYGEN)
-# define URI_INLINE
-#elif defined(__INTEL_COMPILER)
-/* Intel C/C++ */
-/* http://predef.sourceforge.net/precomp.html#sec20 */
-/* http://www.intel.com/support/performancetools/c/windows/sb/CS-007751.htm#2 */
+# define URI_ENABLE_ANSI 1
+# define URI_ENABLE_UNICODE 1
+# endif
+#endif
+
+
+
+/* Function inlining, not ANSI/ISO C! */
+#if defined(URI_DOXYGEN)
+# define URI_INLINE
+#elif defined(__INTEL_COMPILER)
+/* Intel C/C++ */
+/* http://predef.sourceforge.net/precomp.html#sec20 */
+/* http://www.intel.com/support/performancetools/c/windows/sb/CS-007751.htm#2 */
# define URI_INLINE __forceinline
-#elif defined(_MSC_VER)
-/* Microsoft Visual C++ */
-/* http://predef.sourceforge.net/precomp.html#sec32 */
-/* http://msdn2.microsoft.com/en-us/library/ms882281.aspx */
-# define URI_INLINE __forceinline
-#elif (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
-/* C99, "inline" is a keyword */
-# define URI_INLINE inline
-#else
-/* No inlining */
-# define URI_INLINE
-#endif
-
-
-
-#endif /* URI_DEFS_CONFIG_H */
+#elif defined(_MSC_VER)
+/* Microsoft Visual C++ */
+/* http://predef.sourceforge.net/precomp.html#sec32 */
+/* http://msdn2.microsoft.com/en-us/library/ms882281.aspx */
+# define URI_INLINE __forceinline
+#elif (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
+/* C99, "inline" is a keyword */
+# define URI_INLINE inline
+#else
+/* No inlining */
+# define URI_INLINE
+#endif
+
+
+
+#endif /* URI_DEFS_CONFIG_H */
diff --git a/contrib/restricted/uriparser/include/uriparser/UriDefsUnicode.h b/contrib/restricted/uriparser/include/uriparser/UriDefsUnicode.h
index 01421f5f86..ee12f3d9e0 100644
--- a/contrib/restricted/uriparser/include/uriparser/UriDefsUnicode.h
+++ b/contrib/restricted/uriparser/include/uriparser/UriDefsUnicode.h
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,52 +31,52 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file UriDefsUnicode.h
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file UriDefsUnicode.h
* Holds definitions for the wide string pass.
- * NOTE: This header is included N times, not once.
- */
-
-/* Allow multi inclusion */
-#include "UriDefsConfig.h"
-
-
-
-#undef URI_CHAR
-#define URI_CHAR wchar_t
-
-#undef _UT
-#define _UT(x) L##x
-
-
-
-#undef URI_FUNC
-#define URI_FUNC(x) uri##x##W
-
-#undef URI_TYPE
-#define URI_TYPE(x) Uri##x##W
-
-
-
-#undef URI_STRLEN
-#define URI_STRLEN wcslen
-#undef URI_STRCPY
-#define URI_STRCPY wcscpy
-#undef URI_STRCMP
-#define URI_STRCMP wcscmp
-#undef URI_STRNCMP
-#define URI_STRNCMP wcsncmp
-
-/* TODO Remove on next source-compatibility break */
-#undef URI_SNPRINTF
-#if (defined(__WIN32__) || defined(_WIN32) || defined(WIN32))
-# define URI_SNPRINTF _snwprintf
-#else
-# define URI_SNPRINTF swprintf
-#endif
+ * NOTE: This header is included N times, not once.
+ */
+
+/* Allow multi inclusion */
+#include "UriDefsConfig.h"
+
+
+
+#undef URI_CHAR
+#define URI_CHAR wchar_t
+
+#undef _UT
+#define _UT(x) L##x
+
+
+
+#undef URI_FUNC
+#define URI_FUNC(x) uri##x##W
+
+#undef URI_TYPE
+#define URI_TYPE(x) Uri##x##W
+
+
+
+#undef URI_STRLEN
+#define URI_STRLEN wcslen
+#undef URI_STRCPY
+#define URI_STRCPY wcscpy
+#undef URI_STRCMP
+#define URI_STRCMP wcscmp
+#undef URI_STRNCMP
+#define URI_STRNCMP wcsncmp
+
+/* TODO Remove on next source-compatibility break */
+#undef URI_SNPRINTF
+#if (defined(__WIN32__) || defined(_WIN32) || defined(WIN32))
+# define URI_SNPRINTF _snwprintf
+#else
+# define URI_SNPRINTF swprintf
+#endif
diff --git a/contrib/restricted/uriparser/include/uriparser/UriIp4.h b/contrib/restricted/uriparser/include/uriparser/UriIp4.h
index c2e59a6bf2..4f76151ced 100644
--- a/contrib/restricted/uriparser/include/uriparser/UriIp4.h
+++ b/contrib/restricted/uriparser/include/uriparser/UriIp4.h
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,50 +31,50 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file UriIp4.h
- * Holds the IPv4 parser interface.
- * NOTE: This header includes itself twice.
- */
-
-#if (defined(URI_PASS_ANSI) && !defined(URI_IP4_TWICE_H_ANSI)) \
- || (defined(URI_PASS_UNICODE) && !defined(URI_IP4_TWICE_H_UNICODE)) \
- || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* What encodings are enabled? */
-#include "UriDefsConfig.h"
-#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* Include SELF twice */
-# ifdef URI_ENABLE_ANSI
-# define URI_PASS_ANSI 1
-# include "UriIp4.h"
-# undef URI_PASS_ANSI
-# endif
-# ifdef URI_ENABLE_UNICODE
-# define URI_PASS_UNICODE 1
-# include "UriIp4.h"
-# undef URI_PASS_UNICODE
-# endif
-/* Only one pass for each encoding */
-#elif (defined(URI_PASS_ANSI) && !defined(URI_IP4_TWICE_H_ANSI) \
- && defined(URI_ENABLE_ANSI)) || (defined(URI_PASS_UNICODE) \
- && !defined(URI_IP4_TWICE_H_UNICODE) && defined(URI_ENABLE_UNICODE))
-# ifdef URI_PASS_ANSI
-# define URI_IP4_TWICE_H_ANSI 1
-# include "UriDefsAnsi.h"
-# else
-# define URI_IP4_TWICE_H_UNICODE 1
-# include "UriDefsUnicode.h"
-# include <wchar.h>
-# endif
-
-
-
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file UriIp4.h
+ * Holds the IPv4 parser interface.
+ * NOTE: This header includes itself twice.
+ */
+
+#if (defined(URI_PASS_ANSI) && !defined(URI_IP4_TWICE_H_ANSI)) \
+ || (defined(URI_PASS_UNICODE) && !defined(URI_IP4_TWICE_H_UNICODE)) \
+ || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* What encodings are enabled? */
+#include "UriDefsConfig.h"
+#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* Include SELF twice */
+# ifdef URI_ENABLE_ANSI
+# define URI_PASS_ANSI 1
+# include "UriIp4.h"
+# undef URI_PASS_ANSI
+# endif
+# ifdef URI_ENABLE_UNICODE
+# define URI_PASS_UNICODE 1
+# include "UriIp4.h"
+# undef URI_PASS_UNICODE
+# endif
+/* Only one pass for each encoding */
+#elif (defined(URI_PASS_ANSI) && !defined(URI_IP4_TWICE_H_ANSI) \
+ && defined(URI_ENABLE_ANSI)) || (defined(URI_PASS_UNICODE) \
+ && !defined(URI_IP4_TWICE_H_UNICODE) && defined(URI_ENABLE_UNICODE))
+# ifdef URI_PASS_ANSI
+# define URI_IP4_TWICE_H_ANSI 1
+# include "UriDefsAnsi.h"
+# else
+# define URI_IP4_TWICE_H_UNICODE 1
+# include "UriDefsUnicode.h"
+# include <wchar.h>
+# endif
+
+
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -87,24 +87,24 @@ extern "C" {
-/**
- * Converts a IPv4 text representation into four bytes.
- *
- * @param octetOutput Output destination
- * @param first First character of IPv4 text to parse
- * @param afterLast Position to stop parsing at
- * @return Error code or 0 on success
- */
+/**
+ * Converts a IPv4 text representation into four bytes.
+ *
+ * @param octetOutput Output destination
+ * @param first First character of IPv4 text to parse
+ * @param afterLast Position to stop parsing at
+ * @return Error code or 0 on success
+ */
URI_PUBLIC int URI_FUNC(ParseIpFourAddress)(unsigned char * octetOutput,
- const URI_CHAR * first, const URI_CHAR * afterLast);
-
-
-
+ const URI_CHAR * first, const URI_CHAR * afterLast);
+
+
+
#ifdef __cplusplus
}
-#endif
+#endif
-#endif
+#endif
#endif
diff --git a/contrib/restricted/uriparser/src/UriCommon.c b/contrib/restricted/uriparser/src/UriCommon.c
index 7ba92f2495..786e3bf522 100644
--- a/contrib/restricted/uriparser/src/UriCommon.c
+++ b/contrib/restricted/uriparser/src/UriCommon.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,113 +31,113 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* What encodings are enabled? */
-#include <uriparser/UriDefsConfig.h>
-#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* Include SELF twice */
-# ifdef URI_ENABLE_ANSI
-# define URI_PASS_ANSI 1
-# include "UriCommon.c"
-# undef URI_PASS_ANSI
-# endif
-# ifdef URI_ENABLE_UNICODE
-# define URI_PASS_UNICODE 1
-# include "UriCommon.c"
-# undef URI_PASS_UNICODE
-# endif
-#else
-# ifdef URI_PASS_ANSI
-# include <uriparser/UriDefsAnsi.h>
-# else
-# include <uriparser/UriDefsUnicode.h>
-# include <wchar.h>
-# endif
-
-
-
-#ifndef URI_DOXYGEN
-# include <uriparser/Uri.h>
-# include "UriCommon.h"
-#endif
-
-
-
-/*extern*/ const URI_CHAR * const URI_FUNC(SafeToPointTo) = _UT("X");
-/*extern*/ const URI_CHAR * const URI_FUNC(ConstPwd) = _UT(".");
-/*extern*/ const URI_CHAR * const URI_FUNC(ConstParent) = _UT("..");
-
-
-
-void URI_FUNC(ResetUri)(URI_TYPE(Uri) * uri) {
- if (uri == NULL) {
- return;
- }
- memset(uri, 0, sizeof(URI_TYPE(Uri)));
-}
-
-
-
-/* Compares two text ranges for equal text content */
-int URI_FUNC(CompareRange)(
- const URI_TYPE(TextRange) * a,
- const URI_TYPE(TextRange) * b) {
- int diff;
-
- /* NOTE: Both NULL means equal! */
- if ((a == NULL) || (b == NULL)) {
- return ((a == NULL) ? 0 : 1) - ((b == NULL) ? 0 : 1);
- }
-
- /* NOTE: Both NULL means equal! */
- if ((a->first == NULL) || (b->first == NULL)) {
- return ((a->first == NULL) ? 0 : 1) - ((b->first == NULL) ? 0 : 1);
- }
-
- diff = ((int)(a->afterLast - a->first) - (int)(b->afterLast - b->first));
- if (diff > 0) {
- return 1;
- } else if (diff < 0) {
- return -1;
- }
-
- diff = URI_STRNCMP(a->first, b->first, (a->afterLast - a->first));
-
- if (diff > 0) {
- return 1;
- } else if (diff < 0) {
- return -1;
- }
-
- return diff;
-}
-
-
-
-UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
- UriBool relative, UriBool pathOwned, UriMemoryManager * memory) {
- URI_TYPE(PathSegment) * walker;
- if ((uri == NULL) || (uri->pathHead == NULL)) {
- return URI_TRUE;
- }
-
- walker = uri->pathHead;
- walker->reserved = NULL; /* Prev pointer */
- do {
- UriBool removeSegment = URI_FALSE;
- int len = (int)(walker->text.afterLast - walker->text.first);
- switch (len) {
- case 1:
- if ((walker->text.first)[0] == _UT('.')) {
- /* "." segment -> remove if not essential */
- URI_TYPE(PathSegment) * const prev = walker->reserved;
- URI_TYPE(PathSegment) * const nextBackup = walker->next;
-
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* What encodings are enabled? */
+#include <uriparser/UriDefsConfig.h>
+#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* Include SELF twice */
+# ifdef URI_ENABLE_ANSI
+# define URI_PASS_ANSI 1
+# include "UriCommon.c"
+# undef URI_PASS_ANSI
+# endif
+# ifdef URI_ENABLE_UNICODE
+# define URI_PASS_UNICODE 1
+# include "UriCommon.c"
+# undef URI_PASS_UNICODE
+# endif
+#else
+# ifdef URI_PASS_ANSI
+# include <uriparser/UriDefsAnsi.h>
+# else
+# include <uriparser/UriDefsUnicode.h>
+# include <wchar.h>
+# endif
+
+
+
+#ifndef URI_DOXYGEN
+# include <uriparser/Uri.h>
+# include "UriCommon.h"
+#endif
+
+
+
+/*extern*/ const URI_CHAR * const URI_FUNC(SafeToPointTo) = _UT("X");
+/*extern*/ const URI_CHAR * const URI_FUNC(ConstPwd) = _UT(".");
+/*extern*/ const URI_CHAR * const URI_FUNC(ConstParent) = _UT("..");
+
+
+
+void URI_FUNC(ResetUri)(URI_TYPE(Uri) * uri) {
+ if (uri == NULL) {
+ return;
+ }
+ memset(uri, 0, sizeof(URI_TYPE(Uri)));
+}
+
+
+
+/* Compares two text ranges for equal text content */
+int URI_FUNC(CompareRange)(
+ const URI_TYPE(TextRange) * a,
+ const URI_TYPE(TextRange) * b) {
+ int diff;
+
+ /* NOTE: Both NULL means equal! */
+ if ((a == NULL) || (b == NULL)) {
+ return ((a == NULL) ? 0 : 1) - ((b == NULL) ? 0 : 1);
+ }
+
+ /* NOTE: Both NULL means equal! */
+ if ((a->first == NULL) || (b->first == NULL)) {
+ return ((a->first == NULL) ? 0 : 1) - ((b->first == NULL) ? 0 : 1);
+ }
+
+ diff = ((int)(a->afterLast - a->first) - (int)(b->afterLast - b->first));
+ if (diff > 0) {
+ return 1;
+ } else if (diff < 0) {
+ return -1;
+ }
+
+ diff = URI_STRNCMP(a->first, b->first, (a->afterLast - a->first));
+
+ if (diff > 0) {
+ return 1;
+ } else if (diff < 0) {
+ return -1;
+ }
+
+ return diff;
+}
+
+
+
+UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
+ UriBool relative, UriBool pathOwned, UriMemoryManager * memory) {
+ URI_TYPE(PathSegment) * walker;
+ if ((uri == NULL) || (uri->pathHead == NULL)) {
+ return URI_TRUE;
+ }
+
+ walker = uri->pathHead;
+ walker->reserved = NULL; /* Prev pointer */
+ do {
+ UriBool removeSegment = URI_FALSE;
+ int len = (int)(walker->text.afterLast - walker->text.first);
+ switch (len) {
+ case 1:
+ if ((walker->text.first)[0] == _UT('.')) {
+ /* "." segment -> remove if not essential */
+ URI_TYPE(PathSegment) * const prev = walker->reserved;
+ URI_TYPE(PathSegment) * const nextBackup = walker->next;
+
/*
* Is this dot segment essential,
* i.e. is there a chance of changing semantics by dropping this dot segment?
@@ -145,179 +145,179 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
* For example, changing "./http://foo" into "http://foo" would change semantics
* and hence the dot segment is essential to that case and cannot be removed.
*/
- removeSegment = URI_TRUE;
- if (relative && (walker == uri->pathHead) && (walker->next != NULL)) {
- const URI_CHAR * ch = walker->next->text.first;
- for (; ch < walker->next->text.afterLast; ch++) {
- if (*ch == _UT(':')) {
- removeSegment = URI_FALSE;
- break;
- }
- }
- }
-
- if (removeSegment) {
+ removeSegment = URI_TRUE;
+ if (relative && (walker == uri->pathHead) && (walker->next != NULL)) {
+ const URI_CHAR * ch = walker->next->text.first;
+ for (; ch < walker->next->text.afterLast; ch++) {
+ if (*ch == _UT(':')) {
+ removeSegment = URI_FALSE;
+ break;
+ }
+ }
+ }
+
+ if (removeSegment) {
/* .. then let's go remove that segment. */
- /* Last segment? */
- if (walker->next != NULL) {
+ /* Last segment? */
+ if (walker->next != NULL) {
/* Not last segment, i.e. first or middle segment
* OLD: (prev|NULL) <- walker <- next
* NEW: (prev|NULL) <----------- next */
- walker->next->reserved = prev;
-
- if (prev == NULL) {
+ walker->next->reserved = prev;
+
+ if (prev == NULL) {
/* First but not last segment
* OLD: head -> walker -> next
* NEW: head -----------> next */
- uri->pathHead = walker->next;
- } else {
+ uri->pathHead = walker->next;
+ } else {
/* Middle segment
* OLD: prev -> walker -> next
* NEW: prev -----------> next */
- prev->next = walker->next;
- }
-
- if (pathOwned && (walker->text.first != walker->text.afterLast)) {
- memory->free(memory, (URI_CHAR *)walker->text.first);
- }
- memory->free(memory, walker);
- } else {
- /* Last segment */
- if (pathOwned && (walker->text.first != walker->text.afterLast)) {
- memory->free(memory, (URI_CHAR *)walker->text.first);
- }
-
- if (prev == NULL) {
- /* Last and first */
- if (URI_FUNC(IsHostSet)(uri)) {
- /* Replace "." with empty segment to represent trailing slash */
- walker->text.first = URI_FUNC(SafeToPointTo);
- walker->text.afterLast = URI_FUNC(SafeToPointTo);
- } else {
- memory->free(memory, walker);
-
- uri->pathHead = NULL;
- uri->pathTail = NULL;
- }
- } else {
- /* Last but not first, replace "." with empty segment to represent trailing slash */
- walker->text.first = URI_FUNC(SafeToPointTo);
- walker->text.afterLast = URI_FUNC(SafeToPointTo);
- }
- }
-
- walker = nextBackup;
- }
- }
- break;
-
- case 2:
- if (((walker->text.first)[0] == _UT('.'))
- && ((walker->text.first)[1] == _UT('.'))) {
- /* Path ".." -> remove this and the previous segment */
- URI_TYPE(PathSegment) * const prev = walker->reserved;
- URI_TYPE(PathSegment) * prevPrev;
- URI_TYPE(PathSegment) * const nextBackup = walker->next;
-
- removeSegment = URI_TRUE;
- if (relative) {
- if (prev == NULL) {
+ prev->next = walker->next;
+ }
+
+ if (pathOwned && (walker->text.first != walker->text.afterLast)) {
+ memory->free(memory, (URI_CHAR *)walker->text.first);
+ }
+ memory->free(memory, walker);
+ } else {
+ /* Last segment */
+ if (pathOwned && (walker->text.first != walker->text.afterLast)) {
+ memory->free(memory, (URI_CHAR *)walker->text.first);
+ }
+
+ if (prev == NULL) {
+ /* Last and first */
+ if (URI_FUNC(IsHostSet)(uri)) {
+ /* Replace "." with empty segment to represent trailing slash */
+ walker->text.first = URI_FUNC(SafeToPointTo);
+ walker->text.afterLast = URI_FUNC(SafeToPointTo);
+ } else {
+ memory->free(memory, walker);
+
+ uri->pathHead = NULL;
+ uri->pathTail = NULL;
+ }
+ } else {
+ /* Last but not first, replace "." with empty segment to represent trailing slash */
+ walker->text.first = URI_FUNC(SafeToPointTo);
+ walker->text.afterLast = URI_FUNC(SafeToPointTo);
+ }
+ }
+
+ walker = nextBackup;
+ }
+ }
+ break;
+
+ case 2:
+ if (((walker->text.first)[0] == _UT('.'))
+ && ((walker->text.first)[1] == _UT('.'))) {
+ /* Path ".." -> remove this and the previous segment */
+ URI_TYPE(PathSegment) * const prev = walker->reserved;
+ URI_TYPE(PathSegment) * prevPrev;
+ URI_TYPE(PathSegment) * const nextBackup = walker->next;
+
+ removeSegment = URI_TRUE;
+ if (relative) {
+ if (prev == NULL) {
/* We cannot remove traversal beyond because the
* URI is relative and may be resolved later.
* So we can simplify "a/../b/d" to "b/d" but
* we cannot simplify "../b/d" (outside of reference resolution). */
- removeSegment = URI_FALSE;
- } else if ((prev != NULL)
- && ((prev->text.afterLast - prev->text.first) == 2)
- && ((prev->text.first)[0] == _UT('.'))
- && ((prev->text.first)[1] == _UT('.'))) {
+ removeSegment = URI_FALSE;
+ } else if ((prev != NULL)
+ && ((prev->text.afterLast - prev->text.first) == 2)
+ && ((prev->text.first)[0] == _UT('.'))
+ && ((prev->text.first)[1] == _UT('.'))) {
/* We need to protect against mis-simplifying "a/../../b" to "a/b". */
- removeSegment = URI_FALSE;
- }
- }
-
- if (removeSegment) {
- if (prev != NULL) {
- /* Not first segment */
- prevPrev = prev->reserved;
- if (prevPrev != NULL) {
+ removeSegment = URI_FALSE;
+ }
+ }
+
+ if (removeSegment) {
+ if (prev != NULL) {
+ /* Not first segment */
+ prevPrev = prev->reserved;
+ if (prevPrev != NULL) {
/* Not even prev is the first one
* OLD: prevPrev -> prev -> walker -> (next|NULL)
* NEW: prevPrev -------------------> (next|NULL) */
- prevPrev->next = walker->next;
- if (walker->next != NULL) {
+ prevPrev->next = walker->next;
+ if (walker->next != NULL) {
/* Update parent relationship as well
* OLD: prevPrev <- prev <- walker <- next
* NEW: prevPrev <------------------- next */
- walker->next->reserved = prevPrev;
- } else {
- /* Last segment -> insert "" segment to represent trailing slash, update tail */
- URI_TYPE(PathSegment) * const segment = memory->calloc(memory, 1, sizeof(URI_TYPE(PathSegment)));
- if (segment == NULL) {
- if (pathOwned && (walker->text.first != walker->text.afterLast)) {
- memory->free(memory, (URI_CHAR *)walker->text.first);
- }
- memory->free(memory, walker);
-
- if (pathOwned && (prev->text.first != prev->text.afterLast)) {
- memory->free(memory, (URI_CHAR *)prev->text.first);
- }
- memory->free(memory, prev);
-
- return URI_FALSE; /* Raises malloc error */
- }
- segment->text.first = URI_FUNC(SafeToPointTo);
- segment->text.afterLast = URI_FUNC(SafeToPointTo);
- prevPrev->next = segment;
- uri->pathTail = segment;
- }
-
- if (pathOwned && (walker->text.first != walker->text.afterLast)) {
- memory->free(memory, (URI_CHAR *)walker->text.first);
- }
- memory->free(memory, walker);
-
- if (pathOwned && (prev->text.first != prev->text.afterLast)) {
- memory->free(memory, (URI_CHAR *)prev->text.first);
- }
- memory->free(memory, prev);
-
- walker = nextBackup;
- } else {
- /* Prev is the first segment */
- if (walker->next != NULL) {
- uri->pathHead = walker->next;
- walker->next->reserved = NULL;
-
- if (pathOwned && (walker->text.first != walker->text.afterLast)) {
- memory->free(memory, (URI_CHAR *)walker->text.first);
- }
- memory->free(memory, walker);
- } else {
- /* Re-use segment for "" path segment to represent trailing slash, update tail */
- URI_TYPE(PathSegment) * const segment = walker;
- if (pathOwned && (segment->text.first != segment->text.afterLast)) {
- memory->free(memory, (URI_CHAR *)segment->text.first);
- }
- segment->text.first = URI_FUNC(SafeToPointTo);
- segment->text.afterLast = URI_FUNC(SafeToPointTo);
- uri->pathHead = segment;
- uri->pathTail = segment;
- }
-
- if (pathOwned && (prev->text.first != prev->text.afterLast)) {
- memory->free(memory, (URI_CHAR *)prev->text.first);
- }
- memory->free(memory, prev);
-
- walker = nextBackup;
- }
- } else {
- URI_TYPE(PathSegment) * const anotherNextBackup = walker->next;
+ walker->next->reserved = prevPrev;
+ } else {
+ /* Last segment -> insert "" segment to represent trailing slash, update tail */
+ URI_TYPE(PathSegment) * const segment = memory->calloc(memory, 1, sizeof(URI_TYPE(PathSegment)));
+ if (segment == NULL) {
+ if (pathOwned && (walker->text.first != walker->text.afterLast)) {
+ memory->free(memory, (URI_CHAR *)walker->text.first);
+ }
+ memory->free(memory, walker);
+
+ if (pathOwned && (prev->text.first != prev->text.afterLast)) {
+ memory->free(memory, (URI_CHAR *)prev->text.first);
+ }
+ memory->free(memory, prev);
+
+ return URI_FALSE; /* Raises malloc error */
+ }
+ segment->text.first = URI_FUNC(SafeToPointTo);
+ segment->text.afterLast = URI_FUNC(SafeToPointTo);
+ prevPrev->next = segment;
+ uri->pathTail = segment;
+ }
+
+ if (pathOwned && (walker->text.first != walker->text.afterLast)) {
+ memory->free(memory, (URI_CHAR *)walker->text.first);
+ }
+ memory->free(memory, walker);
+
+ if (pathOwned && (prev->text.first != prev->text.afterLast)) {
+ memory->free(memory, (URI_CHAR *)prev->text.first);
+ }
+ memory->free(memory, prev);
+
+ walker = nextBackup;
+ } else {
+ /* Prev is the first segment */
+ if (walker->next != NULL) {
+ uri->pathHead = walker->next;
+ walker->next->reserved = NULL;
+
+ if (pathOwned && (walker->text.first != walker->text.afterLast)) {
+ memory->free(memory, (URI_CHAR *)walker->text.first);
+ }
+ memory->free(memory, walker);
+ } else {
+ /* Re-use segment for "" path segment to represent trailing slash, update tail */
+ URI_TYPE(PathSegment) * const segment = walker;
+ if (pathOwned && (segment->text.first != segment->text.afterLast)) {
+ memory->free(memory, (URI_CHAR *)segment->text.first);
+ }
+ segment->text.first = URI_FUNC(SafeToPointTo);
+ segment->text.afterLast = URI_FUNC(SafeToPointTo);
+ uri->pathHead = segment;
+ uri->pathTail = segment;
+ }
+
+ if (pathOwned && (prev->text.first != prev->text.afterLast)) {
+ memory->free(memory, (URI_CHAR *)prev->text.first);
+ }
+ memory->free(memory, prev);
+
+ walker = nextBackup;
+ }
+ } else {
+ URI_TYPE(PathSegment) * const anotherNextBackup = walker->next;
int freeWalker = URI_TRUE;
/* First segment */
- if (walker->next != NULL) {
+ if (walker->next != NULL) {
/* First segment of multiple -> update head
* OLD: head -> walker -> next
* NEW: head -----------> next */
@@ -326,8 +326,8 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
/* Update parent link as well
* OLD: head <- walker <- next
* NEW: head <----------- next */
- walker->next->reserved = NULL;
- } else {
+ walker->next->reserved = NULL;
+ } else {
if (uri->absolutePath) {
/* First and only segment -> update head
* OLD: head -> walker -> NULL
@@ -348,269 +348,269 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
walker->text.afterLast = URI_FUNC(SafeToPointTo);
freeWalker = URI_FALSE;
}
- }
-
+ }
+
if (freeWalker) {
if (pathOwned && (walker->text.first != walker->text.afterLast)) {
memory->free(memory, (URI_CHAR *)walker->text.first);
}
memory->free(memory, walker);
- }
-
- walker = anotherNextBackup;
- }
- }
- }
- break;
+ }
+
+ walker = anotherNextBackup;
+ }
+ }
+ }
+ break;
} /* end of switch */
-
- if (!removeSegment) {
+
+ if (!removeSegment) {
/* .. then let's move to the next element, and start again. */
- if (walker->next != NULL) {
- walker->next->reserved = walker;
- } else {
- /* Last segment -> update tail */
- uri->pathTail = walker;
- }
- walker = walker->next;
- }
- } while (walker != NULL);
-
- return URI_TRUE;
-}
-
-
-
-/* Properly removes "." and ".." path segments */
-UriBool URI_FUNC(RemoveDotSegmentsAbsolute)(URI_TYPE(Uri) * uri,
- UriMemoryManager * memory) {
- const UriBool ABSOLUTE = URI_FALSE;
+ if (walker->next != NULL) {
+ walker->next->reserved = walker;
+ } else {
+ /* Last segment -> update tail */
+ uri->pathTail = walker;
+ }
+ walker = walker->next;
+ }
+ } while (walker != NULL);
+
+ return URI_TRUE;
+}
+
+
+
+/* Properly removes "." and ".." path segments */
+UriBool URI_FUNC(RemoveDotSegmentsAbsolute)(URI_TYPE(Uri) * uri,
+ UriMemoryManager * memory) {
+ const UriBool ABSOLUTE = URI_FALSE;
if (uri == NULL) {
return URI_TRUE;
}
return URI_FUNC(RemoveDotSegmentsEx)(uri, ABSOLUTE, uri->owner, memory);
-}
-
-
-
-unsigned char URI_FUNC(HexdigToInt)(URI_CHAR hexdig) {
- switch (hexdig) {
- case _UT('0'):
- case _UT('1'):
- case _UT('2'):
- case _UT('3'):
- case _UT('4'):
- case _UT('5'):
- case _UT('6'):
- case _UT('7'):
- case _UT('8'):
- case _UT('9'):
- return (unsigned char)(9 + hexdig - _UT('9'));
-
- case _UT('a'):
- case _UT('b'):
- case _UT('c'):
- case _UT('d'):
- case _UT('e'):
- case _UT('f'):
- return (unsigned char)(15 + hexdig - _UT('f'));
-
- case _UT('A'):
- case _UT('B'):
- case _UT('C'):
- case _UT('D'):
- case _UT('E'):
- case _UT('F'):
- return (unsigned char)(15 + hexdig - _UT('F'));
-
- default:
- return 0;
- }
-}
-
-
-
-URI_CHAR URI_FUNC(HexToLetter)(unsigned int value) {
- /* Uppercase recommended in section 2.1. of RFC 3986 *
- * http://tools.ietf.org/html/rfc3986#section-2.1 */
- return URI_FUNC(HexToLetterEx)(value, URI_TRUE);
-}
-
-
-
-URI_CHAR URI_FUNC(HexToLetterEx)(unsigned int value, UriBool uppercase) {
- switch (value) {
- case 0: return _UT('0');
- case 1: return _UT('1');
- case 2: return _UT('2');
- case 3: return _UT('3');
- case 4: return _UT('4');
- case 5: return _UT('5');
- case 6: return _UT('6');
- case 7: return _UT('7');
- case 8: return _UT('8');
- case 9: return _UT('9');
-
- case 10: return (uppercase == URI_TRUE) ? _UT('A') : _UT('a');
- case 11: return (uppercase == URI_TRUE) ? _UT('B') : _UT('b');
- case 12: return (uppercase == URI_TRUE) ? _UT('C') : _UT('c');
- case 13: return (uppercase == URI_TRUE) ? _UT('D') : _UT('d');
- case 14: return (uppercase == URI_TRUE) ? _UT('E') : _UT('e');
- default: return (uppercase == URI_TRUE) ? _UT('F') : _UT('f');
- }
-}
-
-
-
-/* Checks if a URI has the host component set. */
-UriBool URI_FUNC(IsHostSet)(const URI_TYPE(Uri) * uri) {
- return (uri != NULL)
- && ((uri->hostText.first != NULL)
- || (uri->hostData.ip4 != NULL)
- || (uri->hostData.ip6 != NULL)
- || (uri->hostData.ipFuture.first != NULL)
- );
-}
-
-
-
-/* Copies the path segment list from one URI to another. */
-UriBool URI_FUNC(CopyPath)(URI_TYPE(Uri) * dest,
- const URI_TYPE(Uri) * source, UriMemoryManager * memory) {
- if (source->pathHead == NULL) {
- /* No path component */
- dest->pathHead = NULL;
- dest->pathTail = NULL;
- } else {
- /* Copy list but not the text contained */
- URI_TYPE(PathSegment) * sourceWalker = source->pathHead;
- URI_TYPE(PathSegment) * destPrev = NULL;
- do {
- URI_TYPE(PathSegment) * cur = memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
- if (cur == NULL) {
- /* Fix broken list */
- if (destPrev != NULL) {
- destPrev->next = NULL;
- }
- return URI_FALSE; /* Raises malloc error */
- }
-
- /* From this functions usage we know that *
- * the dest URI cannot be uri->owner */
- cur->text = sourceWalker->text;
- if (destPrev == NULL) {
- /* First segment ever */
- dest->pathHead = cur;
- } else {
- destPrev->next = cur;
- }
- destPrev = cur;
- sourceWalker = sourceWalker->next;
- } while (sourceWalker != NULL);
- dest->pathTail = destPrev;
- dest->pathTail->next = NULL;
- }
-
- dest->absolutePath = source->absolutePath;
- return URI_TRUE;
-}
-
-
-
-/* Copies the authority part of an URI over to another. */
-UriBool URI_FUNC(CopyAuthority)(URI_TYPE(Uri) * dest,
- const URI_TYPE(Uri) * source, UriMemoryManager * memory) {
- /* From this functions usage we know that *
- * the dest URI cannot be uri->owner */
-
- /* Copy userInfo */
- dest->userInfo = source->userInfo;
-
- /* Copy hostText */
- dest->hostText = source->hostText;
-
- /* Copy hostData */
- if (source->hostData.ip4 != NULL) {
- dest->hostData.ip4 = memory->malloc(memory, sizeof(UriIp4));
- if (dest->hostData.ip4 == NULL) {
- return URI_FALSE; /* Raises malloc error */
- }
- *(dest->hostData.ip4) = *(source->hostData.ip4);
- dest->hostData.ip6 = NULL;
- dest->hostData.ipFuture.first = NULL;
- dest->hostData.ipFuture.afterLast = NULL;
- } else if (source->hostData.ip6 != NULL) {
- dest->hostData.ip4 = NULL;
- dest->hostData.ip6 = memory->malloc(memory, sizeof(UriIp6));
- if (dest->hostData.ip6 == NULL) {
- return URI_FALSE; /* Raises malloc error */
- }
- *(dest->hostData.ip6) = *(source->hostData.ip6);
- dest->hostData.ipFuture.first = NULL;
- dest->hostData.ipFuture.afterLast = NULL;
- } else {
- dest->hostData.ip4 = NULL;
- dest->hostData.ip6 = NULL;
- dest->hostData.ipFuture = source->hostData.ipFuture;
- }
-
- /* Copy portText */
- dest->portText = source->portText;
-
- return URI_TRUE;
-}
-
-
-
-UriBool URI_FUNC(FixAmbiguity)(URI_TYPE(Uri) * uri,
- UriMemoryManager * memory) {
- URI_TYPE(PathSegment) * segment;
-
- if ( /* Case 1: absolute path, empty first segment */
- (uri->absolutePath
- && (uri->pathHead != NULL)
- && (uri->pathHead->text.afterLast == uri->pathHead->text.first))
-
- /* Case 2: relative path, empty first and second segment */
- || (!uri->absolutePath
- && (uri->pathHead != NULL)
- && (uri->pathHead->next != NULL)
- && (uri->pathHead->text.afterLast == uri->pathHead->text.first)
- && (uri->pathHead->next->text.afterLast == uri->pathHead->next->text.first))) {
- /* NOOP */
- } else {
- return URI_TRUE;
- }
-
- segment = memory->malloc(memory, 1 * sizeof(URI_TYPE(PathSegment)));
- if (segment == NULL) {
- return URI_FALSE; /* Raises malloc error */
- }
-
- /* Insert "." segment in front */
- segment->next = uri->pathHead;
- segment->text.first = URI_FUNC(ConstPwd);
- segment->text.afterLast = URI_FUNC(ConstPwd) + 1;
- uri->pathHead = segment;
- return URI_TRUE;
-}
-
-
-
-void URI_FUNC(FixEmptyTrailSegment)(URI_TYPE(Uri) * uri,
- UriMemoryManager * memory) {
- /* Fix path if only one empty segment */
- if (!uri->absolutePath
- && !URI_FUNC(IsHostSet)(uri)
- && (uri->pathHead != NULL)
- && (uri->pathHead->next == NULL)
- && (uri->pathHead->text.first == uri->pathHead->text.afterLast)) {
- memory->free(memory, uri->pathHead);
- uri->pathHead = NULL;
- uri->pathTail = NULL;
- }
-}
-
-
-
-#endif
+}
+
+
+
+unsigned char URI_FUNC(HexdigToInt)(URI_CHAR hexdig) {
+ switch (hexdig) {
+ case _UT('0'):
+ case _UT('1'):
+ case _UT('2'):
+ case _UT('3'):
+ case _UT('4'):
+ case _UT('5'):
+ case _UT('6'):
+ case _UT('7'):
+ case _UT('8'):
+ case _UT('9'):
+ return (unsigned char)(9 + hexdig - _UT('9'));
+
+ case _UT('a'):
+ case _UT('b'):
+ case _UT('c'):
+ case _UT('d'):
+ case _UT('e'):
+ case _UT('f'):
+ return (unsigned char)(15 + hexdig - _UT('f'));
+
+ case _UT('A'):
+ case _UT('B'):
+ case _UT('C'):
+ case _UT('D'):
+ case _UT('E'):
+ case _UT('F'):
+ return (unsigned char)(15 + hexdig - _UT('F'));
+
+ default:
+ return 0;
+ }
+}
+
+
+
+URI_CHAR URI_FUNC(HexToLetter)(unsigned int value) {
+ /* Uppercase recommended in section 2.1. of RFC 3986 *
+ * http://tools.ietf.org/html/rfc3986#section-2.1 */
+ return URI_FUNC(HexToLetterEx)(value, URI_TRUE);
+}
+
+
+
+URI_CHAR URI_FUNC(HexToLetterEx)(unsigned int value, UriBool uppercase) {
+ switch (value) {
+ case 0: return _UT('0');
+ case 1: return _UT('1');
+ case 2: return _UT('2');
+ case 3: return _UT('3');
+ case 4: return _UT('4');
+ case 5: return _UT('5');
+ case 6: return _UT('6');
+ case 7: return _UT('7');
+ case 8: return _UT('8');
+ case 9: return _UT('9');
+
+ case 10: return (uppercase == URI_TRUE) ? _UT('A') : _UT('a');
+ case 11: return (uppercase == URI_TRUE) ? _UT('B') : _UT('b');
+ case 12: return (uppercase == URI_TRUE) ? _UT('C') : _UT('c');
+ case 13: return (uppercase == URI_TRUE) ? _UT('D') : _UT('d');
+ case 14: return (uppercase == URI_TRUE) ? _UT('E') : _UT('e');
+ default: return (uppercase == URI_TRUE) ? _UT('F') : _UT('f');
+ }
+}
+
+
+
+/* Checks if a URI has the host component set. */
+UriBool URI_FUNC(IsHostSet)(const URI_TYPE(Uri) * uri) {
+ return (uri != NULL)
+ && ((uri->hostText.first != NULL)
+ || (uri->hostData.ip4 != NULL)
+ || (uri->hostData.ip6 != NULL)
+ || (uri->hostData.ipFuture.first != NULL)
+ );
+}
+
+
+
+/* Copies the path segment list from one URI to another. */
+UriBool URI_FUNC(CopyPath)(URI_TYPE(Uri) * dest,
+ const URI_TYPE(Uri) * source, UriMemoryManager * memory) {
+ if (source->pathHead == NULL) {
+ /* No path component */
+ dest->pathHead = NULL;
+ dest->pathTail = NULL;
+ } else {
+ /* Copy list but not the text contained */
+ URI_TYPE(PathSegment) * sourceWalker = source->pathHead;
+ URI_TYPE(PathSegment) * destPrev = NULL;
+ do {
+ URI_TYPE(PathSegment) * cur = memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
+ if (cur == NULL) {
+ /* Fix broken list */
+ if (destPrev != NULL) {
+ destPrev->next = NULL;
+ }
+ return URI_FALSE; /* Raises malloc error */
+ }
+
+ /* From this functions usage we know that *
+ * the dest URI cannot be uri->owner */
+ cur->text = sourceWalker->text;
+ if (destPrev == NULL) {
+ /* First segment ever */
+ dest->pathHead = cur;
+ } else {
+ destPrev->next = cur;
+ }
+ destPrev = cur;
+ sourceWalker = sourceWalker->next;
+ } while (sourceWalker != NULL);
+ dest->pathTail = destPrev;
+ dest->pathTail->next = NULL;
+ }
+
+ dest->absolutePath = source->absolutePath;
+ return URI_TRUE;
+}
+
+
+
+/* Copies the authority part of an URI over to another. */
+UriBool URI_FUNC(CopyAuthority)(URI_TYPE(Uri) * dest,
+ const URI_TYPE(Uri) * source, UriMemoryManager * memory) {
+ /* From this functions usage we know that *
+ * the dest URI cannot be uri->owner */
+
+ /* Copy userInfo */
+ dest->userInfo = source->userInfo;
+
+ /* Copy hostText */
+ dest->hostText = source->hostText;
+
+ /* Copy hostData */
+ if (source->hostData.ip4 != NULL) {
+ dest->hostData.ip4 = memory->malloc(memory, sizeof(UriIp4));
+ if (dest->hostData.ip4 == NULL) {
+ return URI_FALSE; /* Raises malloc error */
+ }
+ *(dest->hostData.ip4) = *(source->hostData.ip4);
+ dest->hostData.ip6 = NULL;
+ dest->hostData.ipFuture.first = NULL;
+ dest->hostData.ipFuture.afterLast = NULL;
+ } else if (source->hostData.ip6 != NULL) {
+ dest->hostData.ip4 = NULL;
+ dest->hostData.ip6 = memory->malloc(memory, sizeof(UriIp6));
+ if (dest->hostData.ip6 == NULL) {
+ return URI_FALSE; /* Raises malloc error */
+ }
+ *(dest->hostData.ip6) = *(source->hostData.ip6);
+ dest->hostData.ipFuture.first = NULL;
+ dest->hostData.ipFuture.afterLast = NULL;
+ } else {
+ dest->hostData.ip4 = NULL;
+ dest->hostData.ip6 = NULL;
+ dest->hostData.ipFuture = source->hostData.ipFuture;
+ }
+
+ /* Copy portText */
+ dest->portText = source->portText;
+
+ return URI_TRUE;
+}
+
+
+
+UriBool URI_FUNC(FixAmbiguity)(URI_TYPE(Uri) * uri,
+ UriMemoryManager * memory) {
+ URI_TYPE(PathSegment) * segment;
+
+ if ( /* Case 1: absolute path, empty first segment */
+ (uri->absolutePath
+ && (uri->pathHead != NULL)
+ && (uri->pathHead->text.afterLast == uri->pathHead->text.first))
+
+ /* Case 2: relative path, empty first and second segment */
+ || (!uri->absolutePath
+ && (uri->pathHead != NULL)
+ && (uri->pathHead->next != NULL)
+ && (uri->pathHead->text.afterLast == uri->pathHead->text.first)
+ && (uri->pathHead->next->text.afterLast == uri->pathHead->next->text.first))) {
+ /* NOOP */
+ } else {
+ return URI_TRUE;
+ }
+
+ segment = memory->malloc(memory, 1 * sizeof(URI_TYPE(PathSegment)));
+ if (segment == NULL) {
+ return URI_FALSE; /* Raises malloc error */
+ }
+
+ /* Insert "." segment in front */
+ segment->next = uri->pathHead;
+ segment->text.first = URI_FUNC(ConstPwd);
+ segment->text.afterLast = URI_FUNC(ConstPwd) + 1;
+ uri->pathHead = segment;
+ return URI_TRUE;
+}
+
+
+
+void URI_FUNC(FixEmptyTrailSegment)(URI_TYPE(Uri) * uri,
+ UriMemoryManager * memory) {
+ /* Fix path if only one empty segment */
+ if (!uri->absolutePath
+ && !URI_FUNC(IsHostSet)(uri)
+ && (uri->pathHead != NULL)
+ && (uri->pathHead->next == NULL)
+ && (uri->pathHead->text.first == uri->pathHead->text.afterLast)) {
+ memory->free(memory, uri->pathHead);
+ uri->pathHead = NULL;
+ uri->pathTail = NULL;
+ }
+}
+
+
+
+#endif
diff --git a/contrib/restricted/uriparser/src/UriCommon.h b/contrib/restricted/uriparser/src/UriCommon.h
index 42311ddc98..70afdfdf2f 100644
--- a/contrib/restricted/uriparser/src/UriCommon.h
+++ b/contrib/restricted/uriparser/src/UriCommon.h
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,77 +31,77 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if (defined(URI_PASS_ANSI) && !defined(URI_COMMON_H_ANSI)) \
- || (defined(URI_PASS_UNICODE) && !defined(URI_COMMON_H_UNICODE)) \
- || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* What encodings are enabled? */
-#include <uriparser/UriDefsConfig.h>
-#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* Include SELF twice */
-# ifdef URI_ENABLE_ANSI
-# define URI_PASS_ANSI 1
-# include "UriCommon.h"
-# undef URI_PASS_ANSI
-# endif
-# ifdef URI_ENABLE_UNICODE
-# define URI_PASS_UNICODE 1
-# include "UriCommon.h"
-# undef URI_PASS_UNICODE
-# endif
-/* Only one pass for each encoding */
-#elif (defined(URI_PASS_ANSI) && !defined(URI_COMMON_H_ANSI) \
- && defined(URI_ENABLE_ANSI)) || (defined(URI_PASS_UNICODE) \
- && !defined(URI_COMMON_H_UNICODE) && defined(URI_ENABLE_UNICODE))
-# ifdef URI_PASS_ANSI
-# define URI_COMMON_H_ANSI 1
-# include <uriparser/UriDefsAnsi.h>
-# else
-# define URI_COMMON_H_UNICODE 1
-# include <uriparser/UriDefsUnicode.h>
-# endif
-
-
-
-/* Used to point to from empty path segments.
- * X.first and X.afterLast must be the same non-NULL value then. */
-extern const URI_CHAR * const URI_FUNC(SafeToPointTo);
-extern const URI_CHAR * const URI_FUNC(ConstPwd);
-extern const URI_CHAR * const URI_FUNC(ConstParent);
-
-
-
-void URI_FUNC(ResetUri)(URI_TYPE(Uri) * uri);
-
-int URI_FUNC(CompareRange)(
- const URI_TYPE(TextRange) * a,
- const URI_TYPE(TextRange) * b);
-
-UriBool URI_FUNC(RemoveDotSegmentsAbsolute)(URI_TYPE(Uri) * uri,
- UriMemoryManager * memory);
-UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
- UriBool relative, UriBool pathOwned, UriMemoryManager * memory);
-
-unsigned char URI_FUNC(HexdigToInt)(URI_CHAR hexdig);
-URI_CHAR URI_FUNC(HexToLetter)(unsigned int value);
-URI_CHAR URI_FUNC(HexToLetterEx)(unsigned int value, UriBool uppercase);
-
-UriBool URI_FUNC(IsHostSet)(const URI_TYPE(Uri) * uri);
-
-UriBool URI_FUNC(CopyPath)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source,
- UriMemoryManager * memory);
-UriBool URI_FUNC(CopyAuthority)(URI_TYPE(Uri) * dest,
- const URI_TYPE(Uri) * source, UriMemoryManager * memory);
-
-UriBool URI_FUNC(FixAmbiguity)(URI_TYPE(Uri) * uri, UriMemoryManager * memory);
-void URI_FUNC(FixEmptyTrailSegment)(URI_TYPE(Uri) * uri,
- UriMemoryManager * memory);
-
-
-#endif
-#endif
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if (defined(URI_PASS_ANSI) && !defined(URI_COMMON_H_ANSI)) \
+ || (defined(URI_PASS_UNICODE) && !defined(URI_COMMON_H_UNICODE)) \
+ || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* What encodings are enabled? */
+#include <uriparser/UriDefsConfig.h>
+#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* Include SELF twice */
+# ifdef URI_ENABLE_ANSI
+# define URI_PASS_ANSI 1
+# include "UriCommon.h"
+# undef URI_PASS_ANSI
+# endif
+# ifdef URI_ENABLE_UNICODE
+# define URI_PASS_UNICODE 1
+# include "UriCommon.h"
+# undef URI_PASS_UNICODE
+# endif
+/* Only one pass for each encoding */
+#elif (defined(URI_PASS_ANSI) && !defined(URI_COMMON_H_ANSI) \
+ && defined(URI_ENABLE_ANSI)) || (defined(URI_PASS_UNICODE) \
+ && !defined(URI_COMMON_H_UNICODE) && defined(URI_ENABLE_UNICODE))
+# ifdef URI_PASS_ANSI
+# define URI_COMMON_H_ANSI 1
+# include <uriparser/UriDefsAnsi.h>
+# else
+# define URI_COMMON_H_UNICODE 1
+# include <uriparser/UriDefsUnicode.h>
+# endif
+
+
+
+/* Used to point to from empty path segments.
+ * X.first and X.afterLast must be the same non-NULL value then. */
+extern const URI_CHAR * const URI_FUNC(SafeToPointTo);
+extern const URI_CHAR * const URI_FUNC(ConstPwd);
+extern const URI_CHAR * const URI_FUNC(ConstParent);
+
+
+
+void URI_FUNC(ResetUri)(URI_TYPE(Uri) * uri);
+
+int URI_FUNC(CompareRange)(
+ const URI_TYPE(TextRange) * a,
+ const URI_TYPE(TextRange) * b);
+
+UriBool URI_FUNC(RemoveDotSegmentsAbsolute)(URI_TYPE(Uri) * uri,
+ UriMemoryManager * memory);
+UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
+ UriBool relative, UriBool pathOwned, UriMemoryManager * memory);
+
+unsigned char URI_FUNC(HexdigToInt)(URI_CHAR hexdig);
+URI_CHAR URI_FUNC(HexToLetter)(unsigned int value);
+URI_CHAR URI_FUNC(HexToLetterEx)(unsigned int value, UriBool uppercase);
+
+UriBool URI_FUNC(IsHostSet)(const URI_TYPE(Uri) * uri);
+
+UriBool URI_FUNC(CopyPath)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source,
+ UriMemoryManager * memory);
+UriBool URI_FUNC(CopyAuthority)(URI_TYPE(Uri) * dest,
+ const URI_TYPE(Uri) * source, UriMemoryManager * memory);
+
+UriBool URI_FUNC(FixAmbiguity)(URI_TYPE(Uri) * uri, UriMemoryManager * memory);
+void URI_FUNC(FixEmptyTrailSegment)(URI_TYPE(Uri) * uri,
+ UriMemoryManager * memory);
+
+
+#endif
+#endif
diff --git a/contrib/restricted/uriparser/src/UriCompare.c b/contrib/restricted/uriparser/src/UriCompare.c
index bca3db9236..2d23bf59fe 100644
--- a/contrib/restricted/uriparser/src/UriCompare.c
+++ b/contrib/restricted/uriparser/src/UriCompare.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,138 +31,138 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* What encodings are enabled? */
-#include <uriparser/UriDefsConfig.h>
-#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* Include SELF twice */
-# ifdef URI_ENABLE_ANSI
-# define URI_PASS_ANSI 1
-# include "UriCompare.c"
-# undef URI_PASS_ANSI
-# endif
-# ifdef URI_ENABLE_UNICODE
-# define URI_PASS_UNICODE 1
-# include "UriCompare.c"
-# undef URI_PASS_UNICODE
-# endif
-#else
-# ifdef URI_PASS_ANSI
-# include <uriparser/UriDefsAnsi.h>
-# else
-# include <uriparser/UriDefsUnicode.h>
-# include <wchar.h>
-# endif
-
-
-
-#ifndef URI_DOXYGEN
-# include <uriparser/Uri.h>
-# include <uriparser/UriIp4.h>
-# include "UriCommon.h"
-#endif
-
-
-
-UriBool URI_FUNC(EqualsUri)(const URI_TYPE(Uri) * a,
- const URI_TYPE(Uri) * b) {
- /* NOTE: Both NULL means equal! */
- if ((a == NULL) || (b == NULL)) {
- return ((a == NULL) && (b == NULL)) ? URI_TRUE : URI_FALSE;
- }
-
- /* scheme */
- if (URI_FUNC(CompareRange)(&(a->scheme), &(b->scheme))) {
- return URI_FALSE;
- }
-
- /* absolutePath */
- if ((a->scheme.first == NULL)&& (a->absolutePath != b->absolutePath)) {
- return URI_FALSE;
- }
-
- /* userInfo */
- if (URI_FUNC(CompareRange)(&(a->userInfo), &(b->userInfo))) {
- return URI_FALSE;
- }
-
- /* Host */
- if (((a->hostData.ip4 == NULL) != (b->hostData.ip4 == NULL))
- || ((a->hostData.ip6 == NULL) != (b->hostData.ip6 == NULL))
- || ((a->hostData.ipFuture.first == NULL)
- != (b->hostData.ipFuture.first == NULL))) {
- return URI_FALSE;
- }
-
- if (a->hostData.ip4 != NULL) {
- if (memcmp(a->hostData.ip4->data, b->hostData.ip4->data, 4)) {
- return URI_FALSE;
- }
- }
-
- if (a->hostData.ip6 != NULL) {
- if (memcmp(a->hostData.ip6->data, b->hostData.ip6->data, 16)) {
- return URI_FALSE;
- }
- }
-
- if (a->hostData.ipFuture.first != NULL) {
- if (URI_FUNC(CompareRange)(&(a->hostData.ipFuture), &(b->hostData.ipFuture))) {
- return URI_FALSE;
- }
- }
-
- if ((a->hostData.ip4 == NULL)
- && (a->hostData.ip6 == NULL)
- && (a->hostData.ipFuture.first == NULL)) {
- if (URI_FUNC(CompareRange)(&(a->hostText), &(b->hostText))) {
- return URI_FALSE;
- }
- }
-
- /* portText */
- if (URI_FUNC(CompareRange)(&(a->portText), &(b->portText))) {
- return URI_FALSE;
- }
-
- /* Path */
- if ((a->pathHead == NULL) != (b->pathHead == NULL)) {
- return URI_FALSE;
- }
-
- if (a->pathHead != NULL) {
- URI_TYPE(PathSegment) * walkA = a->pathHead;
- URI_TYPE(PathSegment) * walkB = b->pathHead;
- do {
- if (URI_FUNC(CompareRange)(&(walkA->text), &(walkB->text))) {
- return URI_FALSE;
- }
- if ((walkA->next == NULL) != (walkB->next == NULL)) {
- return URI_FALSE;
- }
- walkA = walkA->next;
- walkB = walkB->next;
- } while (walkA != NULL);
- }
-
- /* query */
- if (URI_FUNC(CompareRange)(&(a->query), &(b->query))) {
- return URI_FALSE;
- }
-
- /* fragment */
- if (URI_FUNC(CompareRange)(&(a->fragment), &(b->fragment))) {
- return URI_FALSE;
- }
-
- return URI_TRUE; /* Equal*/
-}
-
-
-
-#endif
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* What encodings are enabled? */
+#include <uriparser/UriDefsConfig.h>
+#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* Include SELF twice */
+# ifdef URI_ENABLE_ANSI
+# define URI_PASS_ANSI 1
+# include "UriCompare.c"
+# undef URI_PASS_ANSI
+# endif
+# ifdef URI_ENABLE_UNICODE
+# define URI_PASS_UNICODE 1
+# include "UriCompare.c"
+# undef URI_PASS_UNICODE
+# endif
+#else
+# ifdef URI_PASS_ANSI
+# include <uriparser/UriDefsAnsi.h>
+# else
+# include <uriparser/UriDefsUnicode.h>
+# include <wchar.h>
+# endif
+
+
+
+#ifndef URI_DOXYGEN
+# include <uriparser/Uri.h>
+# include <uriparser/UriIp4.h>
+# include "UriCommon.h"
+#endif
+
+
+
+UriBool URI_FUNC(EqualsUri)(const URI_TYPE(Uri) * a,
+ const URI_TYPE(Uri) * b) {
+ /* NOTE: Both NULL means equal! */
+ if ((a == NULL) || (b == NULL)) {
+ return ((a == NULL) && (b == NULL)) ? URI_TRUE : URI_FALSE;
+ }
+
+ /* scheme */
+ if (URI_FUNC(CompareRange)(&(a->scheme), &(b->scheme))) {
+ return URI_FALSE;
+ }
+
+ /* absolutePath */
+ if ((a->scheme.first == NULL)&& (a->absolutePath != b->absolutePath)) {
+ return URI_FALSE;
+ }
+
+ /* userInfo */
+ if (URI_FUNC(CompareRange)(&(a->userInfo), &(b->userInfo))) {
+ return URI_FALSE;
+ }
+
+ /* Host */
+ if (((a->hostData.ip4 == NULL) != (b->hostData.ip4 == NULL))
+ || ((a->hostData.ip6 == NULL) != (b->hostData.ip6 == NULL))
+ || ((a->hostData.ipFuture.first == NULL)
+ != (b->hostData.ipFuture.first == NULL))) {
+ return URI_FALSE;
+ }
+
+ if (a->hostData.ip4 != NULL) {
+ if (memcmp(a->hostData.ip4->data, b->hostData.ip4->data, 4)) {
+ return URI_FALSE;
+ }
+ }
+
+ if (a->hostData.ip6 != NULL) {
+ if (memcmp(a->hostData.ip6->data, b->hostData.ip6->data, 16)) {
+ return URI_FALSE;
+ }
+ }
+
+ if (a->hostData.ipFuture.first != NULL) {
+ if (URI_FUNC(CompareRange)(&(a->hostData.ipFuture), &(b->hostData.ipFuture))) {
+ return URI_FALSE;
+ }
+ }
+
+ if ((a->hostData.ip4 == NULL)
+ && (a->hostData.ip6 == NULL)
+ && (a->hostData.ipFuture.first == NULL)) {
+ if (URI_FUNC(CompareRange)(&(a->hostText), &(b->hostText))) {
+ return URI_FALSE;
+ }
+ }
+
+ /* portText */
+ if (URI_FUNC(CompareRange)(&(a->portText), &(b->portText))) {
+ return URI_FALSE;
+ }
+
+ /* Path */
+ if ((a->pathHead == NULL) != (b->pathHead == NULL)) {
+ return URI_FALSE;
+ }
+
+ if (a->pathHead != NULL) {
+ URI_TYPE(PathSegment) * walkA = a->pathHead;
+ URI_TYPE(PathSegment) * walkB = b->pathHead;
+ do {
+ if (URI_FUNC(CompareRange)(&(walkA->text), &(walkB->text))) {
+ return URI_FALSE;
+ }
+ if ((walkA->next == NULL) != (walkB->next == NULL)) {
+ return URI_FALSE;
+ }
+ walkA = walkA->next;
+ walkB = walkB->next;
+ } while (walkA != NULL);
+ }
+
+ /* query */
+ if (URI_FUNC(CompareRange)(&(a->query), &(b->query))) {
+ return URI_FALSE;
+ }
+
+ /* fragment */
+ if (URI_FUNC(CompareRange)(&(a->fragment), &(b->fragment))) {
+ return URI_FALSE;
+ }
+
+ return URI_TRUE; /* Equal*/
+}
+
+
+
+#endif
diff --git a/contrib/restricted/uriparser/src/UriEscape.c b/contrib/restricted/uriparser/src/UriEscape.c
index ab8305fa97..46ab51f4e0 100644
--- a/contrib/restricted/uriparser/src/UriEscape.c
+++ b/contrib/restricted/uriparser/src/UriEscape.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,423 +31,423 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* What encodings are enabled? */
-#include <uriparser/UriDefsConfig.h>
-#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* Include SELF twice */
-# ifdef URI_ENABLE_ANSI
-# define URI_PASS_ANSI 1
-# include "UriEscape.c"
-# undef URI_PASS_ANSI
-# endif
-# ifdef URI_ENABLE_UNICODE
-# define URI_PASS_UNICODE 1
-# include "UriEscape.c"
-# undef URI_PASS_UNICODE
-# endif
-#else
-# ifdef URI_PASS_ANSI
-# include <uriparser/UriDefsAnsi.h>
-# else
-# include <uriparser/UriDefsUnicode.h>
-# include <wchar.h>
-# endif
-
-
-
-#ifndef URI_DOXYGEN
-# include <uriparser/Uri.h>
-# include "UriCommon.h"
-#endif
-
-
-
-URI_CHAR * URI_FUNC(Escape)(const URI_CHAR * in, URI_CHAR * out,
- UriBool spaceToPlus, UriBool normalizeBreaks) {
- return URI_FUNC(EscapeEx)(in, NULL, out, spaceToPlus, normalizeBreaks);
-}
-
-
-
-URI_CHAR * URI_FUNC(EscapeEx)(const URI_CHAR * inFirst,
- const URI_CHAR * inAfterLast, URI_CHAR * out,
- UriBool spaceToPlus, UriBool normalizeBreaks) {
- const URI_CHAR * read = inFirst;
- URI_CHAR * write = out;
- UriBool prevWasCr = URI_FALSE;
- if ((out == NULL) || (inFirst == out)) {
- return NULL;
- } else if (inFirst == NULL) {
- if (out != NULL) {
- out[0] = _UT('\0');
- }
- return out;
- }
-
- for (;;) {
- if ((inAfterLast != NULL) && (read >= inAfterLast)) {
- write[0] = _UT('\0');
- return write;
- }
-
- switch (read[0]) {
- case _UT('\0'):
- write[0] = _UT('\0');
- return write;
-
- case _UT(' '):
- if (spaceToPlus) {
- write[0] = _UT('+');
- write++;
- } else {
- write[0] = _UT('%');
- write[1] = _UT('2');
- write[2] = _UT('0');
- write += 3;
- }
- prevWasCr = URI_FALSE;
- break;
-
- case _UT('a'): /* ALPHA */
- case _UT('A'):
- case _UT('b'):
- case _UT('B'):
- case _UT('c'):
- case _UT('C'):
- case _UT('d'):
- case _UT('D'):
- case _UT('e'):
- case _UT('E'):
- case _UT('f'):
- case _UT('F'):
- case _UT('g'):
- case _UT('G'):
- case _UT('h'):
- case _UT('H'):
- case _UT('i'):
- case _UT('I'):
- case _UT('j'):
- case _UT('J'):
- case _UT('k'):
- case _UT('K'):
- case _UT('l'):
- case _UT('L'):
- case _UT('m'):
- case _UT('M'):
- case _UT('n'):
- case _UT('N'):
- case _UT('o'):
- case _UT('O'):
- case _UT('p'):
- case _UT('P'):
- case _UT('q'):
- case _UT('Q'):
- case _UT('r'):
- case _UT('R'):
- case _UT('s'):
- case _UT('S'):
- case _UT('t'):
- case _UT('T'):
- case _UT('u'):
- case _UT('U'):
- case _UT('v'):
- case _UT('V'):
- case _UT('w'):
- case _UT('W'):
- case _UT('x'):
- case _UT('X'):
- case _UT('y'):
- case _UT('Y'):
- case _UT('z'):
- case _UT('Z'):
- case _UT('0'): /* DIGIT */
- case _UT('1'):
- case _UT('2'):
- case _UT('3'):
- case _UT('4'):
- case _UT('5'):
- case _UT('6'):
- case _UT('7'):
- case _UT('8'):
- case _UT('9'):
- case _UT('-'): /* "-" / "." / "_" / "~" */
- case _UT('.'):
- case _UT('_'):
- case _UT('~'):
- /* Copy unmodified */
- write[0] = read[0];
- write++;
-
- prevWasCr = URI_FALSE;
- break;
-
- case _UT('\x0a'):
- if (normalizeBreaks) {
- if (!prevWasCr) {
- write[0] = _UT('%');
- write[1] = _UT('0');
- write[2] = _UT('D');
- write[3] = _UT('%');
- write[4] = _UT('0');
- write[5] = _UT('A');
- write += 6;
- }
- } else {
- write[0] = _UT('%');
- write[1] = _UT('0');
- write[2] = _UT('A');
- write += 3;
- }
- prevWasCr = URI_FALSE;
- break;
-
- case _UT('\x0d'):
- if (normalizeBreaks) {
- write[0] = _UT('%');
- write[1] = _UT('0');
- write[2] = _UT('D');
- write[3] = _UT('%');
- write[4] = _UT('0');
- write[5] = _UT('A');
- write += 6;
- } else {
- write[0] = _UT('%');
- write[1] = _UT('0');
- write[2] = _UT('D');
- write += 3;
- }
- prevWasCr = URI_TRUE;
- break;
-
- default:
- /* Percent encode */
- {
- const unsigned char code = (unsigned char)read[0];
- write[0] = _UT('%');
- write[1] = URI_FUNC(HexToLetter)(code >> 4);
- write[2] = URI_FUNC(HexToLetter)(code & 0x0f);
- write += 3;
- }
- prevWasCr = URI_FALSE;
- break;
- }
-
- read++;
- }
-}
-
-
-
-const URI_CHAR * URI_FUNC(UnescapeInPlace)(URI_CHAR * inout) {
- return URI_FUNC(UnescapeInPlaceEx)(inout, URI_FALSE, URI_BR_DONT_TOUCH);
-}
-
-
-
-const URI_CHAR * URI_FUNC(UnescapeInPlaceEx)(URI_CHAR * inout,
- UriBool plusToSpace, UriBreakConversion breakConversion) {
- URI_CHAR * read = inout;
- URI_CHAR * write = inout;
- UriBool prevWasCr = URI_FALSE;
-
- if (inout == NULL) {
- return NULL;
- }
-
- for (;;) {
- switch (read[0]) {
- case _UT('\0'):
- if (read > write) {
- write[0] = _UT('\0');
- }
- return write;
-
- case _UT('%'):
- switch (read[1]) {
- case _UT('0'):
- case _UT('1'):
- case _UT('2'):
- case _UT('3'):
- case _UT('4'):
- case _UT('5'):
- case _UT('6'):
- case _UT('7'):
- case _UT('8'):
- case _UT('9'):
- case _UT('a'):
- case _UT('b'):
- case _UT('c'):
- case _UT('d'):
- case _UT('e'):
- case _UT('f'):
- case _UT('A'):
- case _UT('B'):
- case _UT('C'):
- case _UT('D'):
- case _UT('E'):
- case _UT('F'):
- switch (read[2]) {
- case _UT('0'):
- case _UT('1'):
- case _UT('2'):
- case _UT('3'):
- case _UT('4'):
- case _UT('5'):
- case _UT('6'):
- case _UT('7'):
- case _UT('8'):
- case _UT('9'):
- case _UT('a'):
- case _UT('b'):
- case _UT('c'):
- case _UT('d'):
- case _UT('e'):
- case _UT('f'):
- case _UT('A'):
- case _UT('B'):
- case _UT('C'):
- case _UT('D'):
- case _UT('E'):
- case _UT('F'):
- {
- /* Percent group found */
- const unsigned char left = URI_FUNC(HexdigToInt)(read[1]);
- const unsigned char right = URI_FUNC(HexdigToInt)(read[2]);
- const int code = 16 * left + right;
- switch (code) {
- case 10:
- switch (breakConversion) {
- case URI_BR_TO_LF:
- if (!prevWasCr) {
- write[0] = (URI_CHAR)10;
- write++;
- }
- break;
-
- case URI_BR_TO_CRLF:
- if (!prevWasCr) {
- write[0] = (URI_CHAR)13;
- write[1] = (URI_CHAR)10;
- write += 2;
- }
- break;
-
- case URI_BR_TO_CR:
- if (!prevWasCr) {
- write[0] = (URI_CHAR)13;
- write++;
- }
- break;
-
- case URI_BR_DONT_TOUCH:
- default:
- write[0] = (URI_CHAR)10;
- write++;
-
- }
- prevWasCr = URI_FALSE;
- break;
-
- case 13:
- switch (breakConversion) {
- case URI_BR_TO_LF:
- write[0] = (URI_CHAR)10;
- write++;
- break;
-
- case URI_BR_TO_CRLF:
- write[0] = (URI_CHAR)13;
- write[1] = (URI_CHAR)10;
- write += 2;
- break;
-
- case URI_BR_TO_CR:
- write[0] = (URI_CHAR)13;
- write++;
- break;
-
- case URI_BR_DONT_TOUCH:
- default:
- write[0] = (URI_CHAR)13;
- write++;
-
- }
- prevWasCr = URI_TRUE;
- break;
-
- default:
- write[0] = (URI_CHAR)(code);
- write++;
-
- prevWasCr = URI_FALSE;
-
- }
- read += 3;
- }
- break;
-
- default:
- /* Copy two chars unmodified and */
- /* look at this char again */
- if (read > write) {
- write[0] = read[0];
- write[1] = read[1];
- }
- read += 2;
- write += 2;
-
- prevWasCr = URI_FALSE;
- }
- break;
-
- default:
- /* Copy one char unmodified and */
- /* look at this char again */
- if (read > write) {
- write[0] = read[0];
- }
- read++;
- write++;
-
- prevWasCr = URI_FALSE;
- }
- break;
-
- case _UT('+'):
- if (plusToSpace) {
- /* Convert '+' to ' ' */
- write[0] = _UT(' ');
- } else {
- /* Copy one char unmodified */
- if (read > write) {
- write[0] = read[0];
- }
- }
- read++;
- write++;
-
- prevWasCr = URI_FALSE;
- break;
-
- default:
- /* Copy one char unmodified */
- if (read > write) {
- write[0] = read[0];
- }
- read++;
- write++;
-
- prevWasCr = URI_FALSE;
- }
- }
-}
-
-
-
-#endif
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* What encodings are enabled? */
+#include <uriparser/UriDefsConfig.h>
+#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* Include SELF twice */
+# ifdef URI_ENABLE_ANSI
+# define URI_PASS_ANSI 1
+# include "UriEscape.c"
+# undef URI_PASS_ANSI
+# endif
+# ifdef URI_ENABLE_UNICODE
+# define URI_PASS_UNICODE 1
+# include "UriEscape.c"
+# undef URI_PASS_UNICODE
+# endif
+#else
+# ifdef URI_PASS_ANSI
+# include <uriparser/UriDefsAnsi.h>
+# else
+# include <uriparser/UriDefsUnicode.h>
+# include <wchar.h>
+# endif
+
+
+
+#ifndef URI_DOXYGEN
+# include <uriparser/Uri.h>
+# include "UriCommon.h"
+#endif
+
+
+
+URI_CHAR * URI_FUNC(Escape)(const URI_CHAR * in, URI_CHAR * out,
+ UriBool spaceToPlus, UriBool normalizeBreaks) {
+ return URI_FUNC(EscapeEx)(in, NULL, out, spaceToPlus, normalizeBreaks);
+}
+
+
+
+URI_CHAR * URI_FUNC(EscapeEx)(const URI_CHAR * inFirst,
+ const URI_CHAR * inAfterLast, URI_CHAR * out,
+ UriBool spaceToPlus, UriBool normalizeBreaks) {
+ const URI_CHAR * read = inFirst;
+ URI_CHAR * write = out;
+ UriBool prevWasCr = URI_FALSE;
+ if ((out == NULL) || (inFirst == out)) {
+ return NULL;
+ } else if (inFirst == NULL) {
+ if (out != NULL) {
+ out[0] = _UT('\0');
+ }
+ return out;
+ }
+
+ for (;;) {
+ if ((inAfterLast != NULL) && (read >= inAfterLast)) {
+ write[0] = _UT('\0');
+ return write;
+ }
+
+ switch (read[0]) {
+ case _UT('\0'):
+ write[0] = _UT('\0');
+ return write;
+
+ case _UT(' '):
+ if (spaceToPlus) {
+ write[0] = _UT('+');
+ write++;
+ } else {
+ write[0] = _UT('%');
+ write[1] = _UT('2');
+ write[2] = _UT('0');
+ write += 3;
+ }
+ prevWasCr = URI_FALSE;
+ break;
+
+ case _UT('a'): /* ALPHA */
+ case _UT('A'):
+ case _UT('b'):
+ case _UT('B'):
+ case _UT('c'):
+ case _UT('C'):
+ case _UT('d'):
+ case _UT('D'):
+ case _UT('e'):
+ case _UT('E'):
+ case _UT('f'):
+ case _UT('F'):
+ case _UT('g'):
+ case _UT('G'):
+ case _UT('h'):
+ case _UT('H'):
+ case _UT('i'):
+ case _UT('I'):
+ case _UT('j'):
+ case _UT('J'):
+ case _UT('k'):
+ case _UT('K'):
+ case _UT('l'):
+ case _UT('L'):
+ case _UT('m'):
+ case _UT('M'):
+ case _UT('n'):
+ case _UT('N'):
+ case _UT('o'):
+ case _UT('O'):
+ case _UT('p'):
+ case _UT('P'):
+ case _UT('q'):
+ case _UT('Q'):
+ case _UT('r'):
+ case _UT('R'):
+ case _UT('s'):
+ case _UT('S'):
+ case _UT('t'):
+ case _UT('T'):
+ case _UT('u'):
+ case _UT('U'):
+ case _UT('v'):
+ case _UT('V'):
+ case _UT('w'):
+ case _UT('W'):
+ case _UT('x'):
+ case _UT('X'):
+ case _UT('y'):
+ case _UT('Y'):
+ case _UT('z'):
+ case _UT('Z'):
+ case _UT('0'): /* DIGIT */
+ case _UT('1'):
+ case _UT('2'):
+ case _UT('3'):
+ case _UT('4'):
+ case _UT('5'):
+ case _UT('6'):
+ case _UT('7'):
+ case _UT('8'):
+ case _UT('9'):
+ case _UT('-'): /* "-" / "." / "_" / "~" */
+ case _UT('.'):
+ case _UT('_'):
+ case _UT('~'):
+ /* Copy unmodified */
+ write[0] = read[0];
+ write++;
+
+ prevWasCr = URI_FALSE;
+ break;
+
+ case _UT('\x0a'):
+ if (normalizeBreaks) {
+ if (!prevWasCr) {
+ write[0] = _UT('%');
+ write[1] = _UT('0');
+ write[2] = _UT('D');
+ write[3] = _UT('%');
+ write[4] = _UT('0');
+ write[5] = _UT('A');
+ write += 6;
+ }
+ } else {
+ write[0] = _UT('%');
+ write[1] = _UT('0');
+ write[2] = _UT('A');
+ write += 3;
+ }
+ prevWasCr = URI_FALSE;
+ break;
+
+ case _UT('\x0d'):
+ if (normalizeBreaks) {
+ write[0] = _UT('%');
+ write[1] = _UT('0');
+ write[2] = _UT('D');
+ write[3] = _UT('%');
+ write[4] = _UT('0');
+ write[5] = _UT('A');
+ write += 6;
+ } else {
+ write[0] = _UT('%');
+ write[1] = _UT('0');
+ write[2] = _UT('D');
+ write += 3;
+ }
+ prevWasCr = URI_TRUE;
+ break;
+
+ default:
+ /* Percent encode */
+ {
+ const unsigned char code = (unsigned char)read[0];
+ write[0] = _UT('%');
+ write[1] = URI_FUNC(HexToLetter)(code >> 4);
+ write[2] = URI_FUNC(HexToLetter)(code & 0x0f);
+ write += 3;
+ }
+ prevWasCr = URI_FALSE;
+ break;
+ }
+
+ read++;
+ }
+}
+
+
+
+const URI_CHAR * URI_FUNC(UnescapeInPlace)(URI_CHAR * inout) {
+ return URI_FUNC(UnescapeInPlaceEx)(inout, URI_FALSE, URI_BR_DONT_TOUCH);
+}
+
+
+
+const URI_CHAR * URI_FUNC(UnescapeInPlaceEx)(URI_CHAR * inout,
+ UriBool plusToSpace, UriBreakConversion breakConversion) {
+ URI_CHAR * read = inout;
+ URI_CHAR * write = inout;
+ UriBool prevWasCr = URI_FALSE;
+
+ if (inout == NULL) {
+ return NULL;
+ }
+
+ for (;;) {
+ switch (read[0]) {
+ case _UT('\0'):
+ if (read > write) {
+ write[0] = _UT('\0');
+ }
+ return write;
+
+ case _UT('%'):
+ switch (read[1]) {
+ case _UT('0'):
+ case _UT('1'):
+ case _UT('2'):
+ case _UT('3'):
+ case _UT('4'):
+ case _UT('5'):
+ case _UT('6'):
+ case _UT('7'):
+ case _UT('8'):
+ case _UT('9'):
+ case _UT('a'):
+ case _UT('b'):
+ case _UT('c'):
+ case _UT('d'):
+ case _UT('e'):
+ case _UT('f'):
+ case _UT('A'):
+ case _UT('B'):
+ case _UT('C'):
+ case _UT('D'):
+ case _UT('E'):
+ case _UT('F'):
+ switch (read[2]) {
+ case _UT('0'):
+ case _UT('1'):
+ case _UT('2'):
+ case _UT('3'):
+ case _UT('4'):
+ case _UT('5'):
+ case _UT('6'):
+ case _UT('7'):
+ case _UT('8'):
+ case _UT('9'):
+ case _UT('a'):
+ case _UT('b'):
+ case _UT('c'):
+ case _UT('d'):
+ case _UT('e'):
+ case _UT('f'):
+ case _UT('A'):
+ case _UT('B'):
+ case _UT('C'):
+ case _UT('D'):
+ case _UT('E'):
+ case _UT('F'):
+ {
+ /* Percent group found */
+ const unsigned char left = URI_FUNC(HexdigToInt)(read[1]);
+ const unsigned char right = URI_FUNC(HexdigToInt)(read[2]);
+ const int code = 16 * left + right;
+ switch (code) {
+ case 10:
+ switch (breakConversion) {
+ case URI_BR_TO_LF:
+ if (!prevWasCr) {
+ write[0] = (URI_CHAR)10;
+ write++;
+ }
+ break;
+
+ case URI_BR_TO_CRLF:
+ if (!prevWasCr) {
+ write[0] = (URI_CHAR)13;
+ write[1] = (URI_CHAR)10;
+ write += 2;
+ }
+ break;
+
+ case URI_BR_TO_CR:
+ if (!prevWasCr) {
+ write[0] = (URI_CHAR)13;
+ write++;
+ }
+ break;
+
+ case URI_BR_DONT_TOUCH:
+ default:
+ write[0] = (URI_CHAR)10;
+ write++;
+
+ }
+ prevWasCr = URI_FALSE;
+ break;
+
+ case 13:
+ switch (breakConversion) {
+ case URI_BR_TO_LF:
+ write[0] = (URI_CHAR)10;
+ write++;
+ break;
+
+ case URI_BR_TO_CRLF:
+ write[0] = (URI_CHAR)13;
+ write[1] = (URI_CHAR)10;
+ write += 2;
+ break;
+
+ case URI_BR_TO_CR:
+ write[0] = (URI_CHAR)13;
+ write++;
+ break;
+
+ case URI_BR_DONT_TOUCH:
+ default:
+ write[0] = (URI_CHAR)13;
+ write++;
+
+ }
+ prevWasCr = URI_TRUE;
+ break;
+
+ default:
+ write[0] = (URI_CHAR)(code);
+ write++;
+
+ prevWasCr = URI_FALSE;
+
+ }
+ read += 3;
+ }
+ break;
+
+ default:
+ /* Copy two chars unmodified and */
+ /* look at this char again */
+ if (read > write) {
+ write[0] = read[0];
+ write[1] = read[1];
+ }
+ read += 2;
+ write += 2;
+
+ prevWasCr = URI_FALSE;
+ }
+ break;
+
+ default:
+ /* Copy one char unmodified and */
+ /* look at this char again */
+ if (read > write) {
+ write[0] = read[0];
+ }
+ read++;
+ write++;
+
+ prevWasCr = URI_FALSE;
+ }
+ break;
+
+ case _UT('+'):
+ if (plusToSpace) {
+ /* Convert '+' to ' ' */
+ write[0] = _UT(' ');
+ } else {
+ /* Copy one char unmodified */
+ if (read > write) {
+ write[0] = read[0];
+ }
+ }
+ read++;
+ write++;
+
+ prevWasCr = URI_FALSE;
+ break;
+
+ default:
+ /* Copy one char unmodified */
+ if (read > write) {
+ write[0] = read[0];
+ }
+ read++;
+ write++;
+
+ prevWasCr = URI_FALSE;
+ }
+ }
+}
+
+
+
+#endif
diff --git a/contrib/restricted/uriparser/src/UriFile.c b/contrib/restricted/uriparser/src/UriFile.c
index 232957d3c8..fc2e5b635e 100644
--- a/contrib/restricted/uriparser/src/UriFile.c
+++ b/contrib/restricted/uriparser/src/UriFile.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,212 +31,212 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* What encodings are enabled? */
-#include <uriparser/UriDefsConfig.h>
-#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* Include SELF twice */
-# ifdef URI_ENABLE_ANSI
-# define URI_PASS_ANSI 1
-# include "UriFile.c"
-# undef URI_PASS_ANSI
-# endif
-# ifdef URI_ENABLE_UNICODE
-# define URI_PASS_UNICODE 1
-# include "UriFile.c"
-# undef URI_PASS_UNICODE
-# endif
-#else
-# ifdef URI_PASS_ANSI
-# include <uriparser/UriDefsAnsi.h>
-# else
-# include <uriparser/UriDefsUnicode.h>
-# include <wchar.h>
-# endif
-
-
-
-#ifndef URI_DOXYGEN
-# include <uriparser/Uri.h>
-#endif
-
-
-
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* What encodings are enabled? */
+#include <uriparser/UriDefsConfig.h>
+#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* Include SELF twice */
+# ifdef URI_ENABLE_ANSI
+# define URI_PASS_ANSI 1
+# include "UriFile.c"
+# undef URI_PASS_ANSI
+# endif
+# ifdef URI_ENABLE_UNICODE
+# define URI_PASS_UNICODE 1
+# include "UriFile.c"
+# undef URI_PASS_UNICODE
+# endif
+#else
+# ifdef URI_PASS_ANSI
+# include <uriparser/UriDefsAnsi.h>
+# else
+# include <uriparser/UriDefsUnicode.h>
+# include <wchar.h>
+# endif
+
+
+
+#ifndef URI_DOXYGEN
+# include <uriparser/Uri.h>
+#endif
+
+
+
#include <stdlib.h> /* for size_t, avoiding stddef.h for older MSVCs */
-static URI_INLINE int URI_FUNC(FilenameToUriString)(const URI_CHAR * filename,
- URI_CHAR * uriString, UriBool fromUnix) {
- const URI_CHAR * input = filename;
- const URI_CHAR * lastSep = input - 1;
- UriBool firstSegment = URI_TRUE;
- URI_CHAR * output = uriString;
- UriBool absolute;
- UriBool is_windows_network;
-
- if ((filename == NULL) || (uriString == NULL)) {
- return URI_ERROR_NULL;
- }
-
- is_windows_network = (filename[0] == _UT('\\')) && (filename[1] == _UT('\\'));
- absolute = fromUnix
- ? (filename[0] == _UT('/'))
- : (((filename[0] != _UT('\0')) && (filename[1] == _UT(':')))
- || is_windows_network);
-
- if (absolute) {
- const URI_CHAR * const prefix = fromUnix
- ? _UT("file://")
- : is_windows_network
- ? _UT("file:")
- : _UT("file:///");
+static URI_INLINE int URI_FUNC(FilenameToUriString)(const URI_CHAR * filename,
+ URI_CHAR * uriString, UriBool fromUnix) {
+ const URI_CHAR * input = filename;
+ const URI_CHAR * lastSep = input - 1;
+ UriBool firstSegment = URI_TRUE;
+ URI_CHAR * output = uriString;
+ UriBool absolute;
+ UriBool is_windows_network;
+
+ if ((filename == NULL) || (uriString == NULL)) {
+ return URI_ERROR_NULL;
+ }
+
+ is_windows_network = (filename[0] == _UT('\\')) && (filename[1] == _UT('\\'));
+ absolute = fromUnix
+ ? (filename[0] == _UT('/'))
+ : (((filename[0] != _UT('\0')) && (filename[1] == _UT(':')))
+ || is_windows_network);
+
+ if (absolute) {
+ const URI_CHAR * const prefix = fromUnix
+ ? _UT("file://")
+ : is_windows_network
+ ? _UT("file:")
+ : _UT("file:///");
const size_t prefixLen = URI_STRLEN(prefix);
-
- /* Copy prefix */
- memcpy(uriString, prefix, prefixLen * sizeof(URI_CHAR));
- output += prefixLen;
- }
-
- /* Copy and escape on the fly */
- for (;;) {
- if ((input[0] == _UT('\0'))
- || (fromUnix && input[0] == _UT('/'))
- || (!fromUnix && input[0] == _UT('\\'))) {
- /* Copy text after last separator */
- if (lastSep + 1 < input) {
- if (!fromUnix && absolute && (firstSegment == URI_TRUE)) {
- /* Quick hack to not convert "C:" to "C%3A" */
- const int charsToCopy = (int)(input - (lastSep + 1));
- memcpy(output, lastSep + 1, charsToCopy * sizeof(URI_CHAR));
- output += charsToCopy;
- } else {
- output = URI_FUNC(EscapeEx)(lastSep + 1, input, output,
- URI_FALSE, URI_FALSE);
- }
- }
- firstSegment = URI_FALSE;
- }
-
- if (input[0] == _UT('\0')) {
- output[0] = _UT('\0');
- break;
- } else if (fromUnix && (input[0] == _UT('/'))) {
- /* Copy separators unmodified */
- output[0] = _UT('/');
- output++;
- lastSep = input;
- } else if (!fromUnix && (input[0] == _UT('\\'))) {
- /* Convert backslashes to forward slashes */
- output[0] = _UT('/');
- output++;
- lastSep = input;
- }
- input++;
- }
-
- return URI_SUCCESS;
-}
-
-
-
-static URI_INLINE int URI_FUNC(UriStringToFilename)(const URI_CHAR * uriString,
- URI_CHAR * filename, UriBool toUnix) {
- if ((uriString == NULL) || (filename == NULL)) {
- return URI_ERROR_NULL;
- }
-
- {
- const UriBool file_unknown_slashes =
- URI_STRNCMP(uriString, _UT("file:"), URI_STRLEN(_UT("file:"))) == 0;
- const UriBool file_one_or_more_slashes = file_unknown_slashes
- && (URI_STRNCMP(uriString, _UT("file:/"), URI_STRLEN(_UT("file:/"))) == 0);
- const UriBool file_two_or_more_slashes = file_one_or_more_slashes
- && (URI_STRNCMP(uriString, _UT("file://"), URI_STRLEN(_UT("file://"))) == 0);
- const UriBool file_three_or_more_slashes = file_two_or_more_slashes
- && (URI_STRNCMP(uriString, _UT("file:///"), URI_STRLEN(_UT("file:///"))) == 0);
-
- const size_t charsToSkip = file_two_or_more_slashes
- ? file_three_or_more_slashes
- ? toUnix
- /* file:///bin/bash */
- ? URI_STRLEN(_UT("file://"))
- /* file:///E:/Documents%20and%20Settings */
- : URI_STRLEN(_UT("file:///"))
- /* file://Server01/Letter.txt */
- : URI_STRLEN(_UT("file://"))
- : ((file_one_or_more_slashes && toUnix)
- /* file:/bin/bash */
- /* https://tools.ietf.org/html/rfc8089#appendix-B */
- ? URI_STRLEN(_UT("file:"))
- : ((! toUnix && file_unknown_slashes && ! file_one_or_more_slashes)
- /* file:c:/path/to/file */
- /* https://tools.ietf.org/html/rfc8089#appendix-E.2 */
- ? URI_STRLEN(_UT("file:"))
- : 0));
- const size_t charsToCopy = URI_STRLEN(uriString + charsToSkip) + 1;
-
- const UriBool is_windows_network_with_authority =
- (toUnix == URI_FALSE)
- && file_two_or_more_slashes
- && ! file_three_or_more_slashes;
-
- URI_CHAR * const unescape_target = is_windows_network_with_authority
- ? (filename + 2)
- : filename;
-
- if (is_windows_network_with_authority) {
- filename[0] = '\\';
- filename[1] = '\\';
- }
-
- memcpy(unescape_target, uriString + charsToSkip, charsToCopy * sizeof(URI_CHAR));
- URI_FUNC(UnescapeInPlaceEx)(filename, URI_FALSE, URI_BR_DONT_TOUCH);
- }
-
- /* Convert forward slashes to backslashes */
- if (!toUnix) {
- URI_CHAR * walker = filename;
- while (walker[0] != _UT('\0')) {
- if (walker[0] == _UT('/')) {
- walker[0] = _UT('\\');
- }
- walker++;
- }
- }
-
- return URI_SUCCESS;
-}
-
-
-
-int URI_FUNC(UnixFilenameToUriString)(const URI_CHAR * filename, URI_CHAR * uriString) {
- return URI_FUNC(FilenameToUriString)(filename, uriString, URI_TRUE);
-}
-
-
-
-int URI_FUNC(WindowsFilenameToUriString)(const URI_CHAR * filename, URI_CHAR * uriString) {
- return URI_FUNC(FilenameToUriString)(filename, uriString, URI_FALSE);
-}
-
-
-
-int URI_FUNC(UriStringToUnixFilename)(const URI_CHAR * uriString, URI_CHAR * filename) {
- return URI_FUNC(UriStringToFilename)(uriString, filename, URI_TRUE);
-}
-
-
-
-int URI_FUNC(UriStringToWindowsFilename)(const URI_CHAR * uriString, URI_CHAR * filename) {
- return URI_FUNC(UriStringToFilename)(uriString, filename, URI_FALSE);
-}
-
-
-
-#endif
+
+ /* Copy prefix */
+ memcpy(uriString, prefix, prefixLen * sizeof(URI_CHAR));
+ output += prefixLen;
+ }
+
+ /* Copy and escape on the fly */
+ for (;;) {
+ if ((input[0] == _UT('\0'))
+ || (fromUnix && input[0] == _UT('/'))
+ || (!fromUnix && input[0] == _UT('\\'))) {
+ /* Copy text after last separator */
+ if (lastSep + 1 < input) {
+ if (!fromUnix && absolute && (firstSegment == URI_TRUE)) {
+ /* Quick hack to not convert "C:" to "C%3A" */
+ const int charsToCopy = (int)(input - (lastSep + 1));
+ memcpy(output, lastSep + 1, charsToCopy * sizeof(URI_CHAR));
+ output += charsToCopy;
+ } else {
+ output = URI_FUNC(EscapeEx)(lastSep + 1, input, output,
+ URI_FALSE, URI_FALSE);
+ }
+ }
+ firstSegment = URI_FALSE;
+ }
+
+ if (input[0] == _UT('\0')) {
+ output[0] = _UT('\0');
+ break;
+ } else if (fromUnix && (input[0] == _UT('/'))) {
+ /* Copy separators unmodified */
+ output[0] = _UT('/');
+ output++;
+ lastSep = input;
+ } else if (!fromUnix && (input[0] == _UT('\\'))) {
+ /* Convert backslashes to forward slashes */
+ output[0] = _UT('/');
+ output++;
+ lastSep = input;
+ }
+ input++;
+ }
+
+ return URI_SUCCESS;
+}
+
+
+
+static URI_INLINE int URI_FUNC(UriStringToFilename)(const URI_CHAR * uriString,
+ URI_CHAR * filename, UriBool toUnix) {
+ if ((uriString == NULL) || (filename == NULL)) {
+ return URI_ERROR_NULL;
+ }
+
+ {
+ const UriBool file_unknown_slashes =
+ URI_STRNCMP(uriString, _UT("file:"), URI_STRLEN(_UT("file:"))) == 0;
+ const UriBool file_one_or_more_slashes = file_unknown_slashes
+ && (URI_STRNCMP(uriString, _UT("file:/"), URI_STRLEN(_UT("file:/"))) == 0);
+ const UriBool file_two_or_more_slashes = file_one_or_more_slashes
+ && (URI_STRNCMP(uriString, _UT("file://"), URI_STRLEN(_UT("file://"))) == 0);
+ const UriBool file_three_or_more_slashes = file_two_or_more_slashes
+ && (URI_STRNCMP(uriString, _UT("file:///"), URI_STRLEN(_UT("file:///"))) == 0);
+
+ const size_t charsToSkip = file_two_or_more_slashes
+ ? file_three_or_more_slashes
+ ? toUnix
+ /* file:///bin/bash */
+ ? URI_STRLEN(_UT("file://"))
+ /* file:///E:/Documents%20and%20Settings */
+ : URI_STRLEN(_UT("file:///"))
+ /* file://Server01/Letter.txt */
+ : URI_STRLEN(_UT("file://"))
+ : ((file_one_or_more_slashes && toUnix)
+ /* file:/bin/bash */
+ /* https://tools.ietf.org/html/rfc8089#appendix-B */
+ ? URI_STRLEN(_UT("file:"))
+ : ((! toUnix && file_unknown_slashes && ! file_one_or_more_slashes)
+ /* file:c:/path/to/file */
+ /* https://tools.ietf.org/html/rfc8089#appendix-E.2 */
+ ? URI_STRLEN(_UT("file:"))
+ : 0));
+ const size_t charsToCopy = URI_STRLEN(uriString + charsToSkip) + 1;
+
+ const UriBool is_windows_network_with_authority =
+ (toUnix == URI_FALSE)
+ && file_two_or_more_slashes
+ && ! file_three_or_more_slashes;
+
+ URI_CHAR * const unescape_target = is_windows_network_with_authority
+ ? (filename + 2)
+ : filename;
+
+ if (is_windows_network_with_authority) {
+ filename[0] = '\\';
+ filename[1] = '\\';
+ }
+
+ memcpy(unescape_target, uriString + charsToSkip, charsToCopy * sizeof(URI_CHAR));
+ URI_FUNC(UnescapeInPlaceEx)(filename, URI_FALSE, URI_BR_DONT_TOUCH);
+ }
+
+ /* Convert forward slashes to backslashes */
+ if (!toUnix) {
+ URI_CHAR * walker = filename;
+ while (walker[0] != _UT('\0')) {
+ if (walker[0] == _UT('/')) {
+ walker[0] = _UT('\\');
+ }
+ walker++;
+ }
+ }
+
+ return URI_SUCCESS;
+}
+
+
+
+int URI_FUNC(UnixFilenameToUriString)(const URI_CHAR * filename, URI_CHAR * uriString) {
+ return URI_FUNC(FilenameToUriString)(filename, uriString, URI_TRUE);
+}
+
+
+
+int URI_FUNC(WindowsFilenameToUriString)(const URI_CHAR * filename, URI_CHAR * uriString) {
+ return URI_FUNC(FilenameToUriString)(filename, uriString, URI_FALSE);
+}
+
+
+
+int URI_FUNC(UriStringToUnixFilename)(const URI_CHAR * uriString, URI_CHAR * filename) {
+ return URI_FUNC(UriStringToFilename)(uriString, filename, URI_TRUE);
+}
+
+
+
+int URI_FUNC(UriStringToWindowsFilename)(const URI_CHAR * uriString, URI_CHAR * filename) {
+ return URI_FUNC(UriStringToFilename)(uriString, filename, URI_FALSE);
+}
+
+
+
+#endif
diff --git a/contrib/restricted/uriparser/src/UriIp4.c b/contrib/restricted/uriparser/src/UriIp4.c
index a794265269..c6c57b5366 100644
--- a/contrib/restricted/uriparser/src/UriIp4.c
+++ b/contrib/restricted/uriparser/src/UriIp4.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,299 +31,299 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file UriIp4.c
- * Holds the IPv4 parser implementation.
- * NOTE: This source file includes itself twice.
- */
-
-/* What encodings are enabled? */
-#include <uriparser/UriDefsConfig.h>
-#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* Include SELF twice */
-# ifdef URI_ENABLE_ANSI
-# define URI_PASS_ANSI 1
-# include "UriIp4.c"
-# undef URI_PASS_ANSI
-# endif
-# ifdef URI_ENABLE_UNICODE
-# define URI_PASS_UNICODE 1
-# include "UriIp4.c"
-# undef URI_PASS_UNICODE
-# endif
-#else
-# ifdef URI_PASS_ANSI
-# include <uriparser/UriDefsAnsi.h>
-# else
-# include <uriparser/UriDefsUnicode.h>
-# endif
-
-
-
-#ifndef URI_DOXYGEN
-# include <uriparser/UriIp4.h>
-# include "UriIp4Base.h"
-# include <uriparser/UriBase.h>
-#endif
-
-
-
-/* Prototypes */
-static const URI_CHAR * URI_FUNC(ParseDecOctet)(UriIp4Parser * parser,
- const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseDecOctetOne)(UriIp4Parser * parser,
- const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseDecOctetTwo)(UriIp4Parser * parser,
- const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseDecOctetThree)(UriIp4Parser * parser,
- const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseDecOctetFour)(UriIp4Parser * parser,
- const URI_CHAR * first, const URI_CHAR * afterLast);
-
-
-
-/*
- * [ipFourAddress]->[decOctet]<.>[decOctet]<.>[decOctet]<.>[decOctet]
- */
-int URI_FUNC(ParseIpFourAddress)(unsigned char * octetOutput,
- const URI_CHAR * first, const URI_CHAR * afterLast) {
- const URI_CHAR * after;
- UriIp4Parser parser;
-
- /* Essential checks */
- if ((octetOutput == NULL) || (first == NULL)
- || (afterLast <= first)) {
- return URI_ERROR_SYNTAX;
- }
-
- /* Reset parser */
- parser.stackCount = 0;
-
- /* Octet #1 */
- after = URI_FUNC(ParseDecOctet)(&parser, first, afterLast);
- if ((after == NULL) || (after >= afterLast) || (*after != _UT('.'))) {
- return URI_ERROR_SYNTAX;
- }
- uriStackToOctet(&parser, octetOutput);
-
- /* Octet #2 */
- after = URI_FUNC(ParseDecOctet)(&parser, after + 1, afterLast);
- if ((after == NULL) || (after >= afterLast) || (*after != _UT('.'))) {
- return URI_ERROR_SYNTAX;
- }
- uriStackToOctet(&parser, octetOutput + 1);
-
- /* Octet #3 */
- after = URI_FUNC(ParseDecOctet)(&parser, after + 1, afterLast);
- if ((after == NULL) || (after >= afterLast) || (*after != _UT('.'))) {
- return URI_ERROR_SYNTAX;
- }
- uriStackToOctet(&parser, octetOutput + 2);
-
- /* Octet #4 */
- after = URI_FUNC(ParseDecOctet)(&parser, after + 1, afterLast);
- if (after != afterLast) {
- return URI_ERROR_SYNTAX;
- }
- uriStackToOctet(&parser, octetOutput + 3);
-
- return URI_SUCCESS;
-}
-
-
-
-/*
- * [decOctet]-><0>
- * [decOctet]-><1>[decOctetOne]
- * [decOctet]-><2>[decOctetTwo]
- * [decOctet]-><3>[decOctetThree]
- * [decOctet]-><4>[decOctetThree]
- * [decOctet]-><5>[decOctetThree]
- * [decOctet]-><6>[decOctetThree]
- * [decOctet]-><7>[decOctetThree]
- * [decOctet]-><8>[decOctetThree]
- * [decOctet]-><9>[decOctetThree]
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctet)(UriIp4Parser * parser,
- const URI_CHAR * first, const URI_CHAR * afterLast) {
- if (first >= afterLast) {
- return NULL;
- }
-
- switch (*first) {
- case _UT('0'):
- uriPushToStack(parser, 0);
- return first + 1;
-
- case _UT('1'):
- uriPushToStack(parser, 1);
- return (const URI_CHAR *)URI_FUNC(ParseDecOctetOne)(parser, first + 1, afterLast);
-
- case _UT('2'):
- uriPushToStack(parser, 2);
- return (const URI_CHAR *)URI_FUNC(ParseDecOctetTwo)(parser, first + 1, afterLast);
-
- case _UT('3'):
- case _UT('4'):
- case _UT('5'):
- case _UT('6'):
- case _UT('7'):
- case _UT('8'):
- case _UT('9'):
- uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
- return (const URI_CHAR *)URI_FUNC(ParseDecOctetThree)(parser, first + 1, afterLast);
-
- default:
- return NULL;
- }
-}
-
-
-
-/*
- * [decOctetOne]-><NULL>
- * [decOctetOne]->[DIGIT][decOctetThree]
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctetOne)(UriIp4Parser * parser,
- const URI_CHAR * first, const URI_CHAR * afterLast) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case _UT('0'):
- case _UT('1'):
- case _UT('2'):
- case _UT('3'):
- case _UT('4'):
- case _UT('5'):
- case _UT('6'):
- case _UT('7'):
- case _UT('8'):
- case _UT('9'):
- uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
- return (const URI_CHAR *)URI_FUNC(ParseDecOctetThree)(parser, first + 1, afterLast);
-
- default:
- return first;
- }
-}
-
-
-
-/*
- * [decOctetTwo]-><NULL>
- * [decOctetTwo]-><0>[decOctetThree]
- * [decOctetTwo]-><1>[decOctetThree]
- * [decOctetTwo]-><2>[decOctetThree]
- * [decOctetTwo]-><3>[decOctetThree]
- * [decOctetTwo]-><4>[decOctetThree]
- * [decOctetTwo]-><5>[decOctetFour]
- * [decOctetTwo]-><6>
- * [decOctetTwo]-><7>
- * [decOctetTwo]-><8>
- * [decOctetTwo]-><9>
-*/
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctetTwo)(UriIp4Parser * parser,
- const URI_CHAR * first, const URI_CHAR * afterLast) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case _UT('0'):
- case _UT('1'):
- case _UT('2'):
- case _UT('3'):
- case _UT('4'):
- uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
- return (const URI_CHAR *)URI_FUNC(ParseDecOctetThree)(parser, first + 1, afterLast);
-
- case _UT('5'):
- uriPushToStack(parser, 5);
- return (const URI_CHAR *)URI_FUNC(ParseDecOctetFour)(parser, first + 1, afterLast);
-
- case _UT('6'):
- case _UT('7'):
- case _UT('8'):
- case _UT('9'):
- uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
- return first + 1;
-
- default:
- return first;
- }
-}
-
-
-
-/*
- * [decOctetThree]-><NULL>
- * [decOctetThree]->[DIGIT]
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctetThree)(UriIp4Parser * parser,
- const URI_CHAR * first, const URI_CHAR * afterLast) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case _UT('0'):
- case _UT('1'):
- case _UT('2'):
- case _UT('3'):
- case _UT('4'):
- case _UT('5'):
- case _UT('6'):
- case _UT('7'):
- case _UT('8'):
- case _UT('9'):
- uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
- return first + 1;
-
- default:
- return first;
- }
-}
-
-
-
-/*
- * [decOctetFour]-><NULL>
- * [decOctetFour]-><0>
- * [decOctetFour]-><1>
- * [decOctetFour]-><2>
- * [decOctetFour]-><3>
- * [decOctetFour]-><4>
- * [decOctetFour]-><5>
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctetFour)(UriIp4Parser * parser,
- const URI_CHAR * first, const URI_CHAR * afterLast) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case _UT('0'):
- case _UT('1'):
- case _UT('2'):
- case _UT('3'):
- case _UT('4'):
- case _UT('5'):
- uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
- return first + 1;
-
- default:
- return first;
- }
-}
-
-
-
-#endif
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file UriIp4.c
+ * Holds the IPv4 parser implementation.
+ * NOTE: This source file includes itself twice.
+ */
+
+/* What encodings are enabled? */
+#include <uriparser/UriDefsConfig.h>
+#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* Include SELF twice */
+# ifdef URI_ENABLE_ANSI
+# define URI_PASS_ANSI 1
+# include "UriIp4.c"
+# undef URI_PASS_ANSI
+# endif
+# ifdef URI_ENABLE_UNICODE
+# define URI_PASS_UNICODE 1
+# include "UriIp4.c"
+# undef URI_PASS_UNICODE
+# endif
+#else
+# ifdef URI_PASS_ANSI
+# include <uriparser/UriDefsAnsi.h>
+# else
+# include <uriparser/UriDefsUnicode.h>
+# endif
+
+
+
+#ifndef URI_DOXYGEN
+# include <uriparser/UriIp4.h>
+# include "UriIp4Base.h"
+# include <uriparser/UriBase.h>
+#endif
+
+
+
+/* Prototypes */
+static const URI_CHAR * URI_FUNC(ParseDecOctet)(UriIp4Parser * parser,
+ const URI_CHAR * first, const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseDecOctetOne)(UriIp4Parser * parser,
+ const URI_CHAR * first, const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseDecOctetTwo)(UriIp4Parser * parser,
+ const URI_CHAR * first, const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseDecOctetThree)(UriIp4Parser * parser,
+ const URI_CHAR * first, const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseDecOctetFour)(UriIp4Parser * parser,
+ const URI_CHAR * first, const URI_CHAR * afterLast);
+
+
+
+/*
+ * [ipFourAddress]->[decOctet]<.>[decOctet]<.>[decOctet]<.>[decOctet]
+ */
+int URI_FUNC(ParseIpFourAddress)(unsigned char * octetOutput,
+ const URI_CHAR * first, const URI_CHAR * afterLast) {
+ const URI_CHAR * after;
+ UriIp4Parser parser;
+
+ /* Essential checks */
+ if ((octetOutput == NULL) || (first == NULL)
+ || (afterLast <= first)) {
+ return URI_ERROR_SYNTAX;
+ }
+
+ /* Reset parser */
+ parser.stackCount = 0;
+
+ /* Octet #1 */
+ after = URI_FUNC(ParseDecOctet)(&parser, first, afterLast);
+ if ((after == NULL) || (after >= afterLast) || (*after != _UT('.'))) {
+ return URI_ERROR_SYNTAX;
+ }
+ uriStackToOctet(&parser, octetOutput);
+
+ /* Octet #2 */
+ after = URI_FUNC(ParseDecOctet)(&parser, after + 1, afterLast);
+ if ((after == NULL) || (after >= afterLast) || (*after != _UT('.'))) {
+ return URI_ERROR_SYNTAX;
+ }
+ uriStackToOctet(&parser, octetOutput + 1);
+
+ /* Octet #3 */
+ after = URI_FUNC(ParseDecOctet)(&parser, after + 1, afterLast);
+ if ((after == NULL) || (after >= afterLast) || (*after != _UT('.'))) {
+ return URI_ERROR_SYNTAX;
+ }
+ uriStackToOctet(&parser, octetOutput + 2);
+
+ /* Octet #4 */
+ after = URI_FUNC(ParseDecOctet)(&parser, after + 1, afterLast);
+ if (after != afterLast) {
+ return URI_ERROR_SYNTAX;
+ }
+ uriStackToOctet(&parser, octetOutput + 3);
+
+ return URI_SUCCESS;
+}
+
+
+
+/*
+ * [decOctet]-><0>
+ * [decOctet]-><1>[decOctetOne]
+ * [decOctet]-><2>[decOctetTwo]
+ * [decOctet]-><3>[decOctetThree]
+ * [decOctet]-><4>[decOctetThree]
+ * [decOctet]-><5>[decOctetThree]
+ * [decOctet]-><6>[decOctetThree]
+ * [decOctet]-><7>[decOctetThree]
+ * [decOctet]-><8>[decOctetThree]
+ * [decOctet]-><9>[decOctetThree]
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctet)(UriIp4Parser * parser,
+ const URI_CHAR * first, const URI_CHAR * afterLast) {
+ if (first >= afterLast) {
+ return NULL;
+ }
+
+ switch (*first) {
+ case _UT('0'):
+ uriPushToStack(parser, 0);
+ return first + 1;
+
+ case _UT('1'):
+ uriPushToStack(parser, 1);
+ return (const URI_CHAR *)URI_FUNC(ParseDecOctetOne)(parser, first + 1, afterLast);
+
+ case _UT('2'):
+ uriPushToStack(parser, 2);
+ return (const URI_CHAR *)URI_FUNC(ParseDecOctetTwo)(parser, first + 1, afterLast);
+
+ case _UT('3'):
+ case _UT('4'):
+ case _UT('5'):
+ case _UT('6'):
+ case _UT('7'):
+ case _UT('8'):
+ case _UT('9'):
+ uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
+ return (const URI_CHAR *)URI_FUNC(ParseDecOctetThree)(parser, first + 1, afterLast);
+
+ default:
+ return NULL;
+ }
+}
+
+
+
+/*
+ * [decOctetOne]-><NULL>
+ * [decOctetOne]->[DIGIT][decOctetThree]
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctetOne)(UriIp4Parser * parser,
+ const URI_CHAR * first, const URI_CHAR * afterLast) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('0'):
+ case _UT('1'):
+ case _UT('2'):
+ case _UT('3'):
+ case _UT('4'):
+ case _UT('5'):
+ case _UT('6'):
+ case _UT('7'):
+ case _UT('8'):
+ case _UT('9'):
+ uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
+ return (const URI_CHAR *)URI_FUNC(ParseDecOctetThree)(parser, first + 1, afterLast);
+
+ default:
+ return first;
+ }
+}
+
+
+
+/*
+ * [decOctetTwo]-><NULL>
+ * [decOctetTwo]-><0>[decOctetThree]
+ * [decOctetTwo]-><1>[decOctetThree]
+ * [decOctetTwo]-><2>[decOctetThree]
+ * [decOctetTwo]-><3>[decOctetThree]
+ * [decOctetTwo]-><4>[decOctetThree]
+ * [decOctetTwo]-><5>[decOctetFour]
+ * [decOctetTwo]-><6>
+ * [decOctetTwo]-><7>
+ * [decOctetTwo]-><8>
+ * [decOctetTwo]-><9>
+*/
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctetTwo)(UriIp4Parser * parser,
+ const URI_CHAR * first, const URI_CHAR * afterLast) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('0'):
+ case _UT('1'):
+ case _UT('2'):
+ case _UT('3'):
+ case _UT('4'):
+ uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
+ return (const URI_CHAR *)URI_FUNC(ParseDecOctetThree)(parser, first + 1, afterLast);
+
+ case _UT('5'):
+ uriPushToStack(parser, 5);
+ return (const URI_CHAR *)URI_FUNC(ParseDecOctetFour)(parser, first + 1, afterLast);
+
+ case _UT('6'):
+ case _UT('7'):
+ case _UT('8'):
+ case _UT('9'):
+ uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
+ return first + 1;
+
+ default:
+ return first;
+ }
+}
+
+
+
+/*
+ * [decOctetThree]-><NULL>
+ * [decOctetThree]->[DIGIT]
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctetThree)(UriIp4Parser * parser,
+ const URI_CHAR * first, const URI_CHAR * afterLast) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('0'):
+ case _UT('1'):
+ case _UT('2'):
+ case _UT('3'):
+ case _UT('4'):
+ case _UT('5'):
+ case _UT('6'):
+ case _UT('7'):
+ case _UT('8'):
+ case _UT('9'):
+ uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
+ return first + 1;
+
+ default:
+ return first;
+ }
+}
+
+
+
+/*
+ * [decOctetFour]-><NULL>
+ * [decOctetFour]-><0>
+ * [decOctetFour]-><1>
+ * [decOctetFour]-><2>
+ * [decOctetFour]-><3>
+ * [decOctetFour]-><4>
+ * [decOctetFour]-><5>
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctetFour)(UriIp4Parser * parser,
+ const URI_CHAR * first, const URI_CHAR * afterLast) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('0'):
+ case _UT('1'):
+ case _UT('2'):
+ case _UT('3'):
+ case _UT('4'):
+ case _UT('5'):
+ uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
+ return first + 1;
+
+ default:
+ return first;
+ }
+}
+
+
+
+#endif
diff --git a/contrib/restricted/uriparser/src/UriIp4Base.c b/contrib/restricted/uriparser/src/UriIp4Base.c
index ded7c32c99..20c56df184 100644
--- a/contrib/restricted/uriparser/src/UriIp4Base.c
+++ b/contrib/restricted/uriparser/src/UriIp4Base.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,66 +31,66 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file UriIp4Base.c
- * Holds code independent of the encoding pass.
- */
-
-#ifndef URI_DOXYGEN
-# include "UriIp4Base.h"
-#endif
-
-
-
-void uriStackToOctet(UriIp4Parser * parser, unsigned char * octet) {
- switch (parser->stackCount) {
- case 1:
- *octet = parser->stackOne;
- break;
-
- case 2:
- *octet = parser->stackOne * 10
- + parser->stackTwo;
- break;
-
- case 3:
- *octet = parser->stackOne * 100
- + parser->stackTwo * 10
- + parser->stackThree;
- break;
-
- default:
- ;
- }
- parser->stackCount = 0;
-}
-
-
-
-void uriPushToStack(UriIp4Parser * parser, unsigned char digit) {
- switch (parser->stackCount) {
- case 0:
- parser->stackOne = digit;
- parser->stackCount = 1;
- break;
-
- case 1:
- parser->stackTwo = digit;
- parser->stackCount = 2;
- break;
-
- case 2:
- parser->stackThree = digit;
- parser->stackCount = 3;
- break;
-
- default:
- ;
- }
-}
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file UriIp4Base.c
+ * Holds code independent of the encoding pass.
+ */
+
+#ifndef URI_DOXYGEN
+# include "UriIp4Base.h"
+#endif
+
+
+
+void uriStackToOctet(UriIp4Parser * parser, unsigned char * octet) {
+ switch (parser->stackCount) {
+ case 1:
+ *octet = parser->stackOne;
+ break;
+
+ case 2:
+ *octet = parser->stackOne * 10
+ + parser->stackTwo;
+ break;
+
+ case 3:
+ *octet = parser->stackOne * 100
+ + parser->stackTwo * 10
+ + parser->stackThree;
+ break;
+
+ default:
+ ;
+ }
+ parser->stackCount = 0;
+}
+
+
+
+void uriPushToStack(UriIp4Parser * parser, unsigned char digit) {
+ switch (parser->stackCount) {
+ case 0:
+ parser->stackOne = digit;
+ parser->stackCount = 1;
+ break;
+
+ case 1:
+ parser->stackTwo = digit;
+ parser->stackCount = 2;
+ break;
+
+ case 2:
+ parser->stackThree = digit;
+ parser->stackCount = 3;
+ break;
+
+ default:
+ ;
+ }
+}
diff --git a/contrib/restricted/uriparser/src/UriIp4Base.h b/contrib/restricted/uriparser/src/UriIp4Base.h
index 4867850224..ae63b27a98 100644
--- a/contrib/restricted/uriparser/src/UriIp4Base.h
+++ b/contrib/restricted/uriparser/src/UriIp4Base.h
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,29 +31,29 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef URI_IP4_BASE_H
-#define URI_IP4_BASE_H 1
-
-
-
-typedef struct UriIp4ParserStruct {
- unsigned char stackCount;
- unsigned char stackOne;
- unsigned char stackTwo;
- unsigned char stackThree;
-} UriIp4Parser;
-
-
-
-void uriPushToStack(UriIp4Parser * parser, unsigned char digit);
-void uriStackToOctet(UriIp4Parser * parser, unsigned char * octet);
-
-
-
-#endif /* URI_IP4_BASE_H */
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef URI_IP4_BASE_H
+#define URI_IP4_BASE_H 1
+
+
+
+typedef struct UriIp4ParserStruct {
+ unsigned char stackCount;
+ unsigned char stackOne;
+ unsigned char stackTwo;
+ unsigned char stackThree;
+} UriIp4Parser;
+
+
+
+void uriPushToStack(UriIp4Parser * parser, unsigned char digit);
+void uriStackToOctet(UriIp4Parser * parser, unsigned char * octet);
+
+
+
+#endif /* URI_IP4_BASE_H */
diff --git a/contrib/restricted/uriparser/src/UriMemory.c b/contrib/restricted/uriparser/src/UriMemory.c
index baed2040da..91414b828e 100644
--- a/contrib/restricted/uriparser/src/UriMemory.c
+++ b/contrib/restricted/uriparser/src/UriMemory.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2018, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2018, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2018, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2018, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,438 +31,438 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file UriMemory.c
- * Holds memory manager implementation.
- */
-
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file UriMemory.c
+ * Holds memory manager implementation.
+ */
+
#include <config.h>
-
+
#ifdef HAVE_REALLOCARRAY
-# ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-# endif
-#endif
-
-#include <errno.h>
-#include <stdlib.h>
-
-
-
-#ifndef URI_DOXYGEN
-# include "UriMemory.h"
-#endif
-
-
-
-#define URI_CHECK_ALLOC_OVERFLOW(total_size, nmemb, size) \
- do { \
- /* check for unsigned overflow */ \
- if ((nmemb != 0) && (total_size / nmemb != size)) { \
- errno = ENOMEM; \
- return NULL; \
- } \
- } while (0)
-
-
-
-static void * uriDefaultMalloc(UriMemoryManager * URI_UNUSED(memory),
- size_t size) {
- return malloc(size);
-}
-
-
-
-static void * uriDefaultCalloc(UriMemoryManager * URI_UNUSED(memory),
- size_t nmemb, size_t size) {
- return calloc(nmemb, size);
-}
-
-
-
-static void * uriDefaultRealloc(UriMemoryManager * URI_UNUSED(memory),
- void * ptr, size_t size) {
- return realloc(ptr, size);
-}
-
-
-
-static void * uriDefaultReallocarray(UriMemoryManager * URI_UNUSED(memory),
- void * ptr, size_t nmemb, size_t size) {
+# ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+# endif
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+
+
+
+#ifndef URI_DOXYGEN
+# include "UriMemory.h"
+#endif
+
+
+
+#define URI_CHECK_ALLOC_OVERFLOW(total_size, nmemb, size) \
+ do { \
+ /* check for unsigned overflow */ \
+ if ((nmemb != 0) && (total_size / nmemb != size)) { \
+ errno = ENOMEM; \
+ return NULL; \
+ } \
+ } while (0)
+
+
+
+static void * uriDefaultMalloc(UriMemoryManager * URI_UNUSED(memory),
+ size_t size) {
+ return malloc(size);
+}
+
+
+
+static void * uriDefaultCalloc(UriMemoryManager * URI_UNUSED(memory),
+ size_t nmemb, size_t size) {
+ return calloc(nmemb, size);
+}
+
+
+
+static void * uriDefaultRealloc(UriMemoryManager * URI_UNUSED(memory),
+ void * ptr, size_t size) {
+ return realloc(ptr, size);
+}
+
+
+
+static void * uriDefaultReallocarray(UriMemoryManager * URI_UNUSED(memory),
+ void * ptr, size_t nmemb, size_t size) {
#ifdef HAVE_REALLOCARRAY
- return reallocarray(ptr, nmemb, size);
-#else
- const size_t total_size = nmemb * size;
-
- URI_CHECK_ALLOC_OVERFLOW(total_size, nmemb, size); /* may return */
-
- return realloc(ptr, total_size);
-#endif
-}
-
-
-
-static void uriDefaultFree(UriMemoryManager * URI_UNUSED(memory),
- void * ptr) {
- free(ptr);
-}
-
-
-
-UriBool uriMemoryManagerIsComplete(const UriMemoryManager * memory) {
- return (memory
- && memory->malloc
- && memory->calloc
- && memory->realloc
- && memory->reallocarray
- && memory->free) ? URI_TRUE : URI_FALSE;
-}
-
-
-
-void * uriEmulateCalloc(UriMemoryManager * memory, size_t nmemb, size_t size) {
- void * buffer;
- const size_t total_size = nmemb * size;
-
- if (memory == NULL) {
- errno = EINVAL;
- return NULL;
- }
-
- URI_CHECK_ALLOC_OVERFLOW(total_size, nmemb, size); /* may return */
-
- buffer = memory->malloc(memory, total_size);
- if (buffer == NULL) {
- /* errno set by malloc */
- return NULL;
- }
- memset(buffer, 0, total_size);
- return buffer;
-}
-
-
-
-void * uriEmulateReallocarray(UriMemoryManager * memory,
- void * ptr, size_t nmemb, size_t size) {
- const size_t total_size = nmemb * size;
-
- if (memory == NULL) {
- errno = EINVAL;
- return NULL;
- }
-
- URI_CHECK_ALLOC_OVERFLOW(total_size, nmemb, size); /* may return */
-
- return memory->realloc(memory, ptr, total_size);
-}
-
-
-
-static void * uriDecorateMalloc(UriMemoryManager * memory,
- size_t size) {
- UriMemoryManager * backend;
- const size_t extraBytes = sizeof(size_t);
- void * buffer;
-
- if (memory == NULL) {
- errno = EINVAL;
- return NULL;
- }
-
- /* check for unsigned overflow */
- if (size > ((size_t)-1) - extraBytes) {
- errno = ENOMEM;
- return NULL;
- }
-
- backend = (UriMemoryManager *)memory->userData;
- if (backend == NULL) {
- errno = EINVAL;
- return NULL;
- }
-
- buffer = backend->malloc(backend, extraBytes + size);
- if (buffer == NULL) {
- return NULL;
- }
-
- *(size_t *)buffer = size;
-
- return (char *)buffer + extraBytes;
-}
-
-
-
-static void * uriDecorateRealloc(UriMemoryManager * memory,
- void * ptr, size_t size) {
- void * newBuffer;
- size_t prevSize;
-
- if (memory == NULL) {
- errno = EINVAL;
- return NULL;
- }
-
- /* man realloc: "If ptr is NULL, then the call is equivalent to
- * malloc(size), for *all* values of size" */
- if (ptr == NULL) {
- return memory->malloc(memory, size);
- }
-
- /* man realloc: "If size is equal to zero, and ptr is *not* NULL,
- * then the call is equivalent to free(ptr)." */
- if (size == 0) {
- memory->free(memory, ptr);
- return NULL;
- }
-
- prevSize = *((size_t *)((char *)ptr - sizeof(size_t)));
-
- /* Anything to do? */
- if (size <= prevSize) {
- return ptr;
- }
-
- newBuffer = memory->malloc(memory, size);
- if (newBuffer == NULL) {
- /* errno set by malloc */
- return NULL;
- }
-
- memcpy(newBuffer, ptr, prevSize);
-
- memory->free(memory, ptr);
-
- return newBuffer;
-}
-
-
-
-static void uriDecorateFree(UriMemoryManager * memory, void * ptr) {
- UriMemoryManager * backend;
-
- if ((ptr == NULL) || (memory == NULL)) {
- return;
- }
-
- backend = (UriMemoryManager *)memory->userData;
- if (backend == NULL) {
- return;
- }
-
- backend->free(backend, (char *)ptr - sizeof(size_t));
-}
-
-
-
-int uriCompleteMemoryManager(UriMemoryManager * memory,
- UriMemoryManager * backend) {
- if ((memory == NULL) || (backend == NULL)) {
- return URI_ERROR_NULL;
- }
-
- if ((backend->malloc == NULL) || (backend->free == NULL)) {
- return URI_ERROR_MEMORY_MANAGER_INCOMPLETE;
- }
-
- memory->calloc = uriEmulateCalloc;
- memory->reallocarray = uriEmulateReallocarray;
-
- memory->malloc = uriDecorateMalloc;
- memory->realloc = uriDecorateRealloc;
- memory->free = uriDecorateFree;
-
- memory->userData = backend;
-
- return URI_SUCCESS;
-}
-
-
-
-int uriTestMemoryManager(UriMemoryManager * memory) {
- const size_t mallocSize = 7;
- const size_t callocNmemb = 3;
- const size_t callocSize = 5;
- const size_t callocTotalSize = callocNmemb * callocSize;
- const size_t reallocSize = 11;
- const size_t reallocarrayNmemb = 5;
- const size_t reallocarraySize = 7;
- const size_t reallocarrayTotal = reallocarrayNmemb * reallocarraySize;
- size_t index;
- char * buffer;
-
- if (memory == NULL) {
- return URI_ERROR_NULL;
- }
-
- if (uriMemoryManagerIsComplete(memory) != URI_TRUE) {
- return URI_ERROR_MEMORY_MANAGER_INCOMPLETE;
- }
-
- /* malloc + free*/
- buffer = memory->malloc(memory, mallocSize);
- if (buffer == NULL) {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- buffer[mallocSize - 1] = '\xF1';
- memory->free(memory, buffer);
- buffer = NULL;
-
- /* calloc + free */
- buffer = memory->calloc(memory, callocNmemb, callocSize);
- if (buffer == NULL) {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- for (index = 0; index < callocTotalSize; index++) { /* all zeros? */
- if (buffer[index] != '\0') {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- }
- buffer[callocTotalSize - 1] = '\xF2';
- memory->free(memory, buffer);
- buffer = NULL;
-
- /* malloc + realloc + free */
- buffer = memory->malloc(memory, mallocSize);
- if (buffer == NULL) {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- for (index = 0; index < mallocSize; index++) {
- buffer[index] = '\xF3';
- }
- buffer = memory->realloc(memory, buffer, reallocSize);
- if (buffer == NULL) {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- for (index = 0; index < mallocSize; index++) { /* previous content? */
- if (buffer[index] != '\xF3') {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- }
- buffer[reallocSize - 1] = '\xF4';
- memory->free(memory, buffer);
- buffer = NULL;
-
- /* malloc + realloc ptr!=NULL size==0 (equals free) */
- buffer = memory->malloc(memory, mallocSize);
- if (buffer == NULL) {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- buffer[mallocSize - 1] = '\xF5';
- memory->realloc(memory, buffer, 0);
- buffer = NULL;
-
- /* realloc ptr==NULL size!=0 (equals malloc) + free */
- buffer = memory->realloc(memory, NULL, mallocSize);
- if (buffer == NULL) {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- buffer[mallocSize - 1] = '\xF6';
- memory->free(memory, buffer);
- buffer = NULL;
-
- /* realloc ptr==NULL size==0 (equals malloc) + free */
- buffer = memory->realloc(memory, NULL, 0);
- if (buffer != NULL) {
- memory->free(memory, buffer);
- buffer = NULL;
- }
-
- /* malloc + reallocarray + free */
- buffer = memory->malloc(memory, mallocSize);
- if (buffer == NULL) {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- for (index = 0; index < mallocSize; index++) {
- buffer[index] = '\xF7';
- }
- buffer = memory->reallocarray(memory, buffer, reallocarrayNmemb,
- reallocarraySize);
- if (buffer == NULL) {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- for (index = 0; index < mallocSize; index++) { /* previous content? */
- if (buffer[index] != '\xF7') {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- }
- buffer[reallocarrayTotal - 1] = '\xF8';
- memory->free(memory, buffer);
- buffer = NULL;
-
- /* malloc + reallocarray ptr!=NULL nmemb==0 size!=0 (equals free) */
- buffer = memory->malloc(memory, mallocSize);
- if (buffer == NULL) {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- buffer[mallocSize - 1] = '\xF9';
- memory->reallocarray(memory, buffer, 0, reallocarraySize);
- buffer = NULL;
-
- /* malloc + reallocarray ptr!=NULL nmemb!=0 size==0 (equals free) */
- buffer = memory->malloc(memory, mallocSize);
- if (buffer == NULL) {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- buffer[mallocSize - 1] = '\xFA';
- memory->reallocarray(memory, buffer, reallocarrayNmemb, 0);
- buffer = NULL;
-
- /* malloc + reallocarray ptr!=NULL nmemb==0 size==0 (equals free) */
- buffer = memory->malloc(memory, mallocSize);
- if (buffer == NULL) {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- buffer[mallocSize - 1] = '\xFB';
- memory->reallocarray(memory, buffer, 0, 0);
- buffer = NULL;
-
- /* reallocarray ptr==NULL nmemb!=0 size!=0 (equals malloc) + free */
- buffer = memory->reallocarray(memory, NULL, callocNmemb, callocSize);
- if (buffer == NULL) {
- return URI_ERROR_MEMORY_MANAGER_FAULTY;
- }
- buffer[callocTotalSize - 1] = '\xFC';
- memory->free(memory, buffer);
- buffer = NULL;
-
- /* reallocarray ptr==NULL nmemb==0 size!=0 (equals malloc) + free */
- buffer = memory->reallocarray(memory, NULL, 0, callocSize);
- if (buffer != NULL) {
- memory->free(memory, buffer);
- buffer = NULL;
- }
-
- /* reallocarray ptr==NULL nmemb!=0 size==0 (equals malloc) + free */
- buffer = memory->reallocarray(memory, NULL, callocNmemb, 0);
- if (buffer != NULL) {
- memory->free(memory, buffer);
- buffer = NULL;
- }
-
- /* reallocarray ptr==NULL nmemb==0 size==0 (equals malloc) + free */
- buffer = memory->reallocarray(memory, NULL, 0, 0);
- if (buffer != NULL) {
- memory->free(memory, buffer);
- buffer = NULL;
- }
-
- return URI_SUCCESS;
-}
-
-
-
-/*extern*/ UriMemoryManager defaultMemoryManager = {
- uriDefaultMalloc,
- uriDefaultCalloc,
- uriDefaultRealloc,
- uriDefaultReallocarray,
- uriDefaultFree,
- NULL /* userData */
-};
+ return reallocarray(ptr, nmemb, size);
+#else
+ const size_t total_size = nmemb * size;
+
+ URI_CHECK_ALLOC_OVERFLOW(total_size, nmemb, size); /* may return */
+
+ return realloc(ptr, total_size);
+#endif
+}
+
+
+
+static void uriDefaultFree(UriMemoryManager * URI_UNUSED(memory),
+ void * ptr) {
+ free(ptr);
+}
+
+
+
+UriBool uriMemoryManagerIsComplete(const UriMemoryManager * memory) {
+ return (memory
+ && memory->malloc
+ && memory->calloc
+ && memory->realloc
+ && memory->reallocarray
+ && memory->free) ? URI_TRUE : URI_FALSE;
+}
+
+
+
+void * uriEmulateCalloc(UriMemoryManager * memory, size_t nmemb, size_t size) {
+ void * buffer;
+ const size_t total_size = nmemb * size;
+
+ if (memory == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ URI_CHECK_ALLOC_OVERFLOW(total_size, nmemb, size); /* may return */
+
+ buffer = memory->malloc(memory, total_size);
+ if (buffer == NULL) {
+ /* errno set by malloc */
+ return NULL;
+ }
+ memset(buffer, 0, total_size);
+ return buffer;
+}
+
+
+
+void * uriEmulateReallocarray(UriMemoryManager * memory,
+ void * ptr, size_t nmemb, size_t size) {
+ const size_t total_size = nmemb * size;
+
+ if (memory == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ URI_CHECK_ALLOC_OVERFLOW(total_size, nmemb, size); /* may return */
+
+ return memory->realloc(memory, ptr, total_size);
+}
+
+
+
+static void * uriDecorateMalloc(UriMemoryManager * memory,
+ size_t size) {
+ UriMemoryManager * backend;
+ const size_t extraBytes = sizeof(size_t);
+ void * buffer;
+
+ if (memory == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ /* check for unsigned overflow */
+ if (size > ((size_t)-1) - extraBytes) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ backend = (UriMemoryManager *)memory->userData;
+ if (backend == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ buffer = backend->malloc(backend, extraBytes + size);
+ if (buffer == NULL) {
+ return NULL;
+ }
+
+ *(size_t *)buffer = size;
+
+ return (char *)buffer + extraBytes;
+}
+
+
+
+static void * uriDecorateRealloc(UriMemoryManager * memory,
+ void * ptr, size_t size) {
+ void * newBuffer;
+ size_t prevSize;
+
+ if (memory == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ /* man realloc: "If ptr is NULL, then the call is equivalent to
+ * malloc(size), for *all* values of size" */
+ if (ptr == NULL) {
+ return memory->malloc(memory, size);
+ }
+
+ /* man realloc: "If size is equal to zero, and ptr is *not* NULL,
+ * then the call is equivalent to free(ptr)." */
+ if (size == 0) {
+ memory->free(memory, ptr);
+ return NULL;
+ }
+
+ prevSize = *((size_t *)((char *)ptr - sizeof(size_t)));
+
+ /* Anything to do? */
+ if (size <= prevSize) {
+ return ptr;
+ }
+
+ newBuffer = memory->malloc(memory, size);
+ if (newBuffer == NULL) {
+ /* errno set by malloc */
+ return NULL;
+ }
+
+ memcpy(newBuffer, ptr, prevSize);
+
+ memory->free(memory, ptr);
+
+ return newBuffer;
+}
+
+
+
+static void uriDecorateFree(UriMemoryManager * memory, void * ptr) {
+ UriMemoryManager * backend;
+
+ if ((ptr == NULL) || (memory == NULL)) {
+ return;
+ }
+
+ backend = (UriMemoryManager *)memory->userData;
+ if (backend == NULL) {
+ return;
+ }
+
+ backend->free(backend, (char *)ptr - sizeof(size_t));
+}
+
+
+
+int uriCompleteMemoryManager(UriMemoryManager * memory,
+ UriMemoryManager * backend) {
+ if ((memory == NULL) || (backend == NULL)) {
+ return URI_ERROR_NULL;
+ }
+
+ if ((backend->malloc == NULL) || (backend->free == NULL)) {
+ return URI_ERROR_MEMORY_MANAGER_INCOMPLETE;
+ }
+
+ memory->calloc = uriEmulateCalloc;
+ memory->reallocarray = uriEmulateReallocarray;
+
+ memory->malloc = uriDecorateMalloc;
+ memory->realloc = uriDecorateRealloc;
+ memory->free = uriDecorateFree;
+
+ memory->userData = backend;
+
+ return URI_SUCCESS;
+}
+
+
+
+int uriTestMemoryManager(UriMemoryManager * memory) {
+ const size_t mallocSize = 7;
+ const size_t callocNmemb = 3;
+ const size_t callocSize = 5;
+ const size_t callocTotalSize = callocNmemb * callocSize;
+ const size_t reallocSize = 11;
+ const size_t reallocarrayNmemb = 5;
+ const size_t reallocarraySize = 7;
+ const size_t reallocarrayTotal = reallocarrayNmemb * reallocarraySize;
+ size_t index;
+ char * buffer;
+
+ if (memory == NULL) {
+ return URI_ERROR_NULL;
+ }
+
+ if (uriMemoryManagerIsComplete(memory) != URI_TRUE) {
+ return URI_ERROR_MEMORY_MANAGER_INCOMPLETE;
+ }
+
+ /* malloc + free*/
+ buffer = memory->malloc(memory, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ buffer[mallocSize - 1] = '\xF1';
+ memory->free(memory, buffer);
+ buffer = NULL;
+
+ /* calloc + free */
+ buffer = memory->calloc(memory, callocNmemb, callocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ for (index = 0; index < callocTotalSize; index++) { /* all zeros? */
+ if (buffer[index] != '\0') {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ }
+ buffer[callocTotalSize - 1] = '\xF2';
+ memory->free(memory, buffer);
+ buffer = NULL;
+
+ /* malloc + realloc + free */
+ buffer = memory->malloc(memory, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ for (index = 0; index < mallocSize; index++) {
+ buffer[index] = '\xF3';
+ }
+ buffer = memory->realloc(memory, buffer, reallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ for (index = 0; index < mallocSize; index++) { /* previous content? */
+ if (buffer[index] != '\xF3') {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ }
+ buffer[reallocSize - 1] = '\xF4';
+ memory->free(memory, buffer);
+ buffer = NULL;
+
+ /* malloc + realloc ptr!=NULL size==0 (equals free) */
+ buffer = memory->malloc(memory, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ buffer[mallocSize - 1] = '\xF5';
+ memory->realloc(memory, buffer, 0);
+ buffer = NULL;
+
+ /* realloc ptr==NULL size!=0 (equals malloc) + free */
+ buffer = memory->realloc(memory, NULL, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ buffer[mallocSize - 1] = '\xF6';
+ memory->free(memory, buffer);
+ buffer = NULL;
+
+ /* realloc ptr==NULL size==0 (equals malloc) + free */
+ buffer = memory->realloc(memory, NULL, 0);
+ if (buffer != NULL) {
+ memory->free(memory, buffer);
+ buffer = NULL;
+ }
+
+ /* malloc + reallocarray + free */
+ buffer = memory->malloc(memory, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ for (index = 0; index < mallocSize; index++) {
+ buffer[index] = '\xF7';
+ }
+ buffer = memory->reallocarray(memory, buffer, reallocarrayNmemb,
+ reallocarraySize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ for (index = 0; index < mallocSize; index++) { /* previous content? */
+ if (buffer[index] != '\xF7') {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ }
+ buffer[reallocarrayTotal - 1] = '\xF8';
+ memory->free(memory, buffer);
+ buffer = NULL;
+
+ /* malloc + reallocarray ptr!=NULL nmemb==0 size!=0 (equals free) */
+ buffer = memory->malloc(memory, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ buffer[mallocSize - 1] = '\xF9';
+ memory->reallocarray(memory, buffer, 0, reallocarraySize);
+ buffer = NULL;
+
+ /* malloc + reallocarray ptr!=NULL nmemb!=0 size==0 (equals free) */
+ buffer = memory->malloc(memory, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ buffer[mallocSize - 1] = '\xFA';
+ memory->reallocarray(memory, buffer, reallocarrayNmemb, 0);
+ buffer = NULL;
+
+ /* malloc + reallocarray ptr!=NULL nmemb==0 size==0 (equals free) */
+ buffer = memory->malloc(memory, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ buffer[mallocSize - 1] = '\xFB';
+ memory->reallocarray(memory, buffer, 0, 0);
+ buffer = NULL;
+
+ /* reallocarray ptr==NULL nmemb!=0 size!=0 (equals malloc) + free */
+ buffer = memory->reallocarray(memory, NULL, callocNmemb, callocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ buffer[callocTotalSize - 1] = '\xFC';
+ memory->free(memory, buffer);
+ buffer = NULL;
+
+ /* reallocarray ptr==NULL nmemb==0 size!=0 (equals malloc) + free */
+ buffer = memory->reallocarray(memory, NULL, 0, callocSize);
+ if (buffer != NULL) {
+ memory->free(memory, buffer);
+ buffer = NULL;
+ }
+
+ /* reallocarray ptr==NULL nmemb!=0 size==0 (equals malloc) + free */
+ buffer = memory->reallocarray(memory, NULL, callocNmemb, 0);
+ if (buffer != NULL) {
+ memory->free(memory, buffer);
+ buffer = NULL;
+ }
+
+ /* reallocarray ptr==NULL nmemb==0 size==0 (equals malloc) + free */
+ buffer = memory->reallocarray(memory, NULL, 0, 0);
+ if (buffer != NULL) {
+ memory->free(memory, buffer);
+ buffer = NULL;
+ }
+
+ return URI_SUCCESS;
+}
+
+
+
+/*extern*/ UriMemoryManager defaultMemoryManager = {
+ uriDefaultMalloc,
+ uriDefaultCalloc,
+ uriDefaultRealloc,
+ uriDefaultReallocarray,
+ uriDefaultFree,
+ NULL /* userData */
+};
diff --git a/contrib/restricted/uriparser/src/UriMemory.h b/contrib/restricted/uriparser/src/UriMemory.h
index a930f93ac3..7ce3df2e99 100644
--- a/contrib/restricted/uriparser/src/UriMemory.h
+++ b/contrib/restricted/uriparser/src/UriMemory.h
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2018, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2018, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2018, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2018, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,47 +31,47 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
#ifndef URI_MEMORY_H
#define URI_MEMORY_H 1
-#ifndef URI_DOXYGEN
-# include <uriparser/Uri.h>
-#endif
-
-
-
-#define URI_CHECK_MEMORY_MANAGER(memory) \
- do { \
- if (memory == NULL) { \
- memory = &defaultMemoryManager; \
- } else if (uriMemoryManagerIsComplete(memory) != URI_TRUE) { \
- return URI_ERROR_MEMORY_MANAGER_INCOMPLETE; \
- } \
- } while (0)
-
-
-
+#ifndef URI_DOXYGEN
+# include <uriparser/Uri.h>
+#endif
+
+
+
+#define URI_CHECK_MEMORY_MANAGER(memory) \
+ do { \
+ if (memory == NULL) { \
+ memory = &defaultMemoryManager; \
+ } else if (uriMemoryManagerIsComplete(memory) != URI_TRUE) { \
+ return URI_ERROR_MEMORY_MANAGER_INCOMPLETE; \
+ } \
+ } while (0)
+
+
+
#ifdef __cplusplus
# define URIPARSER_EXTERN extern "C"
#else
# define URIPARSER_EXTERN extern
#endif
-
+
URIPARSER_EXTERN UriMemoryManager defaultMemoryManager;
#undef URIPARSER_EXTERN
-UriBool uriMemoryManagerIsComplete(const UriMemoryManager * memory);
+UriBool uriMemoryManagerIsComplete(const UriMemoryManager * memory);
diff --git a/contrib/restricted/uriparser/src/UriNormalize.c b/contrib/restricted/uriparser/src/UriNormalize.c
index eb072b2f20..8b772f5a41 100644
--- a/contrib/restricted/uriparser/src/UriNormalize.c
+++ b/contrib/restricted/uriparser/src/UriNormalize.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,398 +31,398 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file UriNormalize.c
- * Holds the RFC 3986 %URI normalization implementation.
- * NOTE: This source file includes itself twice.
- */
-
-/* What encodings are enabled? */
-#include <uriparser/UriDefsConfig.h>
-#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* Include SELF twice */
-# ifdef URI_ENABLE_ANSI
-# define URI_PASS_ANSI 1
-# include "UriNormalize.c"
-# undef URI_PASS_ANSI
-# endif
-# ifdef URI_ENABLE_UNICODE
-# define URI_PASS_UNICODE 1
-# include "UriNormalize.c"
-# undef URI_PASS_UNICODE
-# endif
-#else
-# ifdef URI_PASS_ANSI
-# include <uriparser/UriDefsAnsi.h>
-# else
-# include <uriparser/UriDefsUnicode.h>
-# include <wchar.h>
-# endif
-
-
-
-#ifndef URI_DOXYGEN
-# include <uriparser/Uri.h>
-# include "UriNormalizeBase.h"
-# include "UriCommon.h"
-# include "UriMemory.h"
-#endif
-
-
-
-#include <assert.h>
-
-
-
-static int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsigned int inMask,
- unsigned int * outMask, UriMemoryManager * memory);
-
-static UriBool URI_FUNC(MakeRangeOwner)(unsigned int * doneMask,
- unsigned int maskTest, URI_TYPE(TextRange) * range,
- UriMemoryManager * memory);
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file UriNormalize.c
+ * Holds the RFC 3986 %URI normalization implementation.
+ * NOTE: This source file includes itself twice.
+ */
+
+/* What encodings are enabled? */
+#include <uriparser/UriDefsConfig.h>
+#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* Include SELF twice */
+# ifdef URI_ENABLE_ANSI
+# define URI_PASS_ANSI 1
+# include "UriNormalize.c"
+# undef URI_PASS_ANSI
+# endif
+# ifdef URI_ENABLE_UNICODE
+# define URI_PASS_UNICODE 1
+# include "UriNormalize.c"
+# undef URI_PASS_UNICODE
+# endif
+#else
+# ifdef URI_PASS_ANSI
+# include <uriparser/UriDefsAnsi.h>
+# else
+# include <uriparser/UriDefsUnicode.h>
+# include <wchar.h>
+# endif
+
+
+
+#ifndef URI_DOXYGEN
+# include <uriparser/Uri.h>
+# include "UriNormalizeBase.h"
+# include "UriCommon.h"
+# include "UriMemory.h"
+#endif
+
+
+
+#include <assert.h>
+
+
+
+static int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsigned int inMask,
+ unsigned int * outMask, UriMemoryManager * memory);
+
+static UriBool URI_FUNC(MakeRangeOwner)(unsigned int * doneMask,
+ unsigned int maskTest, URI_TYPE(TextRange) * range,
+ UriMemoryManager * memory);
static UriBool URI_FUNC(MakeOwnerEngine)(URI_TYPE(Uri) * uri,
- unsigned int * doneMask, UriMemoryManager * memory);
-
-static void URI_FUNC(FixPercentEncodingInplace)(const URI_CHAR * first,
- const URI_CHAR ** afterLast);
-static UriBool URI_FUNC(FixPercentEncodingMalloc)(const URI_CHAR ** first,
- const URI_CHAR ** afterLast, UriMemoryManager * memory);
-static void URI_FUNC(FixPercentEncodingEngine)(
- const URI_CHAR * inFirst, const URI_CHAR * inAfterLast,
- const URI_CHAR * outFirst, const URI_CHAR ** outAfterLast);
-
-static UriBool URI_FUNC(ContainsUppercaseLetters)(const URI_CHAR * first,
- const URI_CHAR * afterLast);
-static UriBool URI_FUNC(ContainsUglyPercentEncoding)(const URI_CHAR * first,
- const URI_CHAR * afterLast);
-
-static void URI_FUNC(LowercaseInplace)(const URI_CHAR * first,
- const URI_CHAR * afterLast);
-static UriBool URI_FUNC(LowercaseMalloc)(const URI_CHAR ** first,
- const URI_CHAR ** afterLast, UriMemoryManager * memory);
-
-static void URI_FUNC(PreventLeakage)(URI_TYPE(Uri) * uri,
- unsigned int revertMask, UriMemoryManager * memory);
-
-
-
-static URI_INLINE void URI_FUNC(PreventLeakage)(URI_TYPE(Uri) * uri,
- unsigned int revertMask, UriMemoryManager * memory) {
- if (revertMask & URI_NORMALIZE_SCHEME) {
+ unsigned int * doneMask, UriMemoryManager * memory);
+
+static void URI_FUNC(FixPercentEncodingInplace)(const URI_CHAR * first,
+ const URI_CHAR ** afterLast);
+static UriBool URI_FUNC(FixPercentEncodingMalloc)(const URI_CHAR ** first,
+ const URI_CHAR ** afterLast, UriMemoryManager * memory);
+static void URI_FUNC(FixPercentEncodingEngine)(
+ const URI_CHAR * inFirst, const URI_CHAR * inAfterLast,
+ const URI_CHAR * outFirst, const URI_CHAR ** outAfterLast);
+
+static UriBool URI_FUNC(ContainsUppercaseLetters)(const URI_CHAR * first,
+ const URI_CHAR * afterLast);
+static UriBool URI_FUNC(ContainsUglyPercentEncoding)(const URI_CHAR * first,
+ const URI_CHAR * afterLast);
+
+static void URI_FUNC(LowercaseInplace)(const URI_CHAR * first,
+ const URI_CHAR * afterLast);
+static UriBool URI_FUNC(LowercaseMalloc)(const URI_CHAR ** first,
+ const URI_CHAR ** afterLast, UriMemoryManager * memory);
+
+static void URI_FUNC(PreventLeakage)(URI_TYPE(Uri) * uri,
+ unsigned int revertMask, UriMemoryManager * memory);
+
+
+
+static URI_INLINE void URI_FUNC(PreventLeakage)(URI_TYPE(Uri) * uri,
+ unsigned int revertMask, UriMemoryManager * memory) {
+ if (revertMask & URI_NORMALIZE_SCHEME) {
/* NOTE: A scheme cannot be the empty string
* so no need to compare .first with .afterLast, here. */
- memory->free(memory, (URI_CHAR *)uri->scheme.first);
- uri->scheme.first = NULL;
- uri->scheme.afterLast = NULL;
- }
-
- if (revertMask & URI_NORMALIZE_USER_INFO) {
+ memory->free(memory, (URI_CHAR *)uri->scheme.first);
+ uri->scheme.first = NULL;
+ uri->scheme.afterLast = NULL;
+ }
+
+ if (revertMask & URI_NORMALIZE_USER_INFO) {
if (uri->userInfo.first != uri->userInfo.afterLast) {
memory->free(memory, (URI_CHAR *)uri->userInfo.first);
}
- uri->userInfo.first = NULL;
- uri->userInfo.afterLast = NULL;
- }
-
- if (revertMask & URI_NORMALIZE_HOST) {
- if (uri->hostData.ipFuture.first != NULL) {
- /* IPvFuture */
+ uri->userInfo.first = NULL;
+ uri->userInfo.afterLast = NULL;
+ }
+
+ if (revertMask & URI_NORMALIZE_HOST) {
+ if (uri->hostData.ipFuture.first != NULL) {
+ /* IPvFuture */
/* NOTE: An IPvFuture address cannot be the empty string
* so no need to compare .first with .afterLast, here. */
- memory->free(memory, (URI_CHAR *)uri->hostData.ipFuture.first);
- uri->hostData.ipFuture.first = NULL;
- uri->hostData.ipFuture.afterLast = NULL;
- uri->hostText.first = NULL;
- uri->hostText.afterLast = NULL;
+ memory->free(memory, (URI_CHAR *)uri->hostData.ipFuture.first);
+ uri->hostData.ipFuture.first = NULL;
+ uri->hostData.ipFuture.afterLast = NULL;
+ uri->hostText.first = NULL;
+ uri->hostText.afterLast = NULL;
} else if (uri->hostText.first != NULL) {
- /* Regname */
+ /* Regname */
if (uri->hostText.first != uri->hostText.afterLast) {
memory->free(memory, (URI_CHAR *)uri->hostText.first);
}
- uri->hostText.first = NULL;
- uri->hostText.afterLast = NULL;
- }
- }
-
- /* NOTE: Port cannot happen! */
-
- if (revertMask & URI_NORMALIZE_PATH) {
- URI_TYPE(PathSegment) * walker = uri->pathHead;
- while (walker != NULL) {
- URI_TYPE(PathSegment) * const next = walker->next;
- if (walker->text.afterLast > walker->text.first) {
- memory->free(memory, (URI_CHAR *)walker->text.first);
- }
- memory->free(memory, walker);
- walker = next;
- }
- uri->pathHead = NULL;
- uri->pathTail = NULL;
- }
-
- if (revertMask & URI_NORMALIZE_QUERY) {
+ uri->hostText.first = NULL;
+ uri->hostText.afterLast = NULL;
+ }
+ }
+
+ /* NOTE: Port cannot happen! */
+
+ if (revertMask & URI_NORMALIZE_PATH) {
+ URI_TYPE(PathSegment) * walker = uri->pathHead;
+ while (walker != NULL) {
+ URI_TYPE(PathSegment) * const next = walker->next;
+ if (walker->text.afterLast > walker->text.first) {
+ memory->free(memory, (URI_CHAR *)walker->text.first);
+ }
+ memory->free(memory, walker);
+ walker = next;
+ }
+ uri->pathHead = NULL;
+ uri->pathTail = NULL;
+ }
+
+ if (revertMask & URI_NORMALIZE_QUERY) {
if (uri->query.first != uri->query.afterLast) {
memory->free(memory, (URI_CHAR *)uri->query.first);
}
- uri->query.first = NULL;
- uri->query.afterLast = NULL;
- }
-
- if (revertMask & URI_NORMALIZE_FRAGMENT) {
+ uri->query.first = NULL;
+ uri->query.afterLast = NULL;
+ }
+
+ if (revertMask & URI_NORMALIZE_FRAGMENT) {
if (uri->fragment.first != uri->fragment.afterLast) {
memory->free(memory, (URI_CHAR *)uri->fragment.first);
}
- uri->fragment.first = NULL;
- uri->fragment.afterLast = NULL;
- }
-}
-
-
-
-static URI_INLINE UriBool URI_FUNC(ContainsUppercaseLetters)(const URI_CHAR * first,
- const URI_CHAR * afterLast) {
- if ((first != NULL) && (afterLast != NULL) && (afterLast > first)) {
- const URI_CHAR * i = first;
- for (; i < afterLast; i++) {
- /* 6.2.2.1 Case Normalization: uppercase letters in scheme or host */
- if ((*i >= _UT('A')) && (*i <= _UT('Z'))) {
- return URI_TRUE;
- }
- }
- }
- return URI_FALSE;
-}
-
-
-
-static URI_INLINE UriBool URI_FUNC(ContainsUglyPercentEncoding)(const URI_CHAR * first,
- const URI_CHAR * afterLast) {
- if ((first != NULL) && (afterLast != NULL) && (afterLast > first)) {
- const URI_CHAR * i = first;
- for (; i + 2 < afterLast; i++) {
- if (i[0] == _UT('%')) {
- /* 6.2.2.1 Case Normalization: *
- * lowercase percent-encodings */
- if (((i[1] >= _UT('a')) && (i[1] <= _UT('f')))
- || ((i[2] >= _UT('a')) && (i[2] <= _UT('f')))) {
- return URI_TRUE;
- } else {
- /* 6.2.2.2 Percent-Encoding Normalization: *
- * percent-encoded unreserved characters */
- const unsigned char left = URI_FUNC(HexdigToInt)(i[1]);
- const unsigned char right = URI_FUNC(HexdigToInt)(i[2]);
- const int code = 16 * left + right;
- if (uriIsUnreserved(code)) {
- return URI_TRUE;
- }
- }
- }
- }
- }
- return URI_FALSE;
-}
-
-
-
-static URI_INLINE void URI_FUNC(LowercaseInplace)(const URI_CHAR * first,
- const URI_CHAR * afterLast) {
- if ((first != NULL) && (afterLast != NULL) && (afterLast > first)) {
- URI_CHAR * i = (URI_CHAR *)first;
- const int lowerUpperDiff = (_UT('a') - _UT('A'));
- for (; i < afterLast; i++) {
- if ((*i >= _UT('A')) && (*i <=_UT('Z'))) {
- *i = (URI_CHAR)(*i + lowerUpperDiff);
- }
- }
- }
-}
-
-
-
-static URI_INLINE UriBool URI_FUNC(LowercaseMalloc)(const URI_CHAR ** first,
- const URI_CHAR ** afterLast, UriMemoryManager * memory) {
- int lenInChars;
- const int lowerUpperDiff = (_UT('a') - _UT('A'));
- URI_CHAR * buffer;
- int i = 0;
-
- if ((first == NULL) || (afterLast == NULL) || (*first == NULL)
- || (*afterLast == NULL)) {
- return URI_FALSE;
- }
-
- lenInChars = (int)(*afterLast - *first);
- if (lenInChars == 0) {
- return URI_TRUE;
- } else if (lenInChars < 0) {
- return URI_FALSE;
- }
-
- buffer = memory->malloc(memory, lenInChars * sizeof(URI_CHAR));
- if (buffer == NULL) {
- return URI_FALSE;
- }
-
- for (; i < lenInChars; i++) {
- if (((*first)[i] >= _UT('A')) && ((*first)[i] <=_UT('Z'))) {
- buffer[i] = (URI_CHAR)((*first)[i] + lowerUpperDiff);
- } else {
- buffer[i] = (*first)[i];
- }
- }
-
- *first = buffer;
- *afterLast = buffer + lenInChars;
- return URI_TRUE;
-}
-
-
-
-/* NOTE: Implementation must stay inplace-compatible */
-static URI_INLINE void URI_FUNC(FixPercentEncodingEngine)(
- const URI_CHAR * inFirst, const URI_CHAR * inAfterLast,
- const URI_CHAR * outFirst, const URI_CHAR ** outAfterLast) {
- URI_CHAR * write = (URI_CHAR *)outFirst;
- const int lenInChars = (int)(inAfterLast - inFirst);
- int i = 0;
-
- /* All but last two */
- for (; i + 2 < lenInChars; i++) {
- if (inFirst[i] != _UT('%')) {
- write[0] = inFirst[i];
- write++;
- } else {
- /* 6.2.2.2 Percent-Encoding Normalization: *
- * percent-encoded unreserved characters */
- const URI_CHAR one = inFirst[i + 1];
- const URI_CHAR two = inFirst[i + 2];
- const unsigned char left = URI_FUNC(HexdigToInt)(one);
- const unsigned char right = URI_FUNC(HexdigToInt)(two);
- const int code = 16 * left + right;
- if (uriIsUnreserved(code)) {
- write[0] = (URI_CHAR)(code);
- write++;
- } else {
- /* 6.2.2.1 Case Normalization: *
- * lowercase percent-encodings */
- write[0] = _UT('%');
- write[1] = URI_FUNC(HexToLetter)(left);
- write[2] = URI_FUNC(HexToLetter)(right);
- write += 3;
- }
-
- i += 2; /* For the two chars of the percent group we just ate */
- }
- }
-
- /* Last two */
- for (; i < lenInChars; i++) {
- write[0] = inFirst[i];
- write++;
- }
-
- *outAfterLast = write;
-}
-
-
-
-static URI_INLINE void URI_FUNC(FixPercentEncodingInplace)(const URI_CHAR * first,
- const URI_CHAR ** afterLast) {
- /* Death checks */
- if ((first == NULL) || (afterLast == NULL) || (*afterLast == NULL)) {
- return;
- }
-
- /* Fix inplace */
- URI_FUNC(FixPercentEncodingEngine)(first, *afterLast, first, afterLast);
-}
-
-
-
-static URI_INLINE UriBool URI_FUNC(FixPercentEncodingMalloc)(const URI_CHAR ** first,
- const URI_CHAR ** afterLast, UriMemoryManager * memory) {
- int lenInChars;
- URI_CHAR * buffer;
-
- /* Death checks */
- if ((first == NULL) || (afterLast == NULL)
- || (*first == NULL) || (*afterLast == NULL)) {
- return URI_FALSE;
- }
-
- /* Old text length */
- lenInChars = (int)(*afterLast - *first);
- if (lenInChars == 0) {
- return URI_TRUE;
- } else if (lenInChars < 0) {
- return URI_FALSE;
- }
-
- /* New buffer */
- buffer = memory->malloc(memory, lenInChars * sizeof(URI_CHAR));
- if (buffer == NULL) {
- return URI_FALSE;
- }
-
- /* Fix on copy */
- URI_FUNC(FixPercentEncodingEngine)(*first, *afterLast, buffer, afterLast);
- *first = buffer;
- return URI_TRUE;
-}
-
-
-
-static URI_INLINE UriBool URI_FUNC(MakeRangeOwner)(unsigned int * doneMask,
- unsigned int maskTest, URI_TYPE(TextRange) * range,
- UriMemoryManager * memory) {
- if (((*doneMask & maskTest) == 0)
- && (range->first != NULL)
- && (range->afterLast != NULL)
- && (range->afterLast > range->first)) {
- const int lenInChars = (int)(range->afterLast - range->first);
- const int lenInBytes = lenInChars * sizeof(URI_CHAR);
- URI_CHAR * dup = memory->malloc(memory, lenInBytes);
- if (dup == NULL) {
- return URI_FALSE; /* Raises malloc error */
- }
- memcpy(dup, range->first, lenInBytes);
- range->first = dup;
- range->afterLast = dup + lenInChars;
- *doneMask |= maskTest;
- }
- return URI_TRUE;
-}
-
-
-
+ uri->fragment.first = NULL;
+ uri->fragment.afterLast = NULL;
+ }
+}
+
+
+
+static URI_INLINE UriBool URI_FUNC(ContainsUppercaseLetters)(const URI_CHAR * first,
+ const URI_CHAR * afterLast) {
+ if ((first != NULL) && (afterLast != NULL) && (afterLast > first)) {
+ const URI_CHAR * i = first;
+ for (; i < afterLast; i++) {
+ /* 6.2.2.1 Case Normalization: uppercase letters in scheme or host */
+ if ((*i >= _UT('A')) && (*i <= _UT('Z'))) {
+ return URI_TRUE;
+ }
+ }
+ }
+ return URI_FALSE;
+}
+
+
+
+static URI_INLINE UriBool URI_FUNC(ContainsUglyPercentEncoding)(const URI_CHAR * first,
+ const URI_CHAR * afterLast) {
+ if ((first != NULL) && (afterLast != NULL) && (afterLast > first)) {
+ const URI_CHAR * i = first;
+ for (; i + 2 < afterLast; i++) {
+ if (i[0] == _UT('%')) {
+ /* 6.2.2.1 Case Normalization: *
+ * lowercase percent-encodings */
+ if (((i[1] >= _UT('a')) && (i[1] <= _UT('f')))
+ || ((i[2] >= _UT('a')) && (i[2] <= _UT('f')))) {
+ return URI_TRUE;
+ } else {
+ /* 6.2.2.2 Percent-Encoding Normalization: *
+ * percent-encoded unreserved characters */
+ const unsigned char left = URI_FUNC(HexdigToInt)(i[1]);
+ const unsigned char right = URI_FUNC(HexdigToInt)(i[2]);
+ const int code = 16 * left + right;
+ if (uriIsUnreserved(code)) {
+ return URI_TRUE;
+ }
+ }
+ }
+ }
+ }
+ return URI_FALSE;
+}
+
+
+
+static URI_INLINE void URI_FUNC(LowercaseInplace)(const URI_CHAR * first,
+ const URI_CHAR * afterLast) {
+ if ((first != NULL) && (afterLast != NULL) && (afterLast > first)) {
+ URI_CHAR * i = (URI_CHAR *)first;
+ const int lowerUpperDiff = (_UT('a') - _UT('A'));
+ for (; i < afterLast; i++) {
+ if ((*i >= _UT('A')) && (*i <=_UT('Z'))) {
+ *i = (URI_CHAR)(*i + lowerUpperDiff);
+ }
+ }
+ }
+}
+
+
+
+static URI_INLINE UriBool URI_FUNC(LowercaseMalloc)(const URI_CHAR ** first,
+ const URI_CHAR ** afterLast, UriMemoryManager * memory) {
+ int lenInChars;
+ const int lowerUpperDiff = (_UT('a') - _UT('A'));
+ URI_CHAR * buffer;
+ int i = 0;
+
+ if ((first == NULL) || (afterLast == NULL) || (*first == NULL)
+ || (*afterLast == NULL)) {
+ return URI_FALSE;
+ }
+
+ lenInChars = (int)(*afterLast - *first);
+ if (lenInChars == 0) {
+ return URI_TRUE;
+ } else if (lenInChars < 0) {
+ return URI_FALSE;
+ }
+
+ buffer = memory->malloc(memory, lenInChars * sizeof(URI_CHAR));
+ if (buffer == NULL) {
+ return URI_FALSE;
+ }
+
+ for (; i < lenInChars; i++) {
+ if (((*first)[i] >= _UT('A')) && ((*first)[i] <=_UT('Z'))) {
+ buffer[i] = (URI_CHAR)((*first)[i] + lowerUpperDiff);
+ } else {
+ buffer[i] = (*first)[i];
+ }
+ }
+
+ *first = buffer;
+ *afterLast = buffer + lenInChars;
+ return URI_TRUE;
+}
+
+
+
+/* NOTE: Implementation must stay inplace-compatible */
+static URI_INLINE void URI_FUNC(FixPercentEncodingEngine)(
+ const URI_CHAR * inFirst, const URI_CHAR * inAfterLast,
+ const URI_CHAR * outFirst, const URI_CHAR ** outAfterLast) {
+ URI_CHAR * write = (URI_CHAR *)outFirst;
+ const int lenInChars = (int)(inAfterLast - inFirst);
+ int i = 0;
+
+ /* All but last two */
+ for (; i + 2 < lenInChars; i++) {
+ if (inFirst[i] != _UT('%')) {
+ write[0] = inFirst[i];
+ write++;
+ } else {
+ /* 6.2.2.2 Percent-Encoding Normalization: *
+ * percent-encoded unreserved characters */
+ const URI_CHAR one = inFirst[i + 1];
+ const URI_CHAR two = inFirst[i + 2];
+ const unsigned char left = URI_FUNC(HexdigToInt)(one);
+ const unsigned char right = URI_FUNC(HexdigToInt)(two);
+ const int code = 16 * left + right;
+ if (uriIsUnreserved(code)) {
+ write[0] = (URI_CHAR)(code);
+ write++;
+ } else {
+ /* 6.2.2.1 Case Normalization: *
+ * lowercase percent-encodings */
+ write[0] = _UT('%');
+ write[1] = URI_FUNC(HexToLetter)(left);
+ write[2] = URI_FUNC(HexToLetter)(right);
+ write += 3;
+ }
+
+ i += 2; /* For the two chars of the percent group we just ate */
+ }
+ }
+
+ /* Last two */
+ for (; i < lenInChars; i++) {
+ write[0] = inFirst[i];
+ write++;
+ }
+
+ *outAfterLast = write;
+}
+
+
+
+static URI_INLINE void URI_FUNC(FixPercentEncodingInplace)(const URI_CHAR * first,
+ const URI_CHAR ** afterLast) {
+ /* Death checks */
+ if ((first == NULL) || (afterLast == NULL) || (*afterLast == NULL)) {
+ return;
+ }
+
+ /* Fix inplace */
+ URI_FUNC(FixPercentEncodingEngine)(first, *afterLast, first, afterLast);
+}
+
+
+
+static URI_INLINE UriBool URI_FUNC(FixPercentEncodingMalloc)(const URI_CHAR ** first,
+ const URI_CHAR ** afterLast, UriMemoryManager * memory) {
+ int lenInChars;
+ URI_CHAR * buffer;
+
+ /* Death checks */
+ if ((first == NULL) || (afterLast == NULL)
+ || (*first == NULL) || (*afterLast == NULL)) {
+ return URI_FALSE;
+ }
+
+ /* Old text length */
+ lenInChars = (int)(*afterLast - *first);
+ if (lenInChars == 0) {
+ return URI_TRUE;
+ } else if (lenInChars < 0) {
+ return URI_FALSE;
+ }
+
+ /* New buffer */
+ buffer = memory->malloc(memory, lenInChars * sizeof(URI_CHAR));
+ if (buffer == NULL) {
+ return URI_FALSE;
+ }
+
+ /* Fix on copy */
+ URI_FUNC(FixPercentEncodingEngine)(*first, *afterLast, buffer, afterLast);
+ *first = buffer;
+ return URI_TRUE;
+}
+
+
+
+static URI_INLINE UriBool URI_FUNC(MakeRangeOwner)(unsigned int * doneMask,
+ unsigned int maskTest, URI_TYPE(TextRange) * range,
+ UriMemoryManager * memory) {
+ if (((*doneMask & maskTest) == 0)
+ && (range->first != NULL)
+ && (range->afterLast != NULL)
+ && (range->afterLast > range->first)) {
+ const int lenInChars = (int)(range->afterLast - range->first);
+ const int lenInBytes = lenInChars * sizeof(URI_CHAR);
+ URI_CHAR * dup = memory->malloc(memory, lenInBytes);
+ if (dup == NULL) {
+ return URI_FALSE; /* Raises malloc error */
+ }
+ memcpy(dup, range->first, lenInBytes);
+ range->first = dup;
+ range->afterLast = dup + lenInChars;
+ *doneMask |= maskTest;
+ }
+ return URI_TRUE;
+}
+
+
+
static URI_INLINE UriBool URI_FUNC(MakeOwnerEngine)(URI_TYPE(Uri) * uri,
- unsigned int * doneMask, UriMemoryManager * memory) {
- URI_TYPE(PathSegment) * walker = uri->pathHead;
- if (!URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_SCHEME,
- &(uri->scheme), memory)
- || !URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_USER_INFO,
- &(uri->userInfo), memory)
- || !URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_QUERY,
- &(uri->query), memory)
- || !URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_FRAGMENT,
- &(uri->fragment), memory)) {
- return URI_FALSE; /* Raises malloc error */
- }
-
- /* Host */
- if ((*doneMask & URI_NORMALIZE_HOST) == 0) {
+ unsigned int * doneMask, UriMemoryManager * memory) {
+ URI_TYPE(PathSegment) * walker = uri->pathHead;
+ if (!URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_SCHEME,
+ &(uri->scheme), memory)
+ || !URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_USER_INFO,
+ &(uri->userInfo), memory)
+ || !URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_QUERY,
+ &(uri->query), memory)
+ || !URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_FRAGMENT,
+ &(uri->fragment), memory)) {
+ return URI_FALSE; /* Raises malloc error */
+ }
+
+ /* Host */
+ if ((*doneMask & URI_NORMALIZE_HOST) == 0) {
if (uri->hostData.ipFuture.first != NULL) {
/* IPvFuture */
if (!URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_HOST,
&(uri->hostData.ipFuture), memory)) {
return URI_FALSE; /* Raises malloc error */
- }
+ }
uri->hostText.first = uri->hostData.ipFuture.first;
uri->hostText.afterLast = uri->hostData.ipFuture.afterLast;
} else if (uri->hostText.first != NULL) {
@@ -431,350 +431,350 @@ static URI_INLINE UriBool URI_FUNC(MakeOwnerEngine)(URI_TYPE(Uri) * uri,
&(uri->hostText), memory)) {
return URI_FALSE; /* Raises malloc error */
}
- }
- }
-
- /* Path */
- if ((*doneMask & URI_NORMALIZE_PATH) == 0) {
- while (walker != NULL) {
- if (!URI_FUNC(MakeRangeOwner)(doneMask, 0, &(walker->text), memory)) {
- /* Free allocations done so far and kill path */
-
- /* Kill path to one before walker (if any) */
- URI_TYPE(PathSegment) * ranger = uri->pathHead;
- while (ranger != walker) {
- URI_TYPE(PathSegment) * const next = ranger->next;
- if ((ranger->text.first != NULL)
- && (ranger->text.afterLast != NULL)
- && (ranger->text.afterLast > ranger->text.first)) {
- memory->free(memory, (URI_CHAR *)ranger->text.first);
- }
- memory->free(memory, ranger);
- ranger = next;
- }
-
- /* Kill path from walker */
- while (walker != NULL) {
- URI_TYPE(PathSegment) * const next = walker->next;
- memory->free(memory, walker);
- walker = next;
- }
-
- uri->pathHead = NULL;
- uri->pathTail = NULL;
- return URI_FALSE; /* Raises malloc error */
- }
- walker = walker->next;
- }
- *doneMask |= URI_NORMALIZE_PATH;
- }
-
- /* Port text, must come last so we don't have to undo that one if it fails. *
- * Otherwise we would need and extra enum flag for it although the port *
- * cannot go unnormalized... */
- if (!URI_FUNC(MakeRangeOwner)(doneMask, 0, &(uri->portText), memory)) {
- return URI_FALSE; /* Raises malloc error */
- }
-
- return URI_TRUE;
-}
-
-
-
-unsigned int URI_FUNC(NormalizeSyntaxMaskRequired)(const URI_TYPE(Uri) * uri) {
- unsigned int outMask = URI_NORMALIZED; /* for NULL uri */
- URI_FUNC(NormalizeSyntaxMaskRequiredEx)(uri, &outMask);
- return outMask;
-}
-
-
-
-int URI_FUNC(NormalizeSyntaxMaskRequiredEx)(const URI_TYPE(Uri) * uri,
- unsigned int * outMask) {
- UriMemoryManager * const memory = NULL; /* no use of memory manager */
-
-#if defined(__GNUC__) && ((__GNUC__ > 4) \
- || ((__GNUC__ == 4) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 2)))
- /* Slower code that fixes a warning, not sure if this is a smart idea */
- URI_TYPE(Uri) writeableClone;
-#endif
-
- if ((uri == NULL) || (outMask == NULL)) {
- return URI_ERROR_NULL;
- }
-
-#if defined(__GNUC__) && ((__GNUC__ > 4) \
- || ((__GNUC__ == 4) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 2)))
- /* Slower code that fixes a warning, not sure if this is a smart idea */
- memcpy(&writeableClone, uri, 1 * sizeof(URI_TYPE(Uri)));
- URI_FUNC(NormalizeSyntaxEngine)(&writeableClone, 0, outMask, memory);
-#else
- URI_FUNC(NormalizeSyntaxEngine)((URI_TYPE(Uri) *)uri, 0, outMask, memory);
-#endif
- return URI_SUCCESS;
-}
-
-
-
-int URI_FUNC(NormalizeSyntaxEx)(URI_TYPE(Uri) * uri, unsigned int mask) {
- return URI_FUNC(NormalizeSyntaxExMm)(uri, mask, NULL);
-}
-
-
-
-int URI_FUNC(NormalizeSyntaxExMm)(URI_TYPE(Uri) * uri, unsigned int mask,
- UriMemoryManager * memory) {
- URI_CHECK_MEMORY_MANAGER(memory); /* may return */
- return URI_FUNC(NormalizeSyntaxEngine)(uri, mask, NULL, memory);
-}
-
-
-
-int URI_FUNC(NormalizeSyntax)(URI_TYPE(Uri) * uri) {
- return URI_FUNC(NormalizeSyntaxEx)(uri, (unsigned int)-1);
-}
-
-
-
-static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
- unsigned int inMask, unsigned int * outMask,
- UriMemoryManager * memory) {
- unsigned int doneMask = URI_NORMALIZED;
-
- /* Not just doing inspection? -> memory manager required! */
- if (outMask == NULL) {
- assert(memory != NULL);
- }
-
- if (uri == NULL) {
- if (outMask != NULL) {
- *outMask = URI_NORMALIZED;
- return URI_SUCCESS;
- } else {
- return URI_ERROR_NULL;
- }
- }
-
- if (outMask != NULL) {
- /* Reset mask */
- *outMask = URI_NORMALIZED;
- } else if (inMask == URI_NORMALIZED) {
- /* Nothing to do */
- return URI_SUCCESS;
- }
-
- /* Scheme, host */
- if (outMask != NULL) {
- const UriBool normalizeScheme = URI_FUNC(ContainsUppercaseLetters)(
- uri->scheme.first, uri->scheme.afterLast);
- const UriBool normalizeHostCase = URI_FUNC(ContainsUppercaseLetters)(
- uri->hostText.first, uri->hostText.afterLast);
- if (normalizeScheme) {
- *outMask |= URI_NORMALIZE_SCHEME;
- }
-
- if (normalizeHostCase) {
- *outMask |= URI_NORMALIZE_HOST;
- } else {
- const UriBool normalizeHostPrecent = URI_FUNC(ContainsUglyPercentEncoding)(
- uri->hostText.first, uri->hostText.afterLast);
- if (normalizeHostPrecent) {
- *outMask |= URI_NORMALIZE_HOST;
- }
- }
- } else {
- /* Scheme */
- if ((inMask & URI_NORMALIZE_SCHEME) && (uri->scheme.first != NULL)) {
- if (uri->owner) {
- URI_FUNC(LowercaseInplace)(uri->scheme.first, uri->scheme.afterLast);
- } else {
- if (!URI_FUNC(LowercaseMalloc)(&(uri->scheme.first), &(uri->scheme.afterLast), memory)) {
- URI_FUNC(PreventLeakage)(uri, doneMask, memory);
- return URI_ERROR_MALLOC;
- }
- doneMask |= URI_NORMALIZE_SCHEME;
- }
- }
-
- /* Host */
- if (inMask & URI_NORMALIZE_HOST) {
- if (uri->hostData.ipFuture.first != NULL) {
- /* IPvFuture */
- if (uri->owner) {
- URI_FUNC(LowercaseInplace)(uri->hostData.ipFuture.first,
- uri->hostData.ipFuture.afterLast);
- } else {
- if (!URI_FUNC(LowercaseMalloc)(&(uri->hostData.ipFuture.first),
- &(uri->hostData.ipFuture.afterLast), memory)) {
- URI_FUNC(PreventLeakage)(uri, doneMask, memory);
- return URI_ERROR_MALLOC;
- }
- doneMask |= URI_NORMALIZE_HOST;
- }
- uri->hostText.first = uri->hostData.ipFuture.first;
- uri->hostText.afterLast = uri->hostData.ipFuture.afterLast;
- } else if ((uri->hostText.first != NULL)
- && (uri->hostData.ip4 == NULL)
- && (uri->hostData.ip6 == NULL)) {
- /* Regname */
- if (uri->owner) {
- URI_FUNC(FixPercentEncodingInplace)(uri->hostText.first,
- &(uri->hostText.afterLast));
- } else {
- if (!URI_FUNC(FixPercentEncodingMalloc)(
- &(uri->hostText.first),
- &(uri->hostText.afterLast),
- memory)) {
- URI_FUNC(PreventLeakage)(uri, doneMask, memory);
- return URI_ERROR_MALLOC;
- }
- doneMask |= URI_NORMALIZE_HOST;
- }
-
- URI_FUNC(LowercaseInplace)(uri->hostText.first,
- uri->hostText.afterLast);
- }
- }
- }
-
- /* User info */
- if (outMask != NULL) {
- const UriBool normalizeUserInfo = URI_FUNC(ContainsUglyPercentEncoding)(
- uri->userInfo.first, uri->userInfo.afterLast);
- if (normalizeUserInfo) {
- *outMask |= URI_NORMALIZE_USER_INFO;
- }
- } else {
- if ((inMask & URI_NORMALIZE_USER_INFO) && (uri->userInfo.first != NULL)) {
- if (uri->owner) {
- URI_FUNC(FixPercentEncodingInplace)(uri->userInfo.first, &(uri->userInfo.afterLast));
- } else {
- if (!URI_FUNC(FixPercentEncodingMalloc)(&(uri->userInfo.first),
- &(uri->userInfo.afterLast), memory)) {
- URI_FUNC(PreventLeakage)(uri, doneMask, memory);
- return URI_ERROR_MALLOC;
- }
- doneMask |= URI_NORMALIZE_USER_INFO;
- }
- }
- }
-
- /* Path */
- if (outMask != NULL) {
- const URI_TYPE(PathSegment) * walker = uri->pathHead;
- while (walker != NULL) {
- const URI_CHAR * const first = walker->text.first;
- const URI_CHAR * const afterLast = walker->text.afterLast;
- if ((first != NULL)
- && (afterLast != NULL)
- && (afterLast > first)
- && (
- (((afterLast - first) == 1)
- && (first[0] == _UT('.')))
- ||
- (((afterLast - first) == 2)
- && (first[0] == _UT('.'))
- && (first[1] == _UT('.')))
- ||
- URI_FUNC(ContainsUglyPercentEncoding)(first, afterLast)
- )) {
- *outMask |= URI_NORMALIZE_PATH;
- break;
- }
- walker = walker->next;
- }
- } else if (inMask & URI_NORMALIZE_PATH) {
- URI_TYPE(PathSegment) * walker;
- const UriBool relative = ((uri->scheme.first == NULL)
- && !uri->absolutePath) ? URI_TRUE : URI_FALSE;
-
- /* Fix percent-encoding for each segment */
- walker = uri->pathHead;
- if (uri->owner) {
- while (walker != NULL) {
- URI_FUNC(FixPercentEncodingInplace)(walker->text.first, &(walker->text.afterLast));
- walker = walker->next;
- }
- } else {
- while (walker != NULL) {
- if (!URI_FUNC(FixPercentEncodingMalloc)(&(walker->text.first),
- &(walker->text.afterLast), memory)) {
- URI_FUNC(PreventLeakage)(uri, doneMask, memory);
- return URI_ERROR_MALLOC;
- }
- walker = walker->next;
- }
- doneMask |= URI_NORMALIZE_PATH;
- }
-
- /* 6.2.2.3 Path Segment Normalization */
- if (!URI_FUNC(RemoveDotSegmentsEx)(uri, relative,
- (uri->owner == URI_TRUE)
- || ((doneMask & URI_NORMALIZE_PATH) != 0),
- memory)) {
- URI_FUNC(PreventLeakage)(uri, doneMask, memory);
- return URI_ERROR_MALLOC;
- }
- URI_FUNC(FixEmptyTrailSegment)(uri, memory);
- }
-
- /* Query, fragment */
- if (outMask != NULL) {
- const UriBool normalizeQuery = URI_FUNC(ContainsUglyPercentEncoding)(
- uri->query.first, uri->query.afterLast);
- const UriBool normalizeFragment = URI_FUNC(ContainsUglyPercentEncoding)(
- uri->fragment.first, uri->fragment.afterLast);
- if (normalizeQuery) {
- *outMask |= URI_NORMALIZE_QUERY;
- }
-
- if (normalizeFragment) {
- *outMask |= URI_NORMALIZE_FRAGMENT;
- }
- } else {
- /* Query */
- if ((inMask & URI_NORMALIZE_QUERY) && (uri->query.first != NULL)) {
- if (uri->owner) {
- URI_FUNC(FixPercentEncodingInplace)(uri->query.first, &(uri->query.afterLast));
- } else {
- if (!URI_FUNC(FixPercentEncodingMalloc)(&(uri->query.first),
- &(uri->query.afterLast), memory)) {
- URI_FUNC(PreventLeakage)(uri, doneMask, memory);
- return URI_ERROR_MALLOC;
- }
- doneMask |= URI_NORMALIZE_QUERY;
- }
- }
-
- /* Fragment */
- if ((inMask & URI_NORMALIZE_FRAGMENT) && (uri->fragment.first != NULL)) {
- if (uri->owner) {
- URI_FUNC(FixPercentEncodingInplace)(uri->fragment.first, &(uri->fragment.afterLast));
- } else {
- if (!URI_FUNC(FixPercentEncodingMalloc)(&(uri->fragment.first),
- &(uri->fragment.afterLast), memory)) {
- URI_FUNC(PreventLeakage)(uri, doneMask, memory);
- return URI_ERROR_MALLOC;
- }
- doneMask |= URI_NORMALIZE_FRAGMENT;
- }
- }
- }
-
- /* Dup all not duped yet */
- if ((outMask == NULL) && !uri->owner) {
+ }
+ }
+
+ /* Path */
+ if ((*doneMask & URI_NORMALIZE_PATH) == 0) {
+ while (walker != NULL) {
+ if (!URI_FUNC(MakeRangeOwner)(doneMask, 0, &(walker->text), memory)) {
+ /* Free allocations done so far and kill path */
+
+ /* Kill path to one before walker (if any) */
+ URI_TYPE(PathSegment) * ranger = uri->pathHead;
+ while (ranger != walker) {
+ URI_TYPE(PathSegment) * const next = ranger->next;
+ if ((ranger->text.first != NULL)
+ && (ranger->text.afterLast != NULL)
+ && (ranger->text.afterLast > ranger->text.first)) {
+ memory->free(memory, (URI_CHAR *)ranger->text.first);
+ }
+ memory->free(memory, ranger);
+ ranger = next;
+ }
+
+ /* Kill path from walker */
+ while (walker != NULL) {
+ URI_TYPE(PathSegment) * const next = walker->next;
+ memory->free(memory, walker);
+ walker = next;
+ }
+
+ uri->pathHead = NULL;
+ uri->pathTail = NULL;
+ return URI_FALSE; /* Raises malloc error */
+ }
+ walker = walker->next;
+ }
+ *doneMask |= URI_NORMALIZE_PATH;
+ }
+
+ /* Port text, must come last so we don't have to undo that one if it fails. *
+ * Otherwise we would need and extra enum flag for it although the port *
+ * cannot go unnormalized... */
+ if (!URI_FUNC(MakeRangeOwner)(doneMask, 0, &(uri->portText), memory)) {
+ return URI_FALSE; /* Raises malloc error */
+ }
+
+ return URI_TRUE;
+}
+
+
+
+unsigned int URI_FUNC(NormalizeSyntaxMaskRequired)(const URI_TYPE(Uri) * uri) {
+ unsigned int outMask = URI_NORMALIZED; /* for NULL uri */
+ URI_FUNC(NormalizeSyntaxMaskRequiredEx)(uri, &outMask);
+ return outMask;
+}
+
+
+
+int URI_FUNC(NormalizeSyntaxMaskRequiredEx)(const URI_TYPE(Uri) * uri,
+ unsigned int * outMask) {
+ UriMemoryManager * const memory = NULL; /* no use of memory manager */
+
+#if defined(__GNUC__) && ((__GNUC__ > 4) \
+ || ((__GNUC__ == 4) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 2)))
+ /* Slower code that fixes a warning, not sure if this is a smart idea */
+ URI_TYPE(Uri) writeableClone;
+#endif
+
+ if ((uri == NULL) || (outMask == NULL)) {
+ return URI_ERROR_NULL;
+ }
+
+#if defined(__GNUC__) && ((__GNUC__ > 4) \
+ || ((__GNUC__ == 4) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 2)))
+ /* Slower code that fixes a warning, not sure if this is a smart idea */
+ memcpy(&writeableClone, uri, 1 * sizeof(URI_TYPE(Uri)));
+ URI_FUNC(NormalizeSyntaxEngine)(&writeableClone, 0, outMask, memory);
+#else
+ URI_FUNC(NormalizeSyntaxEngine)((URI_TYPE(Uri) *)uri, 0, outMask, memory);
+#endif
+ return URI_SUCCESS;
+}
+
+
+
+int URI_FUNC(NormalizeSyntaxEx)(URI_TYPE(Uri) * uri, unsigned int mask) {
+ return URI_FUNC(NormalizeSyntaxExMm)(uri, mask, NULL);
+}
+
+
+
+int URI_FUNC(NormalizeSyntaxExMm)(URI_TYPE(Uri) * uri, unsigned int mask,
+ UriMemoryManager * memory) {
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+ return URI_FUNC(NormalizeSyntaxEngine)(uri, mask, NULL, memory);
+}
+
+
+
+int URI_FUNC(NormalizeSyntax)(URI_TYPE(Uri) * uri) {
+ return URI_FUNC(NormalizeSyntaxEx)(uri, (unsigned int)-1);
+}
+
+
+
+static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
+ unsigned int inMask, unsigned int * outMask,
+ UriMemoryManager * memory) {
+ unsigned int doneMask = URI_NORMALIZED;
+
+ /* Not just doing inspection? -> memory manager required! */
+ if (outMask == NULL) {
+ assert(memory != NULL);
+ }
+
+ if (uri == NULL) {
+ if (outMask != NULL) {
+ *outMask = URI_NORMALIZED;
+ return URI_SUCCESS;
+ } else {
+ return URI_ERROR_NULL;
+ }
+ }
+
+ if (outMask != NULL) {
+ /* Reset mask */
+ *outMask = URI_NORMALIZED;
+ } else if (inMask == URI_NORMALIZED) {
+ /* Nothing to do */
+ return URI_SUCCESS;
+ }
+
+ /* Scheme, host */
+ if (outMask != NULL) {
+ const UriBool normalizeScheme = URI_FUNC(ContainsUppercaseLetters)(
+ uri->scheme.first, uri->scheme.afterLast);
+ const UriBool normalizeHostCase = URI_FUNC(ContainsUppercaseLetters)(
+ uri->hostText.first, uri->hostText.afterLast);
+ if (normalizeScheme) {
+ *outMask |= URI_NORMALIZE_SCHEME;
+ }
+
+ if (normalizeHostCase) {
+ *outMask |= URI_NORMALIZE_HOST;
+ } else {
+ const UriBool normalizeHostPrecent = URI_FUNC(ContainsUglyPercentEncoding)(
+ uri->hostText.first, uri->hostText.afterLast);
+ if (normalizeHostPrecent) {
+ *outMask |= URI_NORMALIZE_HOST;
+ }
+ }
+ } else {
+ /* Scheme */
+ if ((inMask & URI_NORMALIZE_SCHEME) && (uri->scheme.first != NULL)) {
+ if (uri->owner) {
+ URI_FUNC(LowercaseInplace)(uri->scheme.first, uri->scheme.afterLast);
+ } else {
+ if (!URI_FUNC(LowercaseMalloc)(&(uri->scheme.first), &(uri->scheme.afterLast), memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
+ return URI_ERROR_MALLOC;
+ }
+ doneMask |= URI_NORMALIZE_SCHEME;
+ }
+ }
+
+ /* Host */
+ if (inMask & URI_NORMALIZE_HOST) {
+ if (uri->hostData.ipFuture.first != NULL) {
+ /* IPvFuture */
+ if (uri->owner) {
+ URI_FUNC(LowercaseInplace)(uri->hostData.ipFuture.first,
+ uri->hostData.ipFuture.afterLast);
+ } else {
+ if (!URI_FUNC(LowercaseMalloc)(&(uri->hostData.ipFuture.first),
+ &(uri->hostData.ipFuture.afterLast), memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
+ return URI_ERROR_MALLOC;
+ }
+ doneMask |= URI_NORMALIZE_HOST;
+ }
+ uri->hostText.first = uri->hostData.ipFuture.first;
+ uri->hostText.afterLast = uri->hostData.ipFuture.afterLast;
+ } else if ((uri->hostText.first != NULL)
+ && (uri->hostData.ip4 == NULL)
+ && (uri->hostData.ip6 == NULL)) {
+ /* Regname */
+ if (uri->owner) {
+ URI_FUNC(FixPercentEncodingInplace)(uri->hostText.first,
+ &(uri->hostText.afterLast));
+ } else {
+ if (!URI_FUNC(FixPercentEncodingMalloc)(
+ &(uri->hostText.first),
+ &(uri->hostText.afterLast),
+ memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
+ return URI_ERROR_MALLOC;
+ }
+ doneMask |= URI_NORMALIZE_HOST;
+ }
+
+ URI_FUNC(LowercaseInplace)(uri->hostText.first,
+ uri->hostText.afterLast);
+ }
+ }
+ }
+
+ /* User info */
+ if (outMask != NULL) {
+ const UriBool normalizeUserInfo = URI_FUNC(ContainsUglyPercentEncoding)(
+ uri->userInfo.first, uri->userInfo.afterLast);
+ if (normalizeUserInfo) {
+ *outMask |= URI_NORMALIZE_USER_INFO;
+ }
+ } else {
+ if ((inMask & URI_NORMALIZE_USER_INFO) && (uri->userInfo.first != NULL)) {
+ if (uri->owner) {
+ URI_FUNC(FixPercentEncodingInplace)(uri->userInfo.first, &(uri->userInfo.afterLast));
+ } else {
+ if (!URI_FUNC(FixPercentEncodingMalloc)(&(uri->userInfo.first),
+ &(uri->userInfo.afterLast), memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
+ return URI_ERROR_MALLOC;
+ }
+ doneMask |= URI_NORMALIZE_USER_INFO;
+ }
+ }
+ }
+
+ /* Path */
+ if (outMask != NULL) {
+ const URI_TYPE(PathSegment) * walker = uri->pathHead;
+ while (walker != NULL) {
+ const URI_CHAR * const first = walker->text.first;
+ const URI_CHAR * const afterLast = walker->text.afterLast;
+ if ((first != NULL)
+ && (afterLast != NULL)
+ && (afterLast > first)
+ && (
+ (((afterLast - first) == 1)
+ && (first[0] == _UT('.')))
+ ||
+ (((afterLast - first) == 2)
+ && (first[0] == _UT('.'))
+ && (first[1] == _UT('.')))
+ ||
+ URI_FUNC(ContainsUglyPercentEncoding)(first, afterLast)
+ )) {
+ *outMask |= URI_NORMALIZE_PATH;
+ break;
+ }
+ walker = walker->next;
+ }
+ } else if (inMask & URI_NORMALIZE_PATH) {
+ URI_TYPE(PathSegment) * walker;
+ const UriBool relative = ((uri->scheme.first == NULL)
+ && !uri->absolutePath) ? URI_TRUE : URI_FALSE;
+
+ /* Fix percent-encoding for each segment */
+ walker = uri->pathHead;
+ if (uri->owner) {
+ while (walker != NULL) {
+ URI_FUNC(FixPercentEncodingInplace)(walker->text.first, &(walker->text.afterLast));
+ walker = walker->next;
+ }
+ } else {
+ while (walker != NULL) {
+ if (!URI_FUNC(FixPercentEncodingMalloc)(&(walker->text.first),
+ &(walker->text.afterLast), memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
+ return URI_ERROR_MALLOC;
+ }
+ walker = walker->next;
+ }
+ doneMask |= URI_NORMALIZE_PATH;
+ }
+
+ /* 6.2.2.3 Path Segment Normalization */
+ if (!URI_FUNC(RemoveDotSegmentsEx)(uri, relative,
+ (uri->owner == URI_TRUE)
+ || ((doneMask & URI_NORMALIZE_PATH) != 0),
+ memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
+ return URI_ERROR_MALLOC;
+ }
+ URI_FUNC(FixEmptyTrailSegment)(uri, memory);
+ }
+
+ /* Query, fragment */
+ if (outMask != NULL) {
+ const UriBool normalizeQuery = URI_FUNC(ContainsUglyPercentEncoding)(
+ uri->query.first, uri->query.afterLast);
+ const UriBool normalizeFragment = URI_FUNC(ContainsUglyPercentEncoding)(
+ uri->fragment.first, uri->fragment.afterLast);
+ if (normalizeQuery) {
+ *outMask |= URI_NORMALIZE_QUERY;
+ }
+
+ if (normalizeFragment) {
+ *outMask |= URI_NORMALIZE_FRAGMENT;
+ }
+ } else {
+ /* Query */
+ if ((inMask & URI_NORMALIZE_QUERY) && (uri->query.first != NULL)) {
+ if (uri->owner) {
+ URI_FUNC(FixPercentEncodingInplace)(uri->query.first, &(uri->query.afterLast));
+ } else {
+ if (!URI_FUNC(FixPercentEncodingMalloc)(&(uri->query.first),
+ &(uri->query.afterLast), memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
+ return URI_ERROR_MALLOC;
+ }
+ doneMask |= URI_NORMALIZE_QUERY;
+ }
+ }
+
+ /* Fragment */
+ if ((inMask & URI_NORMALIZE_FRAGMENT) && (uri->fragment.first != NULL)) {
+ if (uri->owner) {
+ URI_FUNC(FixPercentEncodingInplace)(uri->fragment.first, &(uri->fragment.afterLast));
+ } else {
+ if (!URI_FUNC(FixPercentEncodingMalloc)(&(uri->fragment.first),
+ &(uri->fragment.afterLast), memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
+ return URI_ERROR_MALLOC;
+ }
+ doneMask |= URI_NORMALIZE_FRAGMENT;
+ }
+ }
+ }
+
+ /* Dup all not duped yet */
+ if ((outMask == NULL) && !uri->owner) {
if (!URI_FUNC(MakeOwnerEngine)(uri, &doneMask, memory)) {
- URI_FUNC(PreventLeakage)(uri, doneMask, memory);
- return URI_ERROR_MALLOC;
- }
- uri->owner = URI_TRUE;
- }
-
- return URI_SUCCESS;
-}
-
-
-
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
+ return URI_ERROR_MALLOC;
+ }
+ uri->owner = URI_TRUE;
+ }
+
+ return URI_SUCCESS;
+}
+
+
+
int URI_FUNC(MakeOwnerMm)(URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
unsigned int doneMask = URI_NORMALIZED;
@@ -806,4 +806,4 @@ int URI_FUNC(MakeOwner)(URI_TYPE(Uri) * uri) {
-#endif
+#endif
diff --git a/contrib/restricted/uriparser/src/UriNormalizeBase.c b/contrib/restricted/uriparser/src/UriNormalizeBase.c
index a74fcd3f8b..3fa1dc58fb 100644
--- a/contrib/restricted/uriparser/src/UriNormalizeBase.c
+++ b/contrib/restricted/uriparser/src/UriNormalizeBase.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,89 +31,89 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef URI_DOXYGEN
-# include "UriNormalizeBase.h"
-#endif
-
-
-
-UriBool uriIsUnreserved(int code) {
- switch (code) {
- case L'a': /* ALPHA */
- case L'A':
- case L'b':
- case L'B':
- case L'c':
- case L'C':
- case L'd':
- case L'D':
- case L'e':
- case L'E':
- case L'f':
- case L'F':
- case L'g':
- case L'G':
- case L'h':
- case L'H':
- case L'i':
- case L'I':
- case L'j':
- case L'J':
- case L'k':
- case L'K':
- case L'l':
- case L'L':
- case L'm':
- case L'M':
- case L'n':
- case L'N':
- case L'o':
- case L'O':
- case L'p':
- case L'P':
- case L'q':
- case L'Q':
- case L'r':
- case L'R':
- case L's':
- case L'S':
- case L't':
- case L'T':
- case L'u':
- case L'U':
- case L'v':
- case L'V':
- case L'w':
- case L'W':
- case L'x':
- case L'X':
- case L'y':
- case L'Y':
- case L'z':
- case L'Z':
- case L'0': /* DIGIT */
- case L'1':
- case L'2':
- case L'3':
- case L'4':
- case L'5':
- case L'6':
- case L'7':
- case L'8':
- case L'9':
- case L'-': /* "-" / "." / "_" / "~" */
- case L'.':
- case L'_':
- case L'~':
- return URI_TRUE;
-
- default:
- return URI_FALSE;
- }
-}
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef URI_DOXYGEN
+# include "UriNormalizeBase.h"
+#endif
+
+
+
+UriBool uriIsUnreserved(int code) {
+ switch (code) {
+ case L'a': /* ALPHA */
+ case L'A':
+ case L'b':
+ case L'B':
+ case L'c':
+ case L'C':
+ case L'd':
+ case L'D':
+ case L'e':
+ case L'E':
+ case L'f':
+ case L'F':
+ case L'g':
+ case L'G':
+ case L'h':
+ case L'H':
+ case L'i':
+ case L'I':
+ case L'j':
+ case L'J':
+ case L'k':
+ case L'K':
+ case L'l':
+ case L'L':
+ case L'm':
+ case L'M':
+ case L'n':
+ case L'N':
+ case L'o':
+ case L'O':
+ case L'p':
+ case L'P':
+ case L'q':
+ case L'Q':
+ case L'r':
+ case L'R':
+ case L's':
+ case L'S':
+ case L't':
+ case L'T':
+ case L'u':
+ case L'U':
+ case L'v':
+ case L'V':
+ case L'w':
+ case L'W':
+ case L'x':
+ case L'X':
+ case L'y':
+ case L'Y':
+ case L'z':
+ case L'Z':
+ case L'0': /* DIGIT */
+ case L'1':
+ case L'2':
+ case L'3':
+ case L'4':
+ case L'5':
+ case L'6':
+ case L'7':
+ case L'8':
+ case L'9':
+ case L'-': /* "-" / "." / "_" / "~" */
+ case L'.':
+ case L'_':
+ case L'~':
+ return URI_TRUE;
+
+ default:
+ return URI_FALSE;
+ }
+}
diff --git a/contrib/restricted/uriparser/src/UriNormalizeBase.h b/contrib/restricted/uriparser/src/UriNormalizeBase.h
index 8651c86166..162426dd78 100644
--- a/contrib/restricted/uriparser/src/UriNormalizeBase.h
+++ b/contrib/restricted/uriparser/src/UriNormalizeBase.h
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,23 +31,23 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef URI_NORMALIZE_BASE_H
-#define URI_NORMALIZE_BASE_H 1
-
-
-
-#include <uriparser/UriBase.h>
-
-
-
-UriBool uriIsUnreserved(int code);
-
-
-
-#endif /* URI_NORMALIZE_BASE_H */
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef URI_NORMALIZE_BASE_H
+#define URI_NORMALIZE_BASE_H 1
+
+
+
+#include <uriparser/UriBase.h>
+
+
+
+UriBool uriIsUnreserved(int code);
+
+
+
+#endif /* URI_NORMALIZE_BASE_H */
diff --git a/contrib/restricted/uriparser/src/UriParse.c b/contrib/restricted/uriparser/src/UriParse.c
index eefa8d1347..76a68984e3 100644
--- a/contrib/restricted/uriparser/src/UriParse.c
+++ b/contrib/restricted/uriparser/src/UriParse.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,2264 +31,2264 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file UriParse.c
- * Holds the RFC 3986 %URI parsing implementation.
- * NOTE: This source file includes itself twice.
- */
-
-/* What encodings are enabled? */
-#include <uriparser/UriDefsConfig.h>
-#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* Include SELF twice */
-# ifdef URI_ENABLE_ANSI
-# define URI_PASS_ANSI 1
-# include "UriParse.c"
-# undef URI_PASS_ANSI
-# endif
-# ifdef URI_ENABLE_UNICODE
-# define URI_PASS_UNICODE 1
-# include "UriParse.c"
-# undef URI_PASS_UNICODE
-# endif
-#else
-# ifdef URI_PASS_ANSI
-# include <uriparser/UriDefsAnsi.h>
-# else
-# include <uriparser/UriDefsUnicode.h>
-# include <wchar.h>
-# endif
-
-
-
-#ifndef URI_DOXYGEN
-# include <uriparser/Uri.h>
-# include <uriparser/UriIp4.h>
-# include "UriCommon.h"
-# include "UriMemory.h"
-# include "UriParseBase.h"
-#endif
-
-
-
-#define URI_SET_DIGIT \
- _UT('0'): \
- case _UT('1'): \
- case _UT('2'): \
- case _UT('3'): \
- case _UT('4'): \
- case _UT('5'): \
- case _UT('6'): \
- case _UT('7'): \
- case _UT('8'): \
- case _UT('9')
-
-#define URI_SET_HEX_LETTER_UPPER \
- _UT('A'): \
- case _UT('B'): \
- case _UT('C'): \
- case _UT('D'): \
- case _UT('E'): \
- case _UT('F')
-
-#define URI_SET_HEX_LETTER_LOWER \
- _UT('a'): \
- case _UT('b'): \
- case _UT('c'): \
- case _UT('d'): \
- case _UT('e'): \
- case _UT('f')
-
-#define URI_SET_HEXDIG \
- URI_SET_DIGIT: \
- case URI_SET_HEX_LETTER_UPPER: \
- case URI_SET_HEX_LETTER_LOWER
-
-#define URI_SET_ALPHA \
- URI_SET_HEX_LETTER_UPPER: \
- case URI_SET_HEX_LETTER_LOWER: \
- case _UT('g'): \
- case _UT('G'): \
- case _UT('h'): \
- case _UT('H'): \
- case _UT('i'): \
- case _UT('I'): \
- case _UT('j'): \
- case _UT('J'): \
- case _UT('k'): \
- case _UT('K'): \
- case _UT('l'): \
- case _UT('L'): \
- case _UT('m'): \
- case _UT('M'): \
- case _UT('n'): \
- case _UT('N'): \
- case _UT('o'): \
- case _UT('O'): \
- case _UT('p'): \
- case _UT('P'): \
- case _UT('q'): \
- case _UT('Q'): \
- case _UT('r'): \
- case _UT('R'): \
- case _UT('s'): \
- case _UT('S'): \
- case _UT('t'): \
- case _UT('T'): \
- case _UT('u'): \
- case _UT('U'): \
- case _UT('v'): \
- case _UT('V'): \
- case _UT('w'): \
- case _UT('W'): \
- case _UT('x'): \
- case _UT('X'): \
- case _UT('y'): \
- case _UT('Y'): \
- case _UT('z'): \
- case _UT('Z')
-
-
-
-static const URI_CHAR * URI_FUNC(ParseAuthority)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseAuthorityTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseHexZero)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseHierPart)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseIpFutLoop)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseIpFutStopGo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseIpLit2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseOwnHost)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseOwnHost2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfoNz)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseOwnUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParsePartHelperTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParsePathAbsEmpty)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParsePathAbsNoLeadSlash)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParsePathRootless)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParsePchar)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParsePctEncoded)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParsePctSubUnres)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParsePort)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseQueryFrag)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseSegment)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseSegmentNz)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseUriReference)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseUriTail)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseUriTailTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParseZeroMoreSlashSegs)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
-
-static UriBool URI_FUNC(OnExitOwnHost2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
-static UriBool URI_FUNC(OnExitOwnHostUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
-static UriBool URI_FUNC(OnExitOwnPortUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
-static UriBool URI_FUNC(OnExitSegmentNzNcOrScheme2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
-static void URI_FUNC(OnExitPartHelperTwo)(URI_TYPE(ParserState) * state);
-
-static void URI_FUNC(ResetParserStateExceptUri)(URI_TYPE(ParserState) * state);
-
-static UriBool URI_FUNC(PushPathSegment)(URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory);
-
-static void URI_FUNC(StopSyntax)(URI_TYPE(ParserState) * state, const URI_CHAR * errorPos, UriMemoryManager * memory);
-static void URI_FUNC(StopMalloc)(URI_TYPE(ParserState) * state, UriMemoryManager * memory);
-
-static int URI_FUNC(ParseUriExMm)(URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory);
-
-
-
-static URI_INLINE void URI_FUNC(StopSyntax)(URI_TYPE(ParserState) * state,
- const URI_CHAR * errorPos, UriMemoryManager * memory) {
- URI_FUNC(FreeUriMembersMm)(state->uri, memory);
- state->errorPos = errorPos;
- state->errorCode = URI_ERROR_SYNTAX;
-}
-
-
-
-static URI_INLINE void URI_FUNC(StopMalloc)(URI_TYPE(ParserState) * state, UriMemoryManager * memory) {
- URI_FUNC(FreeUriMembersMm)(state->uri, memory);
- state->errorPos = NULL;
- state->errorCode = URI_ERROR_MALLOC;
-}
-
-
-
-/*
- * [authority]-><[>[ipLit2][authorityTwo]
- * [authority]->[ownHostUserInfoNz]
- * [authority]-><NULL>
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseAuthority)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- /* "" regname host */
- state->uri->hostText.first = URI_FUNC(SafeToPointTo);
- state->uri->hostText.afterLast = URI_FUNC(SafeToPointTo);
- return afterLast;
- }
-
- switch (*first) {
- case _UT('['):
- {
- const URI_CHAR * const afterIpLit2
- = URI_FUNC(ParseIpLit2)(state, first + 1, afterLast, memory);
- if (afterIpLit2 == NULL) {
- return NULL;
- }
- state->uri->hostText.first = first + 1; /* HOST BEGIN */
- return URI_FUNC(ParseAuthorityTwo)(state, afterIpLit2, afterLast);
- }
-
- case _UT('!'):
- case _UT('$'):
- case _UT('%'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('-'):
- case _UT('*'):
- case _UT(','):
- case _UT('.'):
- case _UT(':'):
- case _UT(';'):
- case _UT('@'):
- case _UT('\''):
- case _UT('_'):
- case _UT('~'):
- case _UT('+'):
- case _UT('='):
- case URI_SET_DIGIT:
- case URI_SET_ALPHA:
- state->uri->userInfo.first = first; /* USERINFO BEGIN */
- return URI_FUNC(ParseOwnHostUserInfoNz)(state, first, afterLast, memory);
-
- default:
- /* "" regname host */
- state->uri->hostText.first = URI_FUNC(SafeToPointTo);
- state->uri->hostText.afterLast = URI_FUNC(SafeToPointTo);
- return first;
- }
-}
-
-
-
-/*
- * [authorityTwo]-><:>[port]
- * [authorityTwo]-><NULL>
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseAuthorityTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case _UT(':'):
- {
- const URI_CHAR * const afterPort = URI_FUNC(ParsePort)(state, first + 1, afterLast);
- if (afterPort == NULL) {
- return NULL;
- }
- state->uri->portText.first = first + 1; /* PORT BEGIN */
- state->uri->portText.afterLast = afterPort; /* PORT END */
- return afterPort;
- }
-
- default:
- return first;
- }
-}
-
-
-
-/*
- * [hexZero]->[HEXDIG][hexZero]
- * [hexZero]-><NULL>
- */
-static const URI_CHAR * URI_FUNC(ParseHexZero)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case URI_SET_HEXDIG:
- return URI_FUNC(ParseHexZero)(state, first + 1, afterLast);
-
- default:
- return first;
- }
-}
-
-
-
-/*
- * [hierPart]->[pathRootless]
- * [hierPart]-></>[partHelperTwo]
- * [hierPart]-><NULL>
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseHierPart)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case _UT('!'):
- case _UT('$'):
- case _UT('%'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('-'):
- case _UT('*'):
- case _UT(','):
- case _UT('.'):
- case _UT(':'):
- case _UT(';'):
- case _UT('@'):
- case _UT('\''):
- case _UT('_'):
- case _UT('~'):
- case _UT('+'):
- case _UT('='):
- case URI_SET_DIGIT:
- case URI_SET_ALPHA:
- return URI_FUNC(ParsePathRootless)(state, first, afterLast, memory);
-
- case _UT('/'):
- return URI_FUNC(ParsePartHelperTwo)(state, first + 1, afterLast, memory);
-
- default:
- return first;
- }
-}
-
-
-
-/*
- * [ipFutLoop]->[subDelims][ipFutStopGo]
- * [ipFutLoop]->[unreserved][ipFutStopGo]
- * [ipFutLoop]-><:>[ipFutStopGo]
- */
-static const URI_CHAR * URI_FUNC(ParseIpFutLoop)(URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory) {
- if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
-
- switch (*first) {
- case _UT('!'):
- case _UT('$'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('-'):
- case _UT('*'):
- case _UT(','):
- case _UT('.'):
- case _UT(':'):
- case _UT(';'):
- case _UT('\''):
- case _UT('_'):
- case _UT('~'):
- case _UT('+'):
- case _UT('='):
- case URI_SET_DIGIT:
- case URI_SET_ALPHA:
- return URI_FUNC(ParseIpFutStopGo)(state, first + 1, afterLast, memory);
-
- default:
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
-}
-
-
-
-/*
- * [ipFutStopGo]->[ipFutLoop]
- * [ipFutStopGo]-><NULL>
- */
-static const URI_CHAR * URI_FUNC(ParseIpFutStopGo)(
- URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case _UT('!'):
- case _UT('$'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('-'):
- case _UT('*'):
- case _UT(','):
- case _UT('.'):
- case _UT(':'):
- case _UT(';'):
- case _UT('\''):
- case _UT('_'):
- case _UT('~'):
- case _UT('+'):
- case _UT('='):
- case URI_SET_DIGIT:
- case URI_SET_ALPHA:
- return URI_FUNC(ParseIpFutLoop)(state, first, afterLast, memory);
-
- default:
- return first;
- }
-}
-
-
-
-/*
- * [ipFuture]-><v>[HEXDIG][hexZero]<.>[ipFutLoop]
- */
-static const URI_CHAR * URI_FUNC(ParseIpFuture)(URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory) {
- if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
-
- /*
- First character has already been
- checked before entering this rule.
-
- switch (*first) {
- case _UT('v'):
- */
- if (first + 1 >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
-
- switch (first[1]) {
- case URI_SET_HEXDIG:
- {
- const URI_CHAR * afterIpFutLoop;
- const URI_CHAR * const afterHexZero
- = URI_FUNC(ParseHexZero)(state, first + 2, afterLast);
- if (afterHexZero == NULL) {
- return NULL;
- }
- if (afterHexZero >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
- if (*afterHexZero != _UT('.')) {
- URI_FUNC(StopSyntax)(state, afterHexZero, memory);
- return NULL;
- }
- state->uri->hostText.first = first; /* HOST BEGIN */
- state->uri->hostData.ipFuture.first = first; /* IPFUTURE BEGIN */
- afterIpFutLoop = URI_FUNC(ParseIpFutLoop)(state, afterHexZero + 1, afterLast, memory);
- if (afterIpFutLoop == NULL) {
- return NULL;
- }
- state->uri->hostText.afterLast = afterIpFutLoop; /* HOST END */
- state->uri->hostData.ipFuture.afterLast = afterIpFutLoop; /* IPFUTURE END */
- return afterIpFutLoop;
- }
-
- default:
- URI_FUNC(StopSyntax)(state, first + 1, memory);
- return NULL;
- }
-
- /*
- default:
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
- */
-}
-
-
-
-/*
- * [ipLit2]->[ipFuture]<]>
- * [ipLit2]->[IPv6address2]
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseIpLit2)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
-
- switch (*first) {
- case _UT('v'):
- {
- const URI_CHAR * const afterIpFuture
- = URI_FUNC(ParseIpFuture)(state, first, afterLast, memory);
- if (afterIpFuture == NULL) {
- return NULL;
- }
- if (afterIpFuture >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
- if (*afterIpFuture != _UT(']')) {
- URI_FUNC(StopSyntax)(state, afterIpFuture, memory);
- return NULL;
- }
- return afterIpFuture + 1;
- }
-
- case _UT(':'):
- case _UT(']'):
- case URI_SET_HEXDIG:
- state->uri->hostData.ip6 = memory->malloc(memory, 1 * sizeof(UriIp6)); /* Freed when stopping on parse error */
- if (state->uri->hostData.ip6 == NULL) {
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- return URI_FUNC(ParseIPv6address2)(state, first, afterLast, memory);
-
- default:
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
-}
-
-
-
-/*
- * [IPv6address2]->..<]>
- */
-static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
- URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory) {
- int zipperEver = 0;
- int quadsDone = 0;
- int digitCount = 0;
- unsigned char digitHistory[4];
- int ip4OctetsDone = 0;
-
- unsigned char quadsAfterZipper[14];
- int quadsAfterZipperCount = 0;
-
-
- for (;;) {
- if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
-
- /* Inside IPv4 part? */
- if (ip4OctetsDone > 0) {
- /* Eat rest of IPv4 address */
- for (;;) {
- switch (*first) {
- case URI_SET_DIGIT:
- if (digitCount == 4) {
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
- digitHistory[digitCount++] = (unsigned char)(9 + *first - _UT('9'));
- break;
-
- case _UT('.'):
- if ((ip4OctetsDone == 4) /* NOTE! */
- || (digitCount == 0)
- || (digitCount == 4)) {
- /* Invalid digit or octet count */
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- } else if ((digitCount > 1)
- && (digitHistory[0] == 0)) {
- /* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount, memory);
- return NULL;
- } else if ((digitCount > 2)
- && (digitHistory[1] == 0)) {
- /* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
- return NULL;
- } else if ((digitCount == 3)
- && (100 * digitHistory[0]
- + 10 * digitHistory[1]
- + digitHistory[2] > 255)) {
- /* Octet value too large */
- if (digitHistory[0] > 2) {
- URI_FUNC(StopSyntax)(state, first - 3, memory);
- } else if (digitHistory[1] > 5) {
- URI_FUNC(StopSyntax)(state, first - 2, memory);
- } else {
- URI_FUNC(StopSyntax)(state, first - 1, memory);
- }
- return NULL;
- }
-
- /* Copy IPv4 octet */
- state->uri->hostData.ip6->data[16 - 4 + ip4OctetsDone] = uriGetOctetValue(digitHistory, digitCount);
- digitCount = 0;
- ip4OctetsDone++;
- break;
-
- case _UT(']'):
- if ((ip4OctetsDone != 3) /* NOTE! */
- || (digitCount == 0)
- || (digitCount == 4)) {
- /* Invalid digit or octet count */
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- } else if ((digitCount > 1)
- && (digitHistory[0] == 0)) {
- /* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount, memory);
- return NULL;
- } else if ((digitCount > 2)
- && (digitHistory[1] == 0)) {
- /* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
- return NULL;
- } else if ((digitCount == 3)
- && (100 * digitHistory[0]
- + 10 * digitHistory[1]
- + digitHistory[2] > 255)) {
- /* Octet value too large */
- if (digitHistory[0] > 2) {
- URI_FUNC(StopSyntax)(state, first - 3, memory);
- } else if (digitHistory[1] > 5) {
- URI_FUNC(StopSyntax)(state, first - 2, memory);
- } else {
- URI_FUNC(StopSyntax)(state, first - 1, memory);
- }
- return NULL;
- }
-
- state->uri->hostText.afterLast = first; /* HOST END */
-
- /* Copy missing quads right before IPv4 */
- memcpy(state->uri->hostData.ip6->data + 16 - 4 - 2 * quadsAfterZipperCount,
- quadsAfterZipper, 2 * quadsAfterZipperCount);
-
- /* Copy last IPv4 octet */
- state->uri->hostData.ip6->data[16 - 4 + 3] = uriGetOctetValue(digitHistory, digitCount);
-
- return first + 1;
-
- default:
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
- first++;
-
- if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
- }
- } else {
- /* Eat while no dot in sight */
- int letterAmong = 0;
- int walking = 1;
- do {
- switch (*first) {
- case URI_SET_HEX_LETTER_LOWER:
- letterAmong = 1;
- if (digitCount == 4) {
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
- digitHistory[digitCount] = (unsigned char)(15 + *first - _UT('f'));
- digitCount++;
- break;
-
- case URI_SET_HEX_LETTER_UPPER:
- letterAmong = 1;
- if (digitCount == 4) {
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
- digitHistory[digitCount] = (unsigned char)(15 + *first - _UT('F'));
- digitCount++;
- break;
-
- case URI_SET_DIGIT:
- if (digitCount == 4) {
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
- digitHistory[digitCount] = (unsigned char)(9 + *first - _UT('9'));
- digitCount++;
- break;
-
- case _UT(':'):
- {
- int setZipper = 0;
-
- if (digitCount > 0) {
- if (zipperEver) {
- uriWriteQuadToDoubleByte(digitHistory, digitCount, quadsAfterZipper + 2 * quadsAfterZipperCount);
- quadsAfterZipperCount++;
- } else {
- uriWriteQuadToDoubleByte(digitHistory, digitCount, state->uri->hostData.ip6->data + 2 * quadsDone);
- }
- quadsDone++;
- digitCount = 0;
- }
- letterAmong = 0;
-
- /* Too many quads? */
- if (quadsDone >= 8 - zipperEver) {
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
-
- /* "::"? */
- if (first + 1 >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
- if (first[1] == _UT(':')) {
- const int resetOffset = 2 * (quadsDone + (digitCount > 0));
-
- first++;
- if (zipperEver) {
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL; /* "::.+::" */
- }
-
- /* Zero everything after zipper */
- memset(state->uri->hostData.ip6->data + resetOffset, 0, 16 - resetOffset);
- setZipper = 1;
-
- /* ":::+"? */
- if (first + 1 >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL; /* No ']' yet */
- }
- if (first[1] == _UT(':')) {
- URI_FUNC(StopSyntax)(state, first + 1, memory);
- return NULL; /* ":::+ "*/
- }
- }
-
- if (setZipper) {
- zipperEver = 1;
- }
- }
- break;
-
- case _UT('.'):
- if ((quadsDone > 6) /* NOTE */
- || (!zipperEver && (quadsDone < 6))
- || letterAmong
- || (digitCount == 0)
- || (digitCount == 4)) {
- /* Invalid octet before */
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- } else if ((digitCount > 1)
- && (digitHistory[0] == 0)) {
- /* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount, memory);
- return NULL;
- } else if ((digitCount > 2)
- && (digitHistory[1] == 0)) {
- /* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
- return NULL;
- } else if ((digitCount == 3)
- && (100 * digitHistory[0]
- + 10 * digitHistory[1]
- + digitHistory[2] > 255)) {
- /* Octet value too large */
- if (digitHistory[0] > 2) {
- URI_FUNC(StopSyntax)(state, first - 3, memory);
- } else if (digitHistory[1] > 5) {
- URI_FUNC(StopSyntax)(state, first - 2, memory);
- } else {
- URI_FUNC(StopSyntax)(state, first - 1, memory);
- }
- return NULL;
- }
-
- /* Copy first IPv4 octet */
- state->uri->hostData.ip6->data[16 - 4] = uriGetOctetValue(digitHistory, digitCount);
- digitCount = 0;
-
- /* Switch over to IPv4 loop */
- ip4OctetsDone = 1;
- walking = 0;
- break;
-
- case _UT(']'):
- /* Too little quads? */
- if (!zipperEver && !((quadsDone == 7) && (digitCount > 0))) {
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
-
- if (digitCount > 0) {
- if (zipperEver) {
- uriWriteQuadToDoubleByte(digitHistory, digitCount, quadsAfterZipper + 2 * quadsAfterZipperCount);
- quadsAfterZipperCount++;
- } else {
- uriWriteQuadToDoubleByte(digitHistory, digitCount, state->uri->hostData.ip6->data + 2 * quadsDone);
- }
- /*
- quadsDone++;
- digitCount = 0;
- */
- }
-
- /* Copy missing quads to the end */
- memcpy(state->uri->hostData.ip6->data + 16 - 2 * quadsAfterZipperCount,
- quadsAfterZipper, 2 * quadsAfterZipperCount);
-
- state->uri->hostText.afterLast = first; /* HOST END */
- return first + 1; /* Fine */
-
- default:
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
- first++;
-
- if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL; /* No ']' yet */
- }
- } while (walking);
- }
- }
-}
-
-
-
-/*
- * [mustBeSegmentNzNc]->[pctEncoded][mustBeSegmentNzNc]
- * [mustBeSegmentNzNc]->[subDelims][mustBeSegmentNzNc]
- * [mustBeSegmentNzNc]->[unreserved][mustBeSegmentNzNc]
- * [mustBeSegmentNzNc]->[uriTail] // can take <NULL>
- * [mustBeSegmentNzNc]-></>[segment][zeroMoreSlashSegs][uriTail]
- * [mustBeSegmentNzNc]-><@>[mustBeSegmentNzNc]
- */
-static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- state->uri->scheme.first = NULL; /* Not a scheme, reset */
- return afterLast;
- }
-
- switch (*first) {
- case _UT('%'):
- {
- const URI_CHAR * const afterPctEncoded
- = URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
- if (afterPctEncoded == NULL) {
- return NULL;
- }
- return URI_FUNC(ParseMustBeSegmentNzNc)(state, afterPctEncoded, afterLast, memory);
- }
-
- case _UT('@'):
- case _UT('!'):
- case _UT('$'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('*'):
- case _UT(','):
- case _UT(';'):
- case _UT('\''):
- case _UT('+'):
- case _UT('='):
- case _UT('-'):
- case _UT('.'):
- case _UT('_'):
- case _UT('~'):
- case URI_SET_DIGIT:
- case URI_SET_ALPHA:
- return URI_FUNC(ParseMustBeSegmentNzNc)(state, first + 1, afterLast, memory);
-
- case _UT('/'):
- {
- const URI_CHAR * afterZeroMoreSlashSegs;
- const URI_CHAR * afterSegment;
- if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- state->uri->scheme.first = NULL; /* Not a scheme, reset */
- afterSegment = URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
- if (afterSegment == NULL) {
- return NULL;
- }
- if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- afterZeroMoreSlashSegs
- = URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast, memory);
- if (afterZeroMoreSlashSegs == NULL) {
- return NULL;
- }
- return URI_FUNC(ParseUriTail)(state, afterZeroMoreSlashSegs, afterLast, memory);
- }
-
- default:
- if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- state->uri->scheme.first = NULL; /* Not a scheme, reset */
- return URI_FUNC(ParseUriTail)(state, first, afterLast, memory);
- }
-}
-
-
-
-/*
- * [ownHost]-><[>[ipLit2][authorityTwo]
- * [ownHost]->[ownHost2] // can take <NULL>
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHost)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- state->uri->hostText.afterLast = afterLast; /* HOST END */
- return afterLast;
- }
-
- switch (*first) {
- case _UT('['):
- {
- const URI_CHAR * const afterIpLit2
- = URI_FUNC(ParseIpLit2)(state, first + 1, afterLast, memory);
- if (afterIpLit2 == NULL) {
- return NULL;
- }
- state->uri->hostText.first = first + 1; /* HOST BEGIN */
- return URI_FUNC(ParseAuthorityTwo)(state, afterIpLit2, afterLast);
- }
-
- default:
- return URI_FUNC(ParseOwnHost2)(state, first, afterLast, memory);
- }
-}
-
-
-
-static URI_INLINE UriBool URI_FUNC(OnExitOwnHost2)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- UriMemoryManager * memory) {
- state->uri->hostText.afterLast = first; /* HOST END */
-
- /* Valid IPv4 or just a regname? */
- state->uri->hostData.ip4 = memory->malloc(memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
- if (state->uri->hostData.ip4 == NULL) {
- return URI_FALSE; /* Raises malloc error */
- }
- if (URI_FUNC(ParseIpFourAddress)(state->uri->hostData.ip4->data,
- state->uri->hostText.first, state->uri->hostText.afterLast)) {
- /* Not IPv4 */
- memory->free(memory, state->uri->hostData.ip4);
- state->uri->hostData.ip4 = NULL;
- }
- return URI_TRUE; /* Success */
-}
-
-
-
-/*
- * [ownHost2]->[authorityTwo] // can take <NULL>
- * [ownHost2]->[pctSubUnres][ownHost2]
- */
-static const URI_CHAR * URI_FUNC(ParseOwnHost2)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- if (!URI_FUNC(OnExitOwnHost2)(state, first, memory)) {
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- return afterLast;
- }
-
- switch (*first) {
- case _UT('!'):
- case _UT('$'):
- case _UT('%'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('-'):
- case _UT('*'):
- case _UT(','):
- case _UT('.'):
- case _UT(';'):
- case _UT('\''):
- case _UT('_'):
- case _UT('~'):
- case _UT('+'):
- case _UT('='):
- case URI_SET_DIGIT:
- case URI_SET_ALPHA:
- {
- const URI_CHAR * const afterPctSubUnres
- = URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
- if (afterPctSubUnres == NULL) {
- return NULL;
- }
- return URI_FUNC(ParseOwnHost2)(state, afterPctSubUnres, afterLast, memory);
- }
-
- default:
- if (!URI_FUNC(OnExitOwnHost2)(state, first, memory)) {
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- return URI_FUNC(ParseAuthorityTwo)(state, first, afterLast);
- }
-}
-
-
-
-static URI_INLINE UriBool URI_FUNC(OnExitOwnHostUserInfo)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- UriMemoryManager * memory) {
- state->uri->hostText.first = state->uri->userInfo.first; /* Host instead of userInfo, update */
- state->uri->userInfo.first = NULL; /* Not a userInfo, reset */
- state->uri->hostText.afterLast = first; /* HOST END */
-
- /* Valid IPv4 or just a regname? */
- state->uri->hostData.ip4 = memory->malloc(memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
- if (state->uri->hostData.ip4 == NULL) {
- return URI_FALSE; /* Raises malloc error */
- }
- if (URI_FUNC(ParseIpFourAddress)(state->uri->hostData.ip4->data,
- state->uri->hostText.first, state->uri->hostText.afterLast)) {
- /* Not IPv4 */
- memory->free(memory, state->uri->hostData.ip4);
- state->uri->hostData.ip4 = NULL;
- }
- return URI_TRUE; /* Success */
-}
-
-
-
-/*
- * [ownHostUserInfo]->[ownHostUserInfoNz]
- * [ownHostUserInfo]-><NULL>
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHostUserInfo)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- if (!URI_FUNC(OnExitOwnHostUserInfo)(state, first, memory)) {
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- return afterLast;
- }
-
- switch (*first) {
- case _UT('!'):
- case _UT('$'):
- case _UT('%'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('-'):
- case _UT('*'):
- case _UT(','):
- case _UT('.'):
- case _UT(':'):
- case _UT(';'):
- case _UT('@'):
- case _UT('\''):
- case _UT('_'):
- case _UT('~'):
- case _UT('+'):
- case _UT('='):
- case URI_SET_DIGIT:
- case URI_SET_ALPHA:
- return URI_FUNC(ParseOwnHostUserInfoNz)(state, first, afterLast, memory);
-
- default:
- if (!URI_FUNC(OnExitOwnHostUserInfo)(state, first, memory)) {
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- return first;
- }
-}
-
-
-
-/*
- * [ownHostUserInfoNz]->[pctSubUnres][ownHostUserInfo]
- * [ownHostUserInfoNz]-><:>[ownPortUserInfo]
- * [ownHostUserInfoNz]-><@>[ownHost]
- */
-static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfoNz)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
-
- switch (*first) {
- case _UT('!'):
- case _UT('$'):
- case _UT('%'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('-'):
- case _UT('*'):
- case _UT(','):
- case _UT('.'):
- case _UT(';'):
- case _UT('\''):
- case _UT('_'):
- case _UT('~'):
- case _UT('+'):
- case _UT('='):
- case URI_SET_DIGIT:
- case URI_SET_ALPHA:
- {
- const URI_CHAR * const afterPctSubUnres
- = URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
- if (afterPctSubUnres == NULL) {
- return NULL;
- }
- return URI_FUNC(ParseOwnHostUserInfo)(state, afterPctSubUnres, afterLast, memory);
- }
-
- case _UT(':'):
- state->uri->hostText.afterLast = first; /* HOST END */
- state->uri->portText.first = first + 1; /* PORT BEGIN */
- return URI_FUNC(ParseOwnPortUserInfo)(state, first + 1, afterLast, memory);
-
- case _UT('@'):
- state->uri->userInfo.afterLast = first; /* USERINFO END */
- state->uri->hostText.first = first + 1; /* HOST BEGIN */
- return URI_FUNC(ParseOwnHost)(state, first + 1, afterLast, memory);
-
- default:
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
-}
-
-
-
-static URI_INLINE UriBool URI_FUNC(OnExitOwnPortUserInfo)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- UriMemoryManager * memory) {
- state->uri->hostText.first = state->uri->userInfo.first; /* Host instead of userInfo, update */
- state->uri->userInfo.first = NULL; /* Not a userInfo, reset */
- state->uri->portText.afterLast = first; /* PORT END */
-
- /* Valid IPv4 or just a regname? */
- state->uri->hostData.ip4 = memory->malloc(memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
- if (state->uri->hostData.ip4 == NULL) {
- return URI_FALSE; /* Raises malloc error */
- }
- if (URI_FUNC(ParseIpFourAddress)(state->uri->hostData.ip4->data,
- state->uri->hostText.first, state->uri->hostText.afterLast)) {
- /* Not IPv4 */
- memory->free(memory, state->uri->hostData.ip4);
- state->uri->hostData.ip4 = NULL;
- }
- return URI_TRUE; /* Success */
-}
-
-
-
-/*
- * [ownPortUserInfo]->[ALPHA][ownUserInfo]
- * [ownPortUserInfo]->[DIGIT][ownPortUserInfo]
- * [ownPortUserInfo]-><.>[ownUserInfo]
- * [ownPortUserInfo]-><_>[ownUserInfo]
- * [ownPortUserInfo]-><~>[ownUserInfo]
- * [ownPortUserInfo]-><->[ownUserInfo]
- * [ownPortUserInfo]->[subDelims][ownUserInfo]
- * [ownPortUserInfo]->[pctEncoded][ownUserInfo]
- * [ownPortUserInfo]-><:>[ownUserInfo]
- * [ownPortUserInfo]-><@>[ownHost]
- * [ownPortUserInfo]-><NULL>
- */
-static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- if (!URI_FUNC(OnExitOwnPortUserInfo)(state, first, memory)) {
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- return afterLast;
- }
-
- switch (*first) {
- /* begin sub-delims */
- case _UT('!'):
- case _UT('$'):
- case _UT('&'):
- case _UT('\''):
- case _UT('('):
- case _UT(')'):
- case _UT('*'):
- case _UT('+'):
- case _UT(','):
- case _UT(';'):
- case _UT('='):
- /* end sub-delims */
- /* begin unreserved (except alpha and digit) */
- case _UT('-'):
- case _UT('.'):
- case _UT('_'):
- case _UT('~'):
- /* end unreserved (except alpha and digit) */
- case _UT(':'):
- case URI_SET_ALPHA:
- state->uri->hostText.afterLast = NULL; /* Not a host, reset */
- state->uri->portText.first = NULL; /* Not a port, reset */
- return URI_FUNC(ParseOwnUserInfo)(state, first + 1, afterLast, memory);
-
- case URI_SET_DIGIT:
- return URI_FUNC(ParseOwnPortUserInfo)(state, first + 1, afterLast, memory);
-
- case _UT('%'):
- state->uri->portText.first = NULL; /* Not a port, reset */
- {
- const URI_CHAR * const afterPct
- = URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
- if (afterPct == NULL) {
- return NULL;
- }
- return URI_FUNC(ParseOwnUserInfo)(state, afterPct, afterLast, memory);
- }
-
- case _UT('@'):
- state->uri->hostText.afterLast = NULL; /* Not a host, reset */
- state->uri->portText.first = NULL; /* Not a port, reset */
- state->uri->userInfo.afterLast = first; /* USERINFO END */
- state->uri->hostText.first = first + 1; /* HOST BEGIN */
- return URI_FUNC(ParseOwnHost)(state, first + 1, afterLast, memory);
-
- default:
- if (!URI_FUNC(OnExitOwnPortUserInfo)(state, first, memory)) {
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- return first;
- }
-}
-
-
-
-/*
- * [ownUserInfo]->[pctSubUnres][ownUserInfo]
- * [ownUserInfo]-><:>[ownUserInfo]
- * [ownUserInfo]-><@>[ownHost]
- */
-static const URI_CHAR * URI_FUNC(ParseOwnUserInfo)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
-
- switch (*first) {
- case _UT('!'):
- case _UT('$'):
- case _UT('%'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('-'):
- case _UT('*'):
- case _UT(','):
- case _UT('.'):
- case _UT(';'):
- case _UT('\''):
- case _UT('_'):
- case _UT('~'):
- case _UT('+'):
- case _UT('='):
- case URI_SET_DIGIT:
- case URI_SET_ALPHA:
- {
- const URI_CHAR * const afterPctSubUnres
- = URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
- if (afterPctSubUnres == NULL) {
- return NULL;
- }
- return URI_FUNC(ParseOwnUserInfo)(state, afterPctSubUnres, afterLast, memory);
- }
-
- case _UT(':'):
- return URI_FUNC(ParseOwnUserInfo)(state, first + 1, afterLast, memory);
-
- case _UT('@'):
- /* SURE */
- state->uri->userInfo.afterLast = first; /* USERINFO END */
- state->uri->hostText.first = first + 1; /* HOST BEGIN */
- return URI_FUNC(ParseOwnHost)(state, first + 1, afterLast, memory);
-
- default:
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
-}
-
-
-
-static URI_INLINE void URI_FUNC(OnExitPartHelperTwo)(URI_TYPE(ParserState) * state) {
- state->uri->absolutePath = URI_TRUE;
-}
-
-
-
-/*
- * [partHelperTwo]->[pathAbsNoLeadSlash] // can take <NULL>
- * [partHelperTwo]-></>[authority][pathAbsEmpty]
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParsePartHelperTwo)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- URI_FUNC(OnExitPartHelperTwo)(state);
- return afterLast;
- }
-
- switch (*first) {
- case _UT('/'):
- {
- const URI_CHAR * const afterAuthority
- = URI_FUNC(ParseAuthority)(state, first + 1, afterLast, memory);
- const URI_CHAR * afterPathAbsEmpty;
- if (afterAuthority == NULL) {
- return NULL;
- }
- afterPathAbsEmpty = URI_FUNC(ParsePathAbsEmpty)(state, afterAuthority, afterLast, memory);
-
- URI_FUNC(FixEmptyTrailSegment)(state->uri, memory);
-
- return afterPathAbsEmpty;
- }
-
- default:
- URI_FUNC(OnExitPartHelperTwo)(state);
- return URI_FUNC(ParsePathAbsNoLeadSlash)(state, first, afterLast, memory);
- }
-}
-
-
-
-/*
- * [pathAbsEmpty]-></>[segment][pathAbsEmpty]
- * [pathAbsEmpty]-><NULL>
- */
-static const URI_CHAR * URI_FUNC(ParsePathAbsEmpty)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case _UT('/'):
- {
- const URI_CHAR * const afterSegment
- = URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
- if (afterSegment == NULL) {
- return NULL;
- }
- if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- return URI_FUNC(ParsePathAbsEmpty)(state, afterSegment, afterLast, memory);
- }
-
- default:
- return first;
- }
-}
-
-
-
-/*
- * [pathAbsNoLeadSlash]->[segmentNz][zeroMoreSlashSegs]
- * [pathAbsNoLeadSlash]-><NULL>
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParsePathAbsNoLeadSlash)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case _UT('!'):
- case _UT('$'):
- case _UT('%'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('-'):
- case _UT('*'):
- case _UT(','):
- case _UT('.'):
- case _UT(':'):
- case _UT(';'):
- case _UT('@'):
- case _UT('\''):
- case _UT('_'):
- case _UT('~'):
- case _UT('+'):
- case _UT('='):
- case URI_SET_DIGIT:
- case URI_SET_ALPHA:
- {
- const URI_CHAR * const afterSegmentNz
- = URI_FUNC(ParseSegmentNz)(state, first, afterLast, memory);
- if (afterSegmentNz == NULL) {
- return NULL;
- }
- if (!URI_FUNC(PushPathSegment)(state, first, afterSegmentNz, memory)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- return URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegmentNz, afterLast, memory);
- }
-
- default:
- return first;
- }
-}
-
-
-
-/*
- * [pathRootless]->[segmentNz][zeroMoreSlashSegs]
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParsePathRootless)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- const URI_CHAR * const afterSegmentNz
- = URI_FUNC(ParseSegmentNz)(state, first, afterLast, memory);
- if (afterSegmentNz == NULL) {
- return NULL;
- } else {
- if (!URI_FUNC(PushPathSegment)(state, first, afterSegmentNz, memory)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- }
- return URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegmentNz, afterLast, memory);
-}
-
-
-
-/*
- * [pchar]->[pctEncoded]
- * [pchar]->[subDelims]
- * [pchar]->[unreserved]
- * [pchar]-><:>
- * [pchar]-><@>
- */
-static const URI_CHAR * URI_FUNC(ParsePchar)(URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory) {
- if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
-
- switch (*first) {
- case _UT('%'):
- return URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
-
- case _UT(':'):
- case _UT('@'):
- case _UT('!'):
- case _UT('$'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('*'):
- case _UT(','):
- case _UT(';'):
- case _UT('\''):
- case _UT('+'):
- case _UT('='):
- case _UT('-'):
- case _UT('.'):
- case _UT('_'):
- case _UT('~'):
- case URI_SET_DIGIT:
- case URI_SET_ALPHA:
- return first + 1;
-
- default:
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
-}
-
-
-
-/*
- * [pctEncoded]-><%>[HEXDIG][HEXDIG]
- */
-static const URI_CHAR * URI_FUNC(ParsePctEncoded)(
- URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory) {
- if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
-
- /*
- First character has already been
- checked before entering this rule.
-
- switch (*first) {
- case _UT('%'):
- */
- if (first + 1 >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
-
- switch (first[1]) {
- case URI_SET_HEXDIG:
- if (first + 2 >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
-
- switch (first[2]) {
- case URI_SET_HEXDIG:
- return first + 3;
-
- default:
- URI_FUNC(StopSyntax)(state, first + 2, memory);
- return NULL;
- }
-
- default:
- URI_FUNC(StopSyntax)(state, first + 1, memory);
- return NULL;
- }
-
- /*
- default:
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
- */
-}
-
-
-
-/*
- * [pctSubUnres]->[pctEncoded]
- * [pctSubUnres]->[subDelims]
- * [pctSubUnres]->[unreserved]
- */
-static const URI_CHAR * URI_FUNC(ParsePctSubUnres)(
- URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory) {
- if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- return NULL;
- }
-
- switch (*first) {
- case _UT('%'):
- return URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
-
- case _UT('!'):
- case _UT('$'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('*'):
- case _UT(','):
- case _UT(';'):
- case _UT('\''):
- case _UT('+'):
- case _UT('='):
- case _UT('-'):
- case _UT('.'):
- case _UT('_'):
- case _UT('~'):
- case URI_SET_DIGIT:
- case URI_SET_ALPHA:
- return first + 1;
-
- default:
- URI_FUNC(StopSyntax)(state, first, memory);
- return NULL;
- }
-}
-
-
-
-/*
- * [port]->[DIGIT][port]
- * [port]-><NULL>
- */
-static const URI_CHAR * URI_FUNC(ParsePort)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case URI_SET_DIGIT:
- return URI_FUNC(ParsePort)(state, first + 1, afterLast);
-
- default:
- return first;
- }
-}
-
-
-
-/*
- * [queryFrag]->[pchar][queryFrag]
- * [queryFrag]-></>[queryFrag]
- * [queryFrag]-><?>[queryFrag]
- * [queryFrag]-><NULL>
- */
-static const URI_CHAR * URI_FUNC(ParseQueryFrag)(URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case _UT('!'):
- case _UT('$'):
- case _UT('%'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('-'):
- case _UT('*'):
- case _UT(','):
- case _UT('.'):
- case _UT(':'):
- case _UT(';'):
- case _UT('@'):
- case _UT('\''):
- case _UT('_'):
- case _UT('~'):
- case _UT('+'):
- case _UT('='):
- case URI_SET_DIGIT:
- case URI_SET_ALPHA:
- {
- const URI_CHAR * const afterPchar
- = URI_FUNC(ParsePchar)(state, first, afterLast, memory);
- if (afterPchar == NULL) {
- return NULL;
- }
- return URI_FUNC(ParseQueryFrag)(state, afterPchar, afterLast, memory);
- }
-
- case _UT('/'):
- case _UT('?'):
- return URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
-
- default:
- return first;
- }
-}
-
-
-
-/*
- * [segment]->[pchar][segment]
- * [segment]-><NULL>
- */
-static const URI_CHAR * URI_FUNC(ParseSegment)(URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case _UT('!'):
- case _UT('$'):
- case _UT('%'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('-'):
- case _UT('*'):
- case _UT(','):
- case _UT('.'):
- case _UT(':'):
- case _UT(';'):
- case _UT('@'):
- case _UT('\''):
- case _UT('_'):
- case _UT('~'):
- case _UT('+'):
- case _UT('='):
- case URI_SET_DIGIT:
- case URI_SET_ALPHA:
- {
- const URI_CHAR * const afterPchar
- = URI_FUNC(ParsePchar)(state, first, afterLast, memory);
- if (afterPchar == NULL) {
- return NULL;
- }
- return URI_FUNC(ParseSegment)(state, afterPchar, afterLast, memory);
- }
-
- default:
- return first;
- }
-}
-
-
-
-/*
- * [segmentNz]->[pchar][segment]
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseSegmentNz)(
- URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory) {
- const URI_CHAR * const afterPchar
- = URI_FUNC(ParsePchar)(state, first, afterLast, memory);
- if (afterPchar == NULL) {
- return NULL;
- }
- return URI_FUNC(ParseSegment)(state, afterPchar, afterLast, memory);
-}
-
-
-
-static URI_INLINE UriBool URI_FUNC(OnExitSegmentNzNcOrScheme2)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- UriMemoryManager * memory) {
- if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
- return URI_FALSE; /* Raises malloc error*/
- }
- state->uri->scheme.first = NULL; /* Not a scheme, reset */
- return URI_TRUE; /* Success */
-}
-
-
-
-/*
- * [segmentNzNcOrScheme2]->[ALPHA][segmentNzNcOrScheme2]
- * [segmentNzNcOrScheme2]->[DIGIT][segmentNzNcOrScheme2]
- * [segmentNzNcOrScheme2]->[pctEncoded][mustBeSegmentNzNc]
- * [segmentNzNcOrScheme2]->[uriTail] // can take <NULL>
- * [segmentNzNcOrScheme2]-><!>[mustBeSegmentNzNc]
- * [segmentNzNcOrScheme2]-><$>[mustBeSegmentNzNc]
- * [segmentNzNcOrScheme2]-><&>[mustBeSegmentNzNc]
- * [segmentNzNcOrScheme2]-><(>[mustBeSegmentNzNc]
- * [segmentNzNcOrScheme2]-><)>[mustBeSegmentNzNc]
- * [segmentNzNcOrScheme2]-><*>[mustBeSegmentNzNc]
- * [segmentNzNcOrScheme2]-><,>[mustBeSegmentNzNc]
- * [segmentNzNcOrScheme2]-><.>[segmentNzNcOrScheme2]
- * [segmentNzNcOrScheme2]-></>[segment][zeroMoreSlashSegs][uriTail]
- * [segmentNzNcOrScheme2]-><:>[hierPart][uriTail]
- * [segmentNzNcOrScheme2]-><;>[mustBeSegmentNzNc]
- * [segmentNzNcOrScheme2]-><@>[mustBeSegmentNzNc]
- * [segmentNzNcOrScheme2]-><_>[mustBeSegmentNzNc]
- * [segmentNzNcOrScheme2]-><~>[mustBeSegmentNzNc]
- * [segmentNzNcOrScheme2]-><+>[segmentNzNcOrScheme2]
- * [segmentNzNcOrScheme2]-><=>[mustBeSegmentNzNc]
- * [segmentNzNcOrScheme2]-><'>[mustBeSegmentNzNc]
- * [segmentNzNcOrScheme2]-><->[segmentNzNcOrScheme2]
- */
-static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- if (!URI_FUNC(OnExitSegmentNzNcOrScheme2)(state, first, memory)) {
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- return afterLast;
- }
-
- switch (*first) {
- case _UT('.'):
- case _UT('+'):
- case _UT('-'):
- case URI_SET_ALPHA:
- case URI_SET_DIGIT:
- return URI_FUNC(ParseSegmentNzNcOrScheme2)(state, first + 1, afterLast, memory);
-
- case _UT('%'):
- {
- const URI_CHAR * const afterPctEncoded
- = URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
- if (afterPctEncoded == NULL) {
- return NULL;
- }
- return URI_FUNC(ParseMustBeSegmentNzNc)(state, afterPctEncoded, afterLast, memory);
- }
-
- case _UT('!'):
- case _UT('$'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('*'):
- case _UT(','):
- case _UT(';'):
- case _UT('@'):
- case _UT('_'):
- case _UT('~'):
- case _UT('='):
- case _UT('\''):
- return URI_FUNC(ParseMustBeSegmentNzNc)(state, first + 1, afterLast, memory);
-
- case _UT('/'):
- {
- const URI_CHAR * afterZeroMoreSlashSegs;
- const URI_CHAR * const afterSegment
- = URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
- if (afterSegment == NULL) {
- return NULL;
- }
- if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- state->uri->scheme.first = NULL; /* Not a scheme, reset */
- if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- afterZeroMoreSlashSegs
- = URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast, memory);
- if (afterZeroMoreSlashSegs == NULL) {
- return NULL;
- }
- return URI_FUNC(ParseUriTail)(state, afterZeroMoreSlashSegs, afterLast, memory);
- }
-
- case _UT(':'):
- {
- const URI_CHAR * const afterHierPart
- = URI_FUNC(ParseHierPart)(state, first + 1, afterLast, memory);
- state->uri->scheme.afterLast = first; /* SCHEME END */
- if (afterHierPart == NULL) {
- return NULL;
- }
- return URI_FUNC(ParseUriTail)(state, afterHierPart, afterLast, memory);
- }
-
- default:
- if (!URI_FUNC(OnExitSegmentNzNcOrScheme2)(state, first, memory)) {
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- return URI_FUNC(ParseUriTail)(state, first, afterLast, memory);
- }
-}
-
-
-
-/*
- * [uriReference]->[ALPHA][segmentNzNcOrScheme2]
- * [uriReference]->[DIGIT][mustBeSegmentNzNc]
- * [uriReference]->[pctEncoded][mustBeSegmentNzNc]
- * [uriReference]->[subDelims][mustBeSegmentNzNc]
- * [uriReference]->[uriTail] // can take <NULL>
- * [uriReference]-><.>[mustBeSegmentNzNc]
- * [uriReference]-></>[partHelperTwo][uriTail]
- * [uriReference]-><@>[mustBeSegmentNzNc]
- * [uriReference]-><_>[mustBeSegmentNzNc]
- * [uriReference]-><~>[mustBeSegmentNzNc]
- * [uriReference]-><->[mustBeSegmentNzNc]
- */
-static const URI_CHAR * URI_FUNC(ParseUriReference)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case URI_SET_ALPHA:
- state->uri->scheme.first = first; /* SCHEME BEGIN */
- return URI_FUNC(ParseSegmentNzNcOrScheme2)(state, first + 1, afterLast, memory);
-
- case URI_SET_DIGIT:
- case _UT('!'):
- case _UT('$'):
- case _UT('&'):
- case _UT('('):
- case _UT(')'):
- case _UT('*'):
- case _UT(','):
- case _UT(';'):
- case _UT('\''):
- case _UT('+'):
- case _UT('='):
- case _UT('.'):
- case _UT('_'):
- case _UT('~'):
- case _UT('-'):
- case _UT('@'):
- state->uri->scheme.first = first; /* SEGMENT BEGIN, ABUSE SCHEME POINTER */
- return URI_FUNC(ParseMustBeSegmentNzNc)(state, first + 1, afterLast, memory);
-
- case _UT('%'):
- {
- const URI_CHAR * const afterPctEncoded
- = URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
- if (afterPctEncoded == NULL) {
- return NULL;
- }
- state->uri->scheme.first = first; /* SEGMENT BEGIN, ABUSE SCHEME POINTER */
- return URI_FUNC(ParseMustBeSegmentNzNc)(state, afterPctEncoded, afterLast, memory);
- }
-
- case _UT('/'):
- {
- const URI_CHAR * const afterPartHelperTwo
- = URI_FUNC(ParsePartHelperTwo)(state, first + 1, afterLast, memory);
- if (afterPartHelperTwo == NULL) {
- return NULL;
- }
- return URI_FUNC(ParseUriTail)(state, afterPartHelperTwo, afterLast, memory);
- }
-
- default:
- return URI_FUNC(ParseUriTail)(state, first, afterLast, memory);
- }
-}
-
-
-
-/*
- * [uriTail]-><#>[queryFrag]
- * [uriTail]-><?>[queryFrag][uriTailTwo]
- * [uriTail]-><NULL>
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTail)(
- URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case _UT('#'):
- {
- const URI_CHAR * const afterQueryFrag = URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
- if (afterQueryFrag == NULL) {
- return NULL;
- }
- state->uri->fragment.first = first + 1; /* FRAGMENT BEGIN */
- state->uri->fragment.afterLast = afterQueryFrag; /* FRAGMENT END */
- return afterQueryFrag;
- }
-
- case _UT('?'):
- {
- const URI_CHAR * const afterQueryFrag
- = URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
- if (afterQueryFrag == NULL) {
- return NULL;
- }
- state->uri->query.first = first + 1; /* QUERY BEGIN */
- state->uri->query.afterLast = afterQueryFrag; /* QUERY END */
- return URI_FUNC(ParseUriTailTwo)(state, afterQueryFrag, afterLast, memory);
- }
-
- default:
- return first;
- }
-}
-
-
-
-/*
- * [uriTailTwo]-><#>[queryFrag]
- * [uriTailTwo]-><NULL>
- */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTailTwo)(
- URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case _UT('#'):
- {
- const URI_CHAR * const afterQueryFrag = URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
- if (afterQueryFrag == NULL) {
- return NULL;
- }
- state->uri->fragment.first = first + 1; /* FRAGMENT BEGIN */
- state->uri->fragment.afterLast = afterQueryFrag; /* FRAGMENT END */
- return afterQueryFrag;
- }
-
- default:
- return first;
- }
-}
-
-
-
-/*
- * [zeroMoreSlashSegs]-></>[segment][zeroMoreSlashSegs]
- * [zeroMoreSlashSegs]-><NULL>
- */
-static const URI_CHAR * URI_FUNC(ParseZeroMoreSlashSegs)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- if (first >= afterLast) {
- return afterLast;
- }
-
- switch (*first) {
- case _UT('/'):
- {
- const URI_CHAR * const afterSegment
- = URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
- if (afterSegment == NULL) {
- return NULL;
- }
- if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state, memory);
- return NULL;
- }
- return URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast, memory);
- }
-
- default:
- return first;
- }
-}
-
-
-
-static URI_INLINE void URI_FUNC(ResetParserStateExceptUri)(URI_TYPE(ParserState) * state) {
- URI_TYPE(Uri) * const uriBackup = state->uri;
- memset(state, 0, sizeof(URI_TYPE(ParserState)));
- state->uri = uriBackup;
-}
-
-
-
-static URI_INLINE UriBool URI_FUNC(PushPathSegment)(
- URI_TYPE(ParserState) * state, const URI_CHAR * first,
- const URI_CHAR * afterLast, UriMemoryManager * memory) {
- URI_TYPE(PathSegment) * segment = memory->calloc(memory, 1, sizeof(URI_TYPE(PathSegment)));
- if (segment == NULL) {
- return URI_FALSE; /* Raises malloc error */
- }
- if (first == afterLast) {
- segment->text.first = URI_FUNC(SafeToPointTo);
- segment->text.afterLast = URI_FUNC(SafeToPointTo);
- } else {
- segment->text.first = first;
- segment->text.afterLast = afterLast;
- }
-
- /* First segment ever? */
- if (state->uri->pathHead == NULL) {
- /* First segment ever, set head and tail */
- state->uri->pathHead = segment;
- state->uri->pathTail = segment;
- } else {
- /* Append, update tail */
- state->uri->pathTail->next = segment;
- state->uri->pathTail = segment;
- }
-
- return URI_TRUE; /* Success */
-}
-
-
-
-int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast) {
- return URI_FUNC(ParseUriExMm)(state, first, afterLast, NULL);
-}
-
-
-
-static int URI_FUNC(ParseUriExMm)(URI_TYPE(ParserState) * state,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory) {
- const URI_CHAR * afterUriReference;
- URI_TYPE(Uri) * uri;
-
- /* Check params */
- if ((state == NULL) || (first == NULL) || (afterLast == NULL)) {
- return URI_ERROR_NULL;
- }
- URI_CHECK_MEMORY_MANAGER(memory); /* may return */
-
- uri = state->uri;
-
- /* Init parser */
- URI_FUNC(ResetParserStateExceptUri)(state);
- URI_FUNC(ResetUri)(uri);
-
- /* Parse */
- afterUriReference = URI_FUNC(ParseUriReference)(state, first, afterLast, memory);
- if (afterUriReference == NULL) {
- /* Waterproof errorPos <= afterLast */
- if (state->errorPos && (state->errorPos > afterLast)) {
- state->errorPos = afterLast;
- }
- return state->errorCode;
- }
- if (afterUriReference != afterLast) {
- if (afterUriReference < afterLast) {
- URI_FUNC(StopSyntax)(state, afterUriReference, memory);
- } else {
- URI_FUNC(StopSyntax)(state, afterLast, memory);
- }
- return state->errorCode;
- }
- return URI_SUCCESS;
-}
-
-
-
-int URI_FUNC(ParseUri)(URI_TYPE(ParserState) * state, const URI_CHAR * text) {
- if ((state == NULL) || (text == NULL)) {
- return URI_ERROR_NULL;
- }
- return URI_FUNC(ParseUriEx)(state, text, text + URI_STRLEN(text));
-}
-
-
-
-int URI_FUNC(ParseSingleUri)(URI_TYPE(Uri) * uri, const URI_CHAR * text,
- const URI_CHAR ** errorPos) {
- return URI_FUNC(ParseSingleUriEx)(uri, text, NULL, errorPos);
-}
-
-
-
-int URI_FUNC(ParseSingleUriEx)(URI_TYPE(Uri) * uri,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- const URI_CHAR ** errorPos) {
- if ((afterLast == NULL) && (first != NULL)) {
- afterLast = first + URI_STRLEN(first);
- }
- return URI_FUNC(ParseSingleUriExMm)(uri, first, afterLast, errorPos, NULL);
-}
-
-
-
-int URI_FUNC(ParseSingleUriExMm)(URI_TYPE(Uri) * uri,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- const URI_CHAR ** errorPos, UriMemoryManager * memory) {
- URI_TYPE(ParserState) state;
- int res;
-
- /* Check params */
- if ((uri == NULL) || (first == NULL) || (afterLast == NULL)) {
- return URI_ERROR_NULL;
- }
- URI_CHECK_MEMORY_MANAGER(memory); /* may return */
-
- state.uri = uri;
-
- res = URI_FUNC(ParseUriExMm)(&state, first, afterLast, memory);
-
- if (res != URI_SUCCESS) {
- if (errorPos != NULL) {
- *errorPos = state.errorPos;
- }
- URI_FUNC(FreeUriMembersMm)(uri, memory);
- }
-
- return res;
-}
-
-
-
-void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri) {
- URI_FUNC(FreeUriMembersMm)(uri, NULL);
-}
-
-
-
-int URI_FUNC(FreeUriMembersMm)(URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
- if (uri == NULL) {
- return URI_ERROR_NULL;
- }
-
- URI_CHECK_MEMORY_MANAGER(memory); /* may return */
-
- if (uri->owner) {
- /* Scheme */
- if (uri->scheme.first != NULL) {
- if (uri->scheme.first != uri->scheme.afterLast) {
- memory->free(memory, (URI_CHAR *)uri->scheme.first);
- }
- uri->scheme.first = NULL;
- uri->scheme.afterLast = NULL;
- }
-
- /* User info */
- if (uri->userInfo.first != NULL) {
- if (uri->userInfo.first != uri->userInfo.afterLast) {
- memory->free(memory, (URI_CHAR *)uri->userInfo.first);
- }
- uri->userInfo.first = NULL;
- uri->userInfo.afterLast = NULL;
- }
-
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file UriParse.c
+ * Holds the RFC 3986 %URI parsing implementation.
+ * NOTE: This source file includes itself twice.
+ */
+
+/* What encodings are enabled? */
+#include <uriparser/UriDefsConfig.h>
+#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* Include SELF twice */
+# ifdef URI_ENABLE_ANSI
+# define URI_PASS_ANSI 1
+# include "UriParse.c"
+# undef URI_PASS_ANSI
+# endif
+# ifdef URI_ENABLE_UNICODE
+# define URI_PASS_UNICODE 1
+# include "UriParse.c"
+# undef URI_PASS_UNICODE
+# endif
+#else
+# ifdef URI_PASS_ANSI
+# include <uriparser/UriDefsAnsi.h>
+# else
+# include <uriparser/UriDefsUnicode.h>
+# include <wchar.h>
+# endif
+
+
+
+#ifndef URI_DOXYGEN
+# include <uriparser/Uri.h>
+# include <uriparser/UriIp4.h>
+# include "UriCommon.h"
+# include "UriMemory.h"
+# include "UriParseBase.h"
+#endif
+
+
+
+#define URI_SET_DIGIT \
+ _UT('0'): \
+ case _UT('1'): \
+ case _UT('2'): \
+ case _UT('3'): \
+ case _UT('4'): \
+ case _UT('5'): \
+ case _UT('6'): \
+ case _UT('7'): \
+ case _UT('8'): \
+ case _UT('9')
+
+#define URI_SET_HEX_LETTER_UPPER \
+ _UT('A'): \
+ case _UT('B'): \
+ case _UT('C'): \
+ case _UT('D'): \
+ case _UT('E'): \
+ case _UT('F')
+
+#define URI_SET_HEX_LETTER_LOWER \
+ _UT('a'): \
+ case _UT('b'): \
+ case _UT('c'): \
+ case _UT('d'): \
+ case _UT('e'): \
+ case _UT('f')
+
+#define URI_SET_HEXDIG \
+ URI_SET_DIGIT: \
+ case URI_SET_HEX_LETTER_UPPER: \
+ case URI_SET_HEX_LETTER_LOWER
+
+#define URI_SET_ALPHA \
+ URI_SET_HEX_LETTER_UPPER: \
+ case URI_SET_HEX_LETTER_LOWER: \
+ case _UT('g'): \
+ case _UT('G'): \
+ case _UT('h'): \
+ case _UT('H'): \
+ case _UT('i'): \
+ case _UT('I'): \
+ case _UT('j'): \
+ case _UT('J'): \
+ case _UT('k'): \
+ case _UT('K'): \
+ case _UT('l'): \
+ case _UT('L'): \
+ case _UT('m'): \
+ case _UT('M'): \
+ case _UT('n'): \
+ case _UT('N'): \
+ case _UT('o'): \
+ case _UT('O'): \
+ case _UT('p'): \
+ case _UT('P'): \
+ case _UT('q'): \
+ case _UT('Q'): \
+ case _UT('r'): \
+ case _UT('R'): \
+ case _UT('s'): \
+ case _UT('S'): \
+ case _UT('t'): \
+ case _UT('T'): \
+ case _UT('u'): \
+ case _UT('U'): \
+ case _UT('v'): \
+ case _UT('V'): \
+ case _UT('w'): \
+ case _UT('W'): \
+ case _UT('x'): \
+ case _UT('X'): \
+ case _UT('y'): \
+ case _UT('Y'): \
+ case _UT('z'): \
+ case _UT('Z')
+
+
+
+static const URI_CHAR * URI_FUNC(ParseAuthority)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseAuthorityTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseHexZero)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseHierPart)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseIpFutLoop)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseIpFutStopGo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseIpLit2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseOwnHost)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseOwnHost2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfoNz)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseOwnUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePartHelperTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePathAbsEmpty)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePathAbsNoLeadSlash)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePathRootless)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePchar)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePctEncoded)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePctSubUnres)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePort)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseQueryFrag)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseSegment)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseSegmentNz)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseUriReference)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseUriTail)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseUriTailTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseZeroMoreSlashSegs)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+
+static UriBool URI_FUNC(OnExitOwnHost2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
+static UriBool URI_FUNC(OnExitOwnHostUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
+static UriBool URI_FUNC(OnExitOwnPortUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
+static UriBool URI_FUNC(OnExitSegmentNzNcOrScheme2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
+static void URI_FUNC(OnExitPartHelperTwo)(URI_TYPE(ParserState) * state);
+
+static void URI_FUNC(ResetParserStateExceptUri)(URI_TYPE(ParserState) * state);
+
+static UriBool URI_FUNC(PushPathSegment)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory);
+
+static void URI_FUNC(StopSyntax)(URI_TYPE(ParserState) * state, const URI_CHAR * errorPos, UriMemoryManager * memory);
+static void URI_FUNC(StopMalloc)(URI_TYPE(ParserState) * state, UriMemoryManager * memory);
+
+static int URI_FUNC(ParseUriExMm)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory);
+
+
+
+static URI_INLINE void URI_FUNC(StopSyntax)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * errorPos, UriMemoryManager * memory) {
+ URI_FUNC(FreeUriMembersMm)(state->uri, memory);
+ state->errorPos = errorPos;
+ state->errorCode = URI_ERROR_SYNTAX;
+}
+
+
+
+static URI_INLINE void URI_FUNC(StopMalloc)(URI_TYPE(ParserState) * state, UriMemoryManager * memory) {
+ URI_FUNC(FreeUriMembersMm)(state->uri, memory);
+ state->errorPos = NULL;
+ state->errorCode = URI_ERROR_MALLOC;
+}
+
+
+
+/*
+ * [authority]-><[>[ipLit2][authorityTwo]
+ * [authority]->[ownHostUserInfoNz]
+ * [authority]-><NULL>
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseAuthority)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ /* "" regname host */
+ state->uri->hostText.first = URI_FUNC(SafeToPointTo);
+ state->uri->hostText.afterLast = URI_FUNC(SafeToPointTo);
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('['):
+ {
+ const URI_CHAR * const afterIpLit2
+ = URI_FUNC(ParseIpLit2)(state, first + 1, afterLast, memory);
+ if (afterIpLit2 == NULL) {
+ return NULL;
+ }
+ state->uri->hostText.first = first + 1; /* HOST BEGIN */
+ return URI_FUNC(ParseAuthorityTwo)(state, afterIpLit2, afterLast);
+ }
+
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('%'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('-'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT('.'):
+ case _UT(':'):
+ case _UT(';'):
+ case _UT('@'):
+ case _UT('\''):
+ case _UT('_'):
+ case _UT('~'):
+ case _UT('+'):
+ case _UT('='):
+ case URI_SET_DIGIT:
+ case URI_SET_ALPHA:
+ state->uri->userInfo.first = first; /* USERINFO BEGIN */
+ return URI_FUNC(ParseOwnHostUserInfoNz)(state, first, afterLast, memory);
+
+ default:
+ /* "" regname host */
+ state->uri->hostText.first = URI_FUNC(SafeToPointTo);
+ state->uri->hostText.afterLast = URI_FUNC(SafeToPointTo);
+ return first;
+ }
+}
+
+
+
+/*
+ * [authorityTwo]-><:>[port]
+ * [authorityTwo]-><NULL>
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseAuthorityTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT(':'):
+ {
+ const URI_CHAR * const afterPort = URI_FUNC(ParsePort)(state, first + 1, afterLast);
+ if (afterPort == NULL) {
+ return NULL;
+ }
+ state->uri->portText.first = first + 1; /* PORT BEGIN */
+ state->uri->portText.afterLast = afterPort; /* PORT END */
+ return afterPort;
+ }
+
+ default:
+ return first;
+ }
+}
+
+
+
+/*
+ * [hexZero]->[HEXDIG][hexZero]
+ * [hexZero]-><NULL>
+ */
+static const URI_CHAR * URI_FUNC(ParseHexZero)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case URI_SET_HEXDIG:
+ return URI_FUNC(ParseHexZero)(state, first + 1, afterLast);
+
+ default:
+ return first;
+ }
+}
+
+
+
+/*
+ * [hierPart]->[pathRootless]
+ * [hierPart]-></>[partHelperTwo]
+ * [hierPart]-><NULL>
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseHierPart)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('%'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('-'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT('.'):
+ case _UT(':'):
+ case _UT(';'):
+ case _UT('@'):
+ case _UT('\''):
+ case _UT('_'):
+ case _UT('~'):
+ case _UT('+'):
+ case _UT('='):
+ case URI_SET_DIGIT:
+ case URI_SET_ALPHA:
+ return URI_FUNC(ParsePathRootless)(state, first, afterLast, memory);
+
+ case _UT('/'):
+ return URI_FUNC(ParsePartHelperTwo)(state, first + 1, afterLast, memory);
+
+ default:
+ return first;
+ }
+}
+
+
+
+/*
+ * [ipFutLoop]->[subDelims][ipFutStopGo]
+ * [ipFutLoop]->[unreserved][ipFutStopGo]
+ * [ipFutLoop]-><:>[ipFutStopGo]
+ */
+static const URI_CHAR * URI_FUNC(ParseIpFutLoop)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+
+ switch (*first) {
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('-'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT('.'):
+ case _UT(':'):
+ case _UT(';'):
+ case _UT('\''):
+ case _UT('_'):
+ case _UT('~'):
+ case _UT('+'):
+ case _UT('='):
+ case URI_SET_DIGIT:
+ case URI_SET_ALPHA:
+ return URI_FUNC(ParseIpFutStopGo)(state, first + 1, afterLast, memory);
+
+ default:
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+}
+
+
+
+/*
+ * [ipFutStopGo]->[ipFutLoop]
+ * [ipFutStopGo]-><NULL>
+ */
+static const URI_CHAR * URI_FUNC(ParseIpFutStopGo)(
+ URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('-'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT('.'):
+ case _UT(':'):
+ case _UT(';'):
+ case _UT('\''):
+ case _UT('_'):
+ case _UT('~'):
+ case _UT('+'):
+ case _UT('='):
+ case URI_SET_DIGIT:
+ case URI_SET_ALPHA:
+ return URI_FUNC(ParseIpFutLoop)(state, first, afterLast, memory);
+
+ default:
+ return first;
+ }
+}
+
+
+
+/*
+ * [ipFuture]-><v>[HEXDIG][hexZero]<.>[ipFutLoop]
+ */
+static const URI_CHAR * URI_FUNC(ParseIpFuture)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+
+ /*
+ First character has already been
+ checked before entering this rule.
+
+ switch (*first) {
+ case _UT('v'):
+ */
+ if (first + 1 >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+
+ switch (first[1]) {
+ case URI_SET_HEXDIG:
+ {
+ const URI_CHAR * afterIpFutLoop;
+ const URI_CHAR * const afterHexZero
+ = URI_FUNC(ParseHexZero)(state, first + 2, afterLast);
+ if (afterHexZero == NULL) {
+ return NULL;
+ }
+ if (afterHexZero >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+ if (*afterHexZero != _UT('.')) {
+ URI_FUNC(StopSyntax)(state, afterHexZero, memory);
+ return NULL;
+ }
+ state->uri->hostText.first = first; /* HOST BEGIN */
+ state->uri->hostData.ipFuture.first = first; /* IPFUTURE BEGIN */
+ afterIpFutLoop = URI_FUNC(ParseIpFutLoop)(state, afterHexZero + 1, afterLast, memory);
+ if (afterIpFutLoop == NULL) {
+ return NULL;
+ }
+ state->uri->hostText.afterLast = afterIpFutLoop; /* HOST END */
+ state->uri->hostData.ipFuture.afterLast = afterIpFutLoop; /* IPFUTURE END */
+ return afterIpFutLoop;
+ }
+
+ default:
+ URI_FUNC(StopSyntax)(state, first + 1, memory);
+ return NULL;
+ }
+
+ /*
+ default:
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+ */
+}
+
+
+
+/*
+ * [ipLit2]->[ipFuture]<]>
+ * [ipLit2]->[IPv6address2]
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseIpLit2)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+
+ switch (*first) {
+ case _UT('v'):
+ {
+ const URI_CHAR * const afterIpFuture
+ = URI_FUNC(ParseIpFuture)(state, first, afterLast, memory);
+ if (afterIpFuture == NULL) {
+ return NULL;
+ }
+ if (afterIpFuture >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+ if (*afterIpFuture != _UT(']')) {
+ URI_FUNC(StopSyntax)(state, afterIpFuture, memory);
+ return NULL;
+ }
+ return afterIpFuture + 1;
+ }
+
+ case _UT(':'):
+ case _UT(']'):
+ case URI_SET_HEXDIG:
+ state->uri->hostData.ip6 = memory->malloc(memory, 1 * sizeof(UriIp6)); /* Freed when stopping on parse error */
+ if (state->uri->hostData.ip6 == NULL) {
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ return URI_FUNC(ParseIPv6address2)(state, first, afterLast, memory);
+
+ default:
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+}
+
+
+
+/*
+ * [IPv6address2]->..<]>
+ */
+static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
+ URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
+ int zipperEver = 0;
+ int quadsDone = 0;
+ int digitCount = 0;
+ unsigned char digitHistory[4];
+ int ip4OctetsDone = 0;
+
+ unsigned char quadsAfterZipper[14];
+ int quadsAfterZipperCount = 0;
+
+
+ for (;;) {
+ if (first >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+
+ /* Inside IPv4 part? */
+ if (ip4OctetsDone > 0) {
+ /* Eat rest of IPv4 address */
+ for (;;) {
+ switch (*first) {
+ case URI_SET_DIGIT:
+ if (digitCount == 4) {
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+ digitHistory[digitCount++] = (unsigned char)(9 + *first - _UT('9'));
+ break;
+
+ case _UT('.'):
+ if ((ip4OctetsDone == 4) /* NOTE! */
+ || (digitCount == 0)
+ || (digitCount == 4)) {
+ /* Invalid digit or octet count */
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ } else if ((digitCount > 1)
+ && (digitHistory[0] == 0)) {
+ /* Leading zero */
+ URI_FUNC(StopSyntax)(state, first - digitCount, memory);
+ return NULL;
+ } else if ((digitCount > 2)
+ && (digitHistory[1] == 0)) {
+ /* Leading zero */
+ URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
+ return NULL;
+ } else if ((digitCount == 3)
+ && (100 * digitHistory[0]
+ + 10 * digitHistory[1]
+ + digitHistory[2] > 255)) {
+ /* Octet value too large */
+ if (digitHistory[0] > 2) {
+ URI_FUNC(StopSyntax)(state, first - 3, memory);
+ } else if (digitHistory[1] > 5) {
+ URI_FUNC(StopSyntax)(state, first - 2, memory);
+ } else {
+ URI_FUNC(StopSyntax)(state, first - 1, memory);
+ }
+ return NULL;
+ }
+
+ /* Copy IPv4 octet */
+ state->uri->hostData.ip6->data[16 - 4 + ip4OctetsDone] = uriGetOctetValue(digitHistory, digitCount);
+ digitCount = 0;
+ ip4OctetsDone++;
+ break;
+
+ case _UT(']'):
+ if ((ip4OctetsDone != 3) /* NOTE! */
+ || (digitCount == 0)
+ || (digitCount == 4)) {
+ /* Invalid digit or octet count */
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ } else if ((digitCount > 1)
+ && (digitHistory[0] == 0)) {
+ /* Leading zero */
+ URI_FUNC(StopSyntax)(state, first - digitCount, memory);
+ return NULL;
+ } else if ((digitCount > 2)
+ && (digitHistory[1] == 0)) {
+ /* Leading zero */
+ URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
+ return NULL;
+ } else if ((digitCount == 3)
+ && (100 * digitHistory[0]
+ + 10 * digitHistory[1]
+ + digitHistory[2] > 255)) {
+ /* Octet value too large */
+ if (digitHistory[0] > 2) {
+ URI_FUNC(StopSyntax)(state, first - 3, memory);
+ } else if (digitHistory[1] > 5) {
+ URI_FUNC(StopSyntax)(state, first - 2, memory);
+ } else {
+ URI_FUNC(StopSyntax)(state, first - 1, memory);
+ }
+ return NULL;
+ }
+
+ state->uri->hostText.afterLast = first; /* HOST END */
+
+ /* Copy missing quads right before IPv4 */
+ memcpy(state->uri->hostData.ip6->data + 16 - 4 - 2 * quadsAfterZipperCount,
+ quadsAfterZipper, 2 * quadsAfterZipperCount);
+
+ /* Copy last IPv4 octet */
+ state->uri->hostData.ip6->data[16 - 4 + 3] = uriGetOctetValue(digitHistory, digitCount);
+
+ return first + 1;
+
+ default:
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+ first++;
+
+ if (first >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+ }
+ } else {
+ /* Eat while no dot in sight */
+ int letterAmong = 0;
+ int walking = 1;
+ do {
+ switch (*first) {
+ case URI_SET_HEX_LETTER_LOWER:
+ letterAmong = 1;
+ if (digitCount == 4) {
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+ digitHistory[digitCount] = (unsigned char)(15 + *first - _UT('f'));
+ digitCount++;
+ break;
+
+ case URI_SET_HEX_LETTER_UPPER:
+ letterAmong = 1;
+ if (digitCount == 4) {
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+ digitHistory[digitCount] = (unsigned char)(15 + *first - _UT('F'));
+ digitCount++;
+ break;
+
+ case URI_SET_DIGIT:
+ if (digitCount == 4) {
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+ digitHistory[digitCount] = (unsigned char)(9 + *first - _UT('9'));
+ digitCount++;
+ break;
+
+ case _UT(':'):
+ {
+ int setZipper = 0;
+
+ if (digitCount > 0) {
+ if (zipperEver) {
+ uriWriteQuadToDoubleByte(digitHistory, digitCount, quadsAfterZipper + 2 * quadsAfterZipperCount);
+ quadsAfterZipperCount++;
+ } else {
+ uriWriteQuadToDoubleByte(digitHistory, digitCount, state->uri->hostData.ip6->data + 2 * quadsDone);
+ }
+ quadsDone++;
+ digitCount = 0;
+ }
+ letterAmong = 0;
+
+ /* Too many quads? */
+ if (quadsDone >= 8 - zipperEver) {
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+
+ /* "::"? */
+ if (first + 1 >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+ if (first[1] == _UT(':')) {
+ const int resetOffset = 2 * (quadsDone + (digitCount > 0));
+
+ first++;
+ if (zipperEver) {
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL; /* "::.+::" */
+ }
+
+ /* Zero everything after zipper */
+ memset(state->uri->hostData.ip6->data + resetOffset, 0, 16 - resetOffset);
+ setZipper = 1;
+
+ /* ":::+"? */
+ if (first + 1 >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL; /* No ']' yet */
+ }
+ if (first[1] == _UT(':')) {
+ URI_FUNC(StopSyntax)(state, first + 1, memory);
+ return NULL; /* ":::+ "*/
+ }
+ }
+
+ if (setZipper) {
+ zipperEver = 1;
+ }
+ }
+ break;
+
+ case _UT('.'):
+ if ((quadsDone > 6) /* NOTE */
+ || (!zipperEver && (quadsDone < 6))
+ || letterAmong
+ || (digitCount == 0)
+ || (digitCount == 4)) {
+ /* Invalid octet before */
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ } else if ((digitCount > 1)
+ && (digitHistory[0] == 0)) {
+ /* Leading zero */
+ URI_FUNC(StopSyntax)(state, first - digitCount, memory);
+ return NULL;
+ } else if ((digitCount > 2)
+ && (digitHistory[1] == 0)) {
+ /* Leading zero */
+ URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
+ return NULL;
+ } else if ((digitCount == 3)
+ && (100 * digitHistory[0]
+ + 10 * digitHistory[1]
+ + digitHistory[2] > 255)) {
+ /* Octet value too large */
+ if (digitHistory[0] > 2) {
+ URI_FUNC(StopSyntax)(state, first - 3, memory);
+ } else if (digitHistory[1] > 5) {
+ URI_FUNC(StopSyntax)(state, first - 2, memory);
+ } else {
+ URI_FUNC(StopSyntax)(state, first - 1, memory);
+ }
+ return NULL;
+ }
+
+ /* Copy first IPv4 octet */
+ state->uri->hostData.ip6->data[16 - 4] = uriGetOctetValue(digitHistory, digitCount);
+ digitCount = 0;
+
+ /* Switch over to IPv4 loop */
+ ip4OctetsDone = 1;
+ walking = 0;
+ break;
+
+ case _UT(']'):
+ /* Too little quads? */
+ if (!zipperEver && !((quadsDone == 7) && (digitCount > 0))) {
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+
+ if (digitCount > 0) {
+ if (zipperEver) {
+ uriWriteQuadToDoubleByte(digitHistory, digitCount, quadsAfterZipper + 2 * quadsAfterZipperCount);
+ quadsAfterZipperCount++;
+ } else {
+ uriWriteQuadToDoubleByte(digitHistory, digitCount, state->uri->hostData.ip6->data + 2 * quadsDone);
+ }
+ /*
+ quadsDone++;
+ digitCount = 0;
+ */
+ }
+
+ /* Copy missing quads to the end */
+ memcpy(state->uri->hostData.ip6->data + 16 - 2 * quadsAfterZipperCount,
+ quadsAfterZipper, 2 * quadsAfterZipperCount);
+
+ state->uri->hostText.afterLast = first; /* HOST END */
+ return first + 1; /* Fine */
+
+ default:
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+ first++;
+
+ if (first >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL; /* No ']' yet */
+ }
+ } while (walking);
+ }
+ }
+}
+
+
+
+/*
+ * [mustBeSegmentNzNc]->[pctEncoded][mustBeSegmentNzNc]
+ * [mustBeSegmentNzNc]->[subDelims][mustBeSegmentNzNc]
+ * [mustBeSegmentNzNc]->[unreserved][mustBeSegmentNzNc]
+ * [mustBeSegmentNzNc]->[uriTail] // can take <NULL>
+ * [mustBeSegmentNzNc]-></>[segment][zeroMoreSlashSegs][uriTail]
+ * [mustBeSegmentNzNc]-><@>[mustBeSegmentNzNc]
+ */
+static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ state->uri->scheme.first = NULL; /* Not a scheme, reset */
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('%'):
+ {
+ const URI_CHAR * const afterPctEncoded
+ = URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
+ if (afterPctEncoded == NULL) {
+ return NULL;
+ }
+ return URI_FUNC(ParseMustBeSegmentNzNc)(state, afterPctEncoded, afterLast, memory);
+ }
+
+ case _UT('@'):
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT(';'):
+ case _UT('\''):
+ case _UT('+'):
+ case _UT('='):
+ case _UT('-'):
+ case _UT('.'):
+ case _UT('_'):
+ case _UT('~'):
+ case URI_SET_DIGIT:
+ case URI_SET_ALPHA:
+ return URI_FUNC(ParseMustBeSegmentNzNc)(state, first + 1, afterLast, memory);
+
+ case _UT('/'):
+ {
+ const URI_CHAR * afterZeroMoreSlashSegs;
+ const URI_CHAR * afterSegment;
+ if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ state->uri->scheme.first = NULL; /* Not a scheme, reset */
+ afterSegment = URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
+ if (afterSegment == NULL) {
+ return NULL;
+ }
+ if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ afterZeroMoreSlashSegs
+ = URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast, memory);
+ if (afterZeroMoreSlashSegs == NULL) {
+ return NULL;
+ }
+ return URI_FUNC(ParseUriTail)(state, afterZeroMoreSlashSegs, afterLast, memory);
+ }
+
+ default:
+ if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ state->uri->scheme.first = NULL; /* Not a scheme, reset */
+ return URI_FUNC(ParseUriTail)(state, first, afterLast, memory);
+ }
+}
+
+
+
+/*
+ * [ownHost]-><[>[ipLit2][authorityTwo]
+ * [ownHost]->[ownHost2] // can take <NULL>
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHost)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ state->uri->hostText.afterLast = afterLast; /* HOST END */
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('['):
+ {
+ const URI_CHAR * const afterIpLit2
+ = URI_FUNC(ParseIpLit2)(state, first + 1, afterLast, memory);
+ if (afterIpLit2 == NULL) {
+ return NULL;
+ }
+ state->uri->hostText.first = first + 1; /* HOST BEGIN */
+ return URI_FUNC(ParseAuthorityTwo)(state, afterIpLit2, afterLast);
+ }
+
+ default:
+ return URI_FUNC(ParseOwnHost2)(state, first, afterLast, memory);
+ }
+}
+
+
+
+static URI_INLINE UriBool URI_FUNC(OnExitOwnHost2)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ UriMemoryManager * memory) {
+ state->uri->hostText.afterLast = first; /* HOST END */
+
+ /* Valid IPv4 or just a regname? */
+ state->uri->hostData.ip4 = memory->malloc(memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
+ if (state->uri->hostData.ip4 == NULL) {
+ return URI_FALSE; /* Raises malloc error */
+ }
+ if (URI_FUNC(ParseIpFourAddress)(state->uri->hostData.ip4->data,
+ state->uri->hostText.first, state->uri->hostText.afterLast)) {
+ /* Not IPv4 */
+ memory->free(memory, state->uri->hostData.ip4);
+ state->uri->hostData.ip4 = NULL;
+ }
+ return URI_TRUE; /* Success */
+}
+
+
+
+/*
+ * [ownHost2]->[authorityTwo] // can take <NULL>
+ * [ownHost2]->[pctSubUnres][ownHost2]
+ */
+static const URI_CHAR * URI_FUNC(ParseOwnHost2)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ if (!URI_FUNC(OnExitOwnHost2)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('%'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('-'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT('.'):
+ case _UT(';'):
+ case _UT('\''):
+ case _UT('_'):
+ case _UT('~'):
+ case _UT('+'):
+ case _UT('='):
+ case URI_SET_DIGIT:
+ case URI_SET_ALPHA:
+ {
+ const URI_CHAR * const afterPctSubUnres
+ = URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
+ if (afterPctSubUnres == NULL) {
+ return NULL;
+ }
+ return URI_FUNC(ParseOwnHost2)(state, afterPctSubUnres, afterLast, memory);
+ }
+
+ default:
+ if (!URI_FUNC(OnExitOwnHost2)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ return URI_FUNC(ParseAuthorityTwo)(state, first, afterLast);
+ }
+}
+
+
+
+static URI_INLINE UriBool URI_FUNC(OnExitOwnHostUserInfo)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ UriMemoryManager * memory) {
+ state->uri->hostText.first = state->uri->userInfo.first; /* Host instead of userInfo, update */
+ state->uri->userInfo.first = NULL; /* Not a userInfo, reset */
+ state->uri->hostText.afterLast = first; /* HOST END */
+
+ /* Valid IPv4 or just a regname? */
+ state->uri->hostData.ip4 = memory->malloc(memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
+ if (state->uri->hostData.ip4 == NULL) {
+ return URI_FALSE; /* Raises malloc error */
+ }
+ if (URI_FUNC(ParseIpFourAddress)(state->uri->hostData.ip4->data,
+ state->uri->hostText.first, state->uri->hostText.afterLast)) {
+ /* Not IPv4 */
+ memory->free(memory, state->uri->hostData.ip4);
+ state->uri->hostData.ip4 = NULL;
+ }
+ return URI_TRUE; /* Success */
+}
+
+
+
+/*
+ * [ownHostUserInfo]->[ownHostUserInfoNz]
+ * [ownHostUserInfo]-><NULL>
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHostUserInfo)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ if (!URI_FUNC(OnExitOwnHostUserInfo)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('%'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('-'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT('.'):
+ case _UT(':'):
+ case _UT(';'):
+ case _UT('@'):
+ case _UT('\''):
+ case _UT('_'):
+ case _UT('~'):
+ case _UT('+'):
+ case _UT('='):
+ case URI_SET_DIGIT:
+ case URI_SET_ALPHA:
+ return URI_FUNC(ParseOwnHostUserInfoNz)(state, first, afterLast, memory);
+
+ default:
+ if (!URI_FUNC(OnExitOwnHostUserInfo)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ return first;
+ }
+}
+
+
+
+/*
+ * [ownHostUserInfoNz]->[pctSubUnres][ownHostUserInfo]
+ * [ownHostUserInfoNz]-><:>[ownPortUserInfo]
+ * [ownHostUserInfoNz]-><@>[ownHost]
+ */
+static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfoNz)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+
+ switch (*first) {
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('%'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('-'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT('.'):
+ case _UT(';'):
+ case _UT('\''):
+ case _UT('_'):
+ case _UT('~'):
+ case _UT('+'):
+ case _UT('='):
+ case URI_SET_DIGIT:
+ case URI_SET_ALPHA:
+ {
+ const URI_CHAR * const afterPctSubUnres
+ = URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
+ if (afterPctSubUnres == NULL) {
+ return NULL;
+ }
+ return URI_FUNC(ParseOwnHostUserInfo)(state, afterPctSubUnres, afterLast, memory);
+ }
+
+ case _UT(':'):
+ state->uri->hostText.afterLast = first; /* HOST END */
+ state->uri->portText.first = first + 1; /* PORT BEGIN */
+ return URI_FUNC(ParseOwnPortUserInfo)(state, first + 1, afterLast, memory);
+
+ case _UT('@'):
+ state->uri->userInfo.afterLast = first; /* USERINFO END */
+ state->uri->hostText.first = first + 1; /* HOST BEGIN */
+ return URI_FUNC(ParseOwnHost)(state, first + 1, afterLast, memory);
+
+ default:
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+}
+
+
+
+static URI_INLINE UriBool URI_FUNC(OnExitOwnPortUserInfo)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ UriMemoryManager * memory) {
+ state->uri->hostText.first = state->uri->userInfo.first; /* Host instead of userInfo, update */
+ state->uri->userInfo.first = NULL; /* Not a userInfo, reset */
+ state->uri->portText.afterLast = first; /* PORT END */
+
+ /* Valid IPv4 or just a regname? */
+ state->uri->hostData.ip4 = memory->malloc(memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
+ if (state->uri->hostData.ip4 == NULL) {
+ return URI_FALSE; /* Raises malloc error */
+ }
+ if (URI_FUNC(ParseIpFourAddress)(state->uri->hostData.ip4->data,
+ state->uri->hostText.first, state->uri->hostText.afterLast)) {
+ /* Not IPv4 */
+ memory->free(memory, state->uri->hostData.ip4);
+ state->uri->hostData.ip4 = NULL;
+ }
+ return URI_TRUE; /* Success */
+}
+
+
+
+/*
+ * [ownPortUserInfo]->[ALPHA][ownUserInfo]
+ * [ownPortUserInfo]->[DIGIT][ownPortUserInfo]
+ * [ownPortUserInfo]-><.>[ownUserInfo]
+ * [ownPortUserInfo]-><_>[ownUserInfo]
+ * [ownPortUserInfo]-><~>[ownUserInfo]
+ * [ownPortUserInfo]-><->[ownUserInfo]
+ * [ownPortUserInfo]->[subDelims][ownUserInfo]
+ * [ownPortUserInfo]->[pctEncoded][ownUserInfo]
+ * [ownPortUserInfo]-><:>[ownUserInfo]
+ * [ownPortUserInfo]-><@>[ownHost]
+ * [ownPortUserInfo]-><NULL>
+ */
+static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ if (!URI_FUNC(OnExitOwnPortUserInfo)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ return afterLast;
+ }
+
+ switch (*first) {
+ /* begin sub-delims */
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('&'):
+ case _UT('\''):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('*'):
+ case _UT('+'):
+ case _UT(','):
+ case _UT(';'):
+ case _UT('='):
+ /* end sub-delims */
+ /* begin unreserved (except alpha and digit) */
+ case _UT('-'):
+ case _UT('.'):
+ case _UT('_'):
+ case _UT('~'):
+ /* end unreserved (except alpha and digit) */
+ case _UT(':'):
+ case URI_SET_ALPHA:
+ state->uri->hostText.afterLast = NULL; /* Not a host, reset */
+ state->uri->portText.first = NULL; /* Not a port, reset */
+ return URI_FUNC(ParseOwnUserInfo)(state, first + 1, afterLast, memory);
+
+ case URI_SET_DIGIT:
+ return URI_FUNC(ParseOwnPortUserInfo)(state, first + 1, afterLast, memory);
+
+ case _UT('%'):
+ state->uri->portText.first = NULL; /* Not a port, reset */
+ {
+ const URI_CHAR * const afterPct
+ = URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
+ if (afterPct == NULL) {
+ return NULL;
+ }
+ return URI_FUNC(ParseOwnUserInfo)(state, afterPct, afterLast, memory);
+ }
+
+ case _UT('@'):
+ state->uri->hostText.afterLast = NULL; /* Not a host, reset */
+ state->uri->portText.first = NULL; /* Not a port, reset */
+ state->uri->userInfo.afterLast = first; /* USERINFO END */
+ state->uri->hostText.first = first + 1; /* HOST BEGIN */
+ return URI_FUNC(ParseOwnHost)(state, first + 1, afterLast, memory);
+
+ default:
+ if (!URI_FUNC(OnExitOwnPortUserInfo)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ return first;
+ }
+}
+
+
+
+/*
+ * [ownUserInfo]->[pctSubUnres][ownUserInfo]
+ * [ownUserInfo]-><:>[ownUserInfo]
+ * [ownUserInfo]-><@>[ownHost]
+ */
+static const URI_CHAR * URI_FUNC(ParseOwnUserInfo)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+
+ switch (*first) {
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('%'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('-'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT('.'):
+ case _UT(';'):
+ case _UT('\''):
+ case _UT('_'):
+ case _UT('~'):
+ case _UT('+'):
+ case _UT('='):
+ case URI_SET_DIGIT:
+ case URI_SET_ALPHA:
+ {
+ const URI_CHAR * const afterPctSubUnres
+ = URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
+ if (afterPctSubUnres == NULL) {
+ return NULL;
+ }
+ return URI_FUNC(ParseOwnUserInfo)(state, afterPctSubUnres, afterLast, memory);
+ }
+
+ case _UT(':'):
+ return URI_FUNC(ParseOwnUserInfo)(state, first + 1, afterLast, memory);
+
+ case _UT('@'):
+ /* SURE */
+ state->uri->userInfo.afterLast = first; /* USERINFO END */
+ state->uri->hostText.first = first + 1; /* HOST BEGIN */
+ return URI_FUNC(ParseOwnHost)(state, first + 1, afterLast, memory);
+
+ default:
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+}
+
+
+
+static URI_INLINE void URI_FUNC(OnExitPartHelperTwo)(URI_TYPE(ParserState) * state) {
+ state->uri->absolutePath = URI_TRUE;
+}
+
+
+
+/*
+ * [partHelperTwo]->[pathAbsNoLeadSlash] // can take <NULL>
+ * [partHelperTwo]-></>[authority][pathAbsEmpty]
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParsePartHelperTwo)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ URI_FUNC(OnExitPartHelperTwo)(state);
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('/'):
+ {
+ const URI_CHAR * const afterAuthority
+ = URI_FUNC(ParseAuthority)(state, first + 1, afterLast, memory);
+ const URI_CHAR * afterPathAbsEmpty;
+ if (afterAuthority == NULL) {
+ return NULL;
+ }
+ afterPathAbsEmpty = URI_FUNC(ParsePathAbsEmpty)(state, afterAuthority, afterLast, memory);
+
+ URI_FUNC(FixEmptyTrailSegment)(state->uri, memory);
+
+ return afterPathAbsEmpty;
+ }
+
+ default:
+ URI_FUNC(OnExitPartHelperTwo)(state);
+ return URI_FUNC(ParsePathAbsNoLeadSlash)(state, first, afterLast, memory);
+ }
+}
+
+
+
+/*
+ * [pathAbsEmpty]-></>[segment][pathAbsEmpty]
+ * [pathAbsEmpty]-><NULL>
+ */
+static const URI_CHAR * URI_FUNC(ParsePathAbsEmpty)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('/'):
+ {
+ const URI_CHAR * const afterSegment
+ = URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
+ if (afterSegment == NULL) {
+ return NULL;
+ }
+ if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ return URI_FUNC(ParsePathAbsEmpty)(state, afterSegment, afterLast, memory);
+ }
+
+ default:
+ return first;
+ }
+}
+
+
+
+/*
+ * [pathAbsNoLeadSlash]->[segmentNz][zeroMoreSlashSegs]
+ * [pathAbsNoLeadSlash]-><NULL>
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParsePathAbsNoLeadSlash)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('%'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('-'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT('.'):
+ case _UT(':'):
+ case _UT(';'):
+ case _UT('@'):
+ case _UT('\''):
+ case _UT('_'):
+ case _UT('~'):
+ case _UT('+'):
+ case _UT('='):
+ case URI_SET_DIGIT:
+ case URI_SET_ALPHA:
+ {
+ const URI_CHAR * const afterSegmentNz
+ = URI_FUNC(ParseSegmentNz)(state, first, afterLast, memory);
+ if (afterSegmentNz == NULL) {
+ return NULL;
+ }
+ if (!URI_FUNC(PushPathSegment)(state, first, afterSegmentNz, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ return URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegmentNz, afterLast, memory);
+ }
+
+ default:
+ return first;
+ }
+}
+
+
+
+/*
+ * [pathRootless]->[segmentNz][zeroMoreSlashSegs]
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParsePathRootless)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ const URI_CHAR * const afterSegmentNz
+ = URI_FUNC(ParseSegmentNz)(state, first, afterLast, memory);
+ if (afterSegmentNz == NULL) {
+ return NULL;
+ } else {
+ if (!URI_FUNC(PushPathSegment)(state, first, afterSegmentNz, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ }
+ return URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegmentNz, afterLast, memory);
+}
+
+
+
+/*
+ * [pchar]->[pctEncoded]
+ * [pchar]->[subDelims]
+ * [pchar]->[unreserved]
+ * [pchar]-><:>
+ * [pchar]-><@>
+ */
+static const URI_CHAR * URI_FUNC(ParsePchar)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+
+ switch (*first) {
+ case _UT('%'):
+ return URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
+
+ case _UT(':'):
+ case _UT('@'):
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT(';'):
+ case _UT('\''):
+ case _UT('+'):
+ case _UT('='):
+ case _UT('-'):
+ case _UT('.'):
+ case _UT('_'):
+ case _UT('~'):
+ case URI_SET_DIGIT:
+ case URI_SET_ALPHA:
+ return first + 1;
+
+ default:
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+}
+
+
+
+/*
+ * [pctEncoded]-><%>[HEXDIG][HEXDIG]
+ */
+static const URI_CHAR * URI_FUNC(ParsePctEncoded)(
+ URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+
+ /*
+ First character has already been
+ checked before entering this rule.
+
+ switch (*first) {
+ case _UT('%'):
+ */
+ if (first + 1 >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+
+ switch (first[1]) {
+ case URI_SET_HEXDIG:
+ if (first + 2 >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+
+ switch (first[2]) {
+ case URI_SET_HEXDIG:
+ return first + 3;
+
+ default:
+ URI_FUNC(StopSyntax)(state, first + 2, memory);
+ return NULL;
+ }
+
+ default:
+ URI_FUNC(StopSyntax)(state, first + 1, memory);
+ return NULL;
+ }
+
+ /*
+ default:
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+ */
+}
+
+
+
+/*
+ * [pctSubUnres]->[pctEncoded]
+ * [pctSubUnres]->[subDelims]
+ * [pctSubUnres]->[unreserved]
+ */
+static const URI_CHAR * URI_FUNC(ParsePctSubUnres)(
+ URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ return NULL;
+ }
+
+ switch (*first) {
+ case _UT('%'):
+ return URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
+
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT(';'):
+ case _UT('\''):
+ case _UT('+'):
+ case _UT('='):
+ case _UT('-'):
+ case _UT('.'):
+ case _UT('_'):
+ case _UT('~'):
+ case URI_SET_DIGIT:
+ case URI_SET_ALPHA:
+ return first + 1;
+
+ default:
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
+}
+
+
+
+/*
+ * [port]->[DIGIT][port]
+ * [port]-><NULL>
+ */
+static const URI_CHAR * URI_FUNC(ParsePort)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case URI_SET_DIGIT:
+ return URI_FUNC(ParsePort)(state, first + 1, afterLast);
+
+ default:
+ return first;
+ }
+}
+
+
+
+/*
+ * [queryFrag]->[pchar][queryFrag]
+ * [queryFrag]-></>[queryFrag]
+ * [queryFrag]-><?>[queryFrag]
+ * [queryFrag]-><NULL>
+ */
+static const URI_CHAR * URI_FUNC(ParseQueryFrag)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('%'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('-'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT('.'):
+ case _UT(':'):
+ case _UT(';'):
+ case _UT('@'):
+ case _UT('\''):
+ case _UT('_'):
+ case _UT('~'):
+ case _UT('+'):
+ case _UT('='):
+ case URI_SET_DIGIT:
+ case URI_SET_ALPHA:
+ {
+ const URI_CHAR * const afterPchar
+ = URI_FUNC(ParsePchar)(state, first, afterLast, memory);
+ if (afterPchar == NULL) {
+ return NULL;
+ }
+ return URI_FUNC(ParseQueryFrag)(state, afterPchar, afterLast, memory);
+ }
+
+ case _UT('/'):
+ case _UT('?'):
+ return URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
+
+ default:
+ return first;
+ }
+}
+
+
+
+/*
+ * [segment]->[pchar][segment]
+ * [segment]-><NULL>
+ */
+static const URI_CHAR * URI_FUNC(ParseSegment)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('%'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('-'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT('.'):
+ case _UT(':'):
+ case _UT(';'):
+ case _UT('@'):
+ case _UT('\''):
+ case _UT('_'):
+ case _UT('~'):
+ case _UT('+'):
+ case _UT('='):
+ case URI_SET_DIGIT:
+ case URI_SET_ALPHA:
+ {
+ const URI_CHAR * const afterPchar
+ = URI_FUNC(ParsePchar)(state, first, afterLast, memory);
+ if (afterPchar == NULL) {
+ return NULL;
+ }
+ return URI_FUNC(ParseSegment)(state, afterPchar, afterLast, memory);
+ }
+
+ default:
+ return first;
+ }
+}
+
+
+
+/*
+ * [segmentNz]->[pchar][segment]
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseSegmentNz)(
+ URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
+ const URI_CHAR * const afterPchar
+ = URI_FUNC(ParsePchar)(state, first, afterLast, memory);
+ if (afterPchar == NULL) {
+ return NULL;
+ }
+ return URI_FUNC(ParseSegment)(state, afterPchar, afterLast, memory);
+}
+
+
+
+static URI_INLINE UriBool URI_FUNC(OnExitSegmentNzNcOrScheme2)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ UriMemoryManager * memory) {
+ if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
+ return URI_FALSE; /* Raises malloc error*/
+ }
+ state->uri->scheme.first = NULL; /* Not a scheme, reset */
+ return URI_TRUE; /* Success */
+}
+
+
+
+/*
+ * [segmentNzNcOrScheme2]->[ALPHA][segmentNzNcOrScheme2]
+ * [segmentNzNcOrScheme2]->[DIGIT][segmentNzNcOrScheme2]
+ * [segmentNzNcOrScheme2]->[pctEncoded][mustBeSegmentNzNc]
+ * [segmentNzNcOrScheme2]->[uriTail] // can take <NULL>
+ * [segmentNzNcOrScheme2]-><!>[mustBeSegmentNzNc]
+ * [segmentNzNcOrScheme2]-><$>[mustBeSegmentNzNc]
+ * [segmentNzNcOrScheme2]-><&>[mustBeSegmentNzNc]
+ * [segmentNzNcOrScheme2]-><(>[mustBeSegmentNzNc]
+ * [segmentNzNcOrScheme2]-><)>[mustBeSegmentNzNc]
+ * [segmentNzNcOrScheme2]-><*>[mustBeSegmentNzNc]
+ * [segmentNzNcOrScheme2]-><,>[mustBeSegmentNzNc]
+ * [segmentNzNcOrScheme2]-><.>[segmentNzNcOrScheme2]
+ * [segmentNzNcOrScheme2]-></>[segment][zeroMoreSlashSegs][uriTail]
+ * [segmentNzNcOrScheme2]-><:>[hierPart][uriTail]
+ * [segmentNzNcOrScheme2]-><;>[mustBeSegmentNzNc]
+ * [segmentNzNcOrScheme2]-><@>[mustBeSegmentNzNc]
+ * [segmentNzNcOrScheme2]-><_>[mustBeSegmentNzNc]
+ * [segmentNzNcOrScheme2]-><~>[mustBeSegmentNzNc]
+ * [segmentNzNcOrScheme2]-><+>[segmentNzNcOrScheme2]
+ * [segmentNzNcOrScheme2]-><=>[mustBeSegmentNzNc]
+ * [segmentNzNcOrScheme2]-><'>[mustBeSegmentNzNc]
+ * [segmentNzNcOrScheme2]-><->[segmentNzNcOrScheme2]
+ */
+static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ if (!URI_FUNC(OnExitSegmentNzNcOrScheme2)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('.'):
+ case _UT('+'):
+ case _UT('-'):
+ case URI_SET_ALPHA:
+ case URI_SET_DIGIT:
+ return URI_FUNC(ParseSegmentNzNcOrScheme2)(state, first + 1, afterLast, memory);
+
+ case _UT('%'):
+ {
+ const URI_CHAR * const afterPctEncoded
+ = URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
+ if (afterPctEncoded == NULL) {
+ return NULL;
+ }
+ return URI_FUNC(ParseMustBeSegmentNzNc)(state, afterPctEncoded, afterLast, memory);
+ }
+
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT(';'):
+ case _UT('@'):
+ case _UT('_'):
+ case _UT('~'):
+ case _UT('='):
+ case _UT('\''):
+ return URI_FUNC(ParseMustBeSegmentNzNc)(state, first + 1, afterLast, memory);
+
+ case _UT('/'):
+ {
+ const URI_CHAR * afterZeroMoreSlashSegs;
+ const URI_CHAR * const afterSegment
+ = URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
+ if (afterSegment == NULL) {
+ return NULL;
+ }
+ if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ state->uri->scheme.first = NULL; /* Not a scheme, reset */
+ if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ afterZeroMoreSlashSegs
+ = URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast, memory);
+ if (afterZeroMoreSlashSegs == NULL) {
+ return NULL;
+ }
+ return URI_FUNC(ParseUriTail)(state, afterZeroMoreSlashSegs, afterLast, memory);
+ }
+
+ case _UT(':'):
+ {
+ const URI_CHAR * const afterHierPart
+ = URI_FUNC(ParseHierPart)(state, first + 1, afterLast, memory);
+ state->uri->scheme.afterLast = first; /* SCHEME END */
+ if (afterHierPart == NULL) {
+ return NULL;
+ }
+ return URI_FUNC(ParseUriTail)(state, afterHierPart, afterLast, memory);
+ }
+
+ default:
+ if (!URI_FUNC(OnExitSegmentNzNcOrScheme2)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ return URI_FUNC(ParseUriTail)(state, first, afterLast, memory);
+ }
+}
+
+
+
+/*
+ * [uriReference]->[ALPHA][segmentNzNcOrScheme2]
+ * [uriReference]->[DIGIT][mustBeSegmentNzNc]
+ * [uriReference]->[pctEncoded][mustBeSegmentNzNc]
+ * [uriReference]->[subDelims][mustBeSegmentNzNc]
+ * [uriReference]->[uriTail] // can take <NULL>
+ * [uriReference]-><.>[mustBeSegmentNzNc]
+ * [uriReference]-></>[partHelperTwo][uriTail]
+ * [uriReference]-><@>[mustBeSegmentNzNc]
+ * [uriReference]-><_>[mustBeSegmentNzNc]
+ * [uriReference]-><~>[mustBeSegmentNzNc]
+ * [uriReference]-><->[mustBeSegmentNzNc]
+ */
+static const URI_CHAR * URI_FUNC(ParseUriReference)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case URI_SET_ALPHA:
+ state->uri->scheme.first = first; /* SCHEME BEGIN */
+ return URI_FUNC(ParseSegmentNzNcOrScheme2)(state, first + 1, afterLast, memory);
+
+ case URI_SET_DIGIT:
+ case _UT('!'):
+ case _UT('$'):
+ case _UT('&'):
+ case _UT('('):
+ case _UT(')'):
+ case _UT('*'):
+ case _UT(','):
+ case _UT(';'):
+ case _UT('\''):
+ case _UT('+'):
+ case _UT('='):
+ case _UT('.'):
+ case _UT('_'):
+ case _UT('~'):
+ case _UT('-'):
+ case _UT('@'):
+ state->uri->scheme.first = first; /* SEGMENT BEGIN, ABUSE SCHEME POINTER */
+ return URI_FUNC(ParseMustBeSegmentNzNc)(state, first + 1, afterLast, memory);
+
+ case _UT('%'):
+ {
+ const URI_CHAR * const afterPctEncoded
+ = URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
+ if (afterPctEncoded == NULL) {
+ return NULL;
+ }
+ state->uri->scheme.first = first; /* SEGMENT BEGIN, ABUSE SCHEME POINTER */
+ return URI_FUNC(ParseMustBeSegmentNzNc)(state, afterPctEncoded, afterLast, memory);
+ }
+
+ case _UT('/'):
+ {
+ const URI_CHAR * const afterPartHelperTwo
+ = URI_FUNC(ParsePartHelperTwo)(state, first + 1, afterLast, memory);
+ if (afterPartHelperTwo == NULL) {
+ return NULL;
+ }
+ return URI_FUNC(ParseUriTail)(state, afterPartHelperTwo, afterLast, memory);
+ }
+
+ default:
+ return URI_FUNC(ParseUriTail)(state, first, afterLast, memory);
+ }
+}
+
+
+
+/*
+ * [uriTail]-><#>[queryFrag]
+ * [uriTail]-><?>[queryFrag][uriTailTwo]
+ * [uriTail]-><NULL>
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTail)(
+ URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('#'):
+ {
+ const URI_CHAR * const afterQueryFrag = URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
+ if (afterQueryFrag == NULL) {
+ return NULL;
+ }
+ state->uri->fragment.first = first + 1; /* FRAGMENT BEGIN */
+ state->uri->fragment.afterLast = afterQueryFrag; /* FRAGMENT END */
+ return afterQueryFrag;
+ }
+
+ case _UT('?'):
+ {
+ const URI_CHAR * const afterQueryFrag
+ = URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
+ if (afterQueryFrag == NULL) {
+ return NULL;
+ }
+ state->uri->query.first = first + 1; /* QUERY BEGIN */
+ state->uri->query.afterLast = afterQueryFrag; /* QUERY END */
+ return URI_FUNC(ParseUriTailTwo)(state, afterQueryFrag, afterLast, memory);
+ }
+
+ default:
+ return first;
+ }
+}
+
+
+
+/*
+ * [uriTailTwo]-><#>[queryFrag]
+ * [uriTailTwo]-><NULL>
+ */
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTailTwo)(
+ URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('#'):
+ {
+ const URI_CHAR * const afterQueryFrag = URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
+ if (afterQueryFrag == NULL) {
+ return NULL;
+ }
+ state->uri->fragment.first = first + 1; /* FRAGMENT BEGIN */
+ state->uri->fragment.afterLast = afterQueryFrag; /* FRAGMENT END */
+ return afterQueryFrag;
+ }
+
+ default:
+ return first;
+ }
+}
+
+
+
+/*
+ * [zeroMoreSlashSegs]-></>[segment][zeroMoreSlashSegs]
+ * [zeroMoreSlashSegs]-><NULL>
+ */
+static const URI_CHAR * URI_FUNC(ParseZeroMoreSlashSegs)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ if (first >= afterLast) {
+ return afterLast;
+ }
+
+ switch (*first) {
+ case _UT('/'):
+ {
+ const URI_CHAR * const afterSegment
+ = URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
+ if (afterSegment == NULL) {
+ return NULL;
+ }
+ if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
+ return NULL;
+ }
+ return URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast, memory);
+ }
+
+ default:
+ return first;
+ }
+}
+
+
+
+static URI_INLINE void URI_FUNC(ResetParserStateExceptUri)(URI_TYPE(ParserState) * state) {
+ URI_TYPE(Uri) * const uriBackup = state->uri;
+ memset(state, 0, sizeof(URI_TYPE(ParserState)));
+ state->uri = uriBackup;
+}
+
+
+
+static URI_INLINE UriBool URI_FUNC(PushPathSegment)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ URI_TYPE(PathSegment) * segment = memory->calloc(memory, 1, sizeof(URI_TYPE(PathSegment)));
+ if (segment == NULL) {
+ return URI_FALSE; /* Raises malloc error */
+ }
+ if (first == afterLast) {
+ segment->text.first = URI_FUNC(SafeToPointTo);
+ segment->text.afterLast = URI_FUNC(SafeToPointTo);
+ } else {
+ segment->text.first = first;
+ segment->text.afterLast = afterLast;
+ }
+
+ /* First segment ever? */
+ if (state->uri->pathHead == NULL) {
+ /* First segment ever, set head and tail */
+ state->uri->pathHead = segment;
+ state->uri->pathTail = segment;
+ } else {
+ /* Append, update tail */
+ state->uri->pathTail->next = segment;
+ state->uri->pathTail = segment;
+ }
+
+ return URI_TRUE; /* Success */
+}
+
+
+
+int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast) {
+ return URI_FUNC(ParseUriExMm)(state, first, afterLast, NULL);
+}
+
+
+
+static int URI_FUNC(ParseUriExMm)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
+ const URI_CHAR * afterUriReference;
+ URI_TYPE(Uri) * uri;
+
+ /* Check params */
+ if ((state == NULL) || (first == NULL) || (afterLast == NULL)) {
+ return URI_ERROR_NULL;
+ }
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
+ uri = state->uri;
+
+ /* Init parser */
+ URI_FUNC(ResetParserStateExceptUri)(state);
+ URI_FUNC(ResetUri)(uri);
+
+ /* Parse */
+ afterUriReference = URI_FUNC(ParseUriReference)(state, first, afterLast, memory);
+ if (afterUriReference == NULL) {
+ /* Waterproof errorPos <= afterLast */
+ if (state->errorPos && (state->errorPos > afterLast)) {
+ state->errorPos = afterLast;
+ }
+ return state->errorCode;
+ }
+ if (afterUriReference != afterLast) {
+ if (afterUriReference < afterLast) {
+ URI_FUNC(StopSyntax)(state, afterUriReference, memory);
+ } else {
+ URI_FUNC(StopSyntax)(state, afterLast, memory);
+ }
+ return state->errorCode;
+ }
+ return URI_SUCCESS;
+}
+
+
+
+int URI_FUNC(ParseUri)(URI_TYPE(ParserState) * state, const URI_CHAR * text) {
+ if ((state == NULL) || (text == NULL)) {
+ return URI_ERROR_NULL;
+ }
+ return URI_FUNC(ParseUriEx)(state, text, text + URI_STRLEN(text));
+}
+
+
+
+int URI_FUNC(ParseSingleUri)(URI_TYPE(Uri) * uri, const URI_CHAR * text,
+ const URI_CHAR ** errorPos) {
+ return URI_FUNC(ParseSingleUriEx)(uri, text, NULL, errorPos);
+}
+
+
+
+int URI_FUNC(ParseSingleUriEx)(URI_TYPE(Uri) * uri,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ const URI_CHAR ** errorPos) {
+ if ((afterLast == NULL) && (first != NULL)) {
+ afterLast = first + URI_STRLEN(first);
+ }
+ return URI_FUNC(ParseSingleUriExMm)(uri, first, afterLast, errorPos, NULL);
+}
+
+
+
+int URI_FUNC(ParseSingleUriExMm)(URI_TYPE(Uri) * uri,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ const URI_CHAR ** errorPos, UriMemoryManager * memory) {
+ URI_TYPE(ParserState) state;
+ int res;
+
+ /* Check params */
+ if ((uri == NULL) || (first == NULL) || (afterLast == NULL)) {
+ return URI_ERROR_NULL;
+ }
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
+ state.uri = uri;
+
+ res = URI_FUNC(ParseUriExMm)(&state, first, afterLast, memory);
+
+ if (res != URI_SUCCESS) {
+ if (errorPos != NULL) {
+ *errorPos = state.errorPos;
+ }
+ URI_FUNC(FreeUriMembersMm)(uri, memory);
+ }
+
+ return res;
+}
+
+
+
+void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri) {
+ URI_FUNC(FreeUriMembersMm)(uri, NULL);
+}
+
+
+
+int URI_FUNC(FreeUriMembersMm)(URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
+ if (uri == NULL) {
+ return URI_ERROR_NULL;
+ }
+
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
+ if (uri->owner) {
+ /* Scheme */
+ if (uri->scheme.first != NULL) {
+ if (uri->scheme.first != uri->scheme.afterLast) {
+ memory->free(memory, (URI_CHAR *)uri->scheme.first);
+ }
+ uri->scheme.first = NULL;
+ uri->scheme.afterLast = NULL;
+ }
+
+ /* User info */
+ if (uri->userInfo.first != NULL) {
+ if (uri->userInfo.first != uri->userInfo.afterLast) {
+ memory->free(memory, (URI_CHAR *)uri->userInfo.first);
+ }
+ uri->userInfo.first = NULL;
+ uri->userInfo.afterLast = NULL;
+ }
+
/* Host data - IPvFuture (may affect host text) */
- if (uri->hostData.ipFuture.first != NULL) {
+ if (uri->hostData.ipFuture.first != NULL) {
/* NOTE: .hostData.ipFuture may hold the very same range pointers
* as .hostText; then we need to prevent freeing memory twice. */
if (uri->hostText.first == uri->hostData.ipFuture.first) {
@@ -2296,117 +2296,117 @@ int URI_FUNC(FreeUriMembersMm)(URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
uri->hostText.afterLast = NULL;
}
- if (uri->hostData.ipFuture.first != uri->hostData.ipFuture.afterLast) {
- memory->free(memory, (URI_CHAR *)uri->hostData.ipFuture.first);
- }
- uri->hostData.ipFuture.first = NULL;
- uri->hostData.ipFuture.afterLast = NULL;
- }
-
+ if (uri->hostData.ipFuture.first != uri->hostData.ipFuture.afterLast) {
+ memory->free(memory, (URI_CHAR *)uri->hostData.ipFuture.first);
+ }
+ uri->hostData.ipFuture.first = NULL;
+ uri->hostData.ipFuture.afterLast = NULL;
+ }
+
/* Host text (after IPvFuture, see above) */
if (uri->hostText.first != NULL) {
- if (uri->hostText.first != uri->hostText.afterLast) {
- memory->free(memory, (URI_CHAR *)uri->hostText.first);
- }
- uri->hostText.first = NULL;
- uri->hostText.afterLast = NULL;
- }
- }
-
- /* Host data - IPv4 */
- if (uri->hostData.ip4 != NULL) {
- memory->free(memory, uri->hostData.ip4);
- uri->hostData.ip4 = NULL;
- }
-
- /* Host data - IPv6 */
- if (uri->hostData.ip6 != NULL) {
- memory->free(memory, uri->hostData.ip6);
- uri->hostData.ip6 = NULL;
- }
-
- /* Port text */
- if (uri->owner && (uri->portText.first != NULL)) {
- if (uri->portText.first != uri->portText.afterLast) {
- memory->free(memory, (URI_CHAR *)uri->portText.first);
- }
- uri->portText.first = NULL;
- uri->portText.afterLast = NULL;
- }
-
- /* Path */
- if (uri->pathHead != NULL) {
- URI_TYPE(PathSegment) * segWalk = uri->pathHead;
- while (segWalk != NULL) {
- URI_TYPE(PathSegment) * const next = segWalk->next;
- if (uri->owner && (segWalk->text.first != NULL)
- && (segWalk->text.first < segWalk->text.afterLast)) {
- memory->free(memory, (URI_CHAR *)segWalk->text.first);
- }
- memory->free(memory, segWalk);
- segWalk = next;
- }
- uri->pathHead = NULL;
- uri->pathTail = NULL;
- }
-
- if (uri->owner) {
- /* Query */
- if (uri->query.first != NULL) {
- if (uri->query.first != uri->query.afterLast) {
- memory->free(memory, (URI_CHAR *)uri->query.first);
- }
- uri->query.first = NULL;
- uri->query.afterLast = NULL;
- }
-
- /* Fragment */
- if (uri->fragment.first != NULL) {
- if (uri->fragment.first != uri->fragment.afterLast) {
- memory->free(memory, (URI_CHAR *)uri->fragment.first);
- }
- uri->fragment.first = NULL;
- uri->fragment.afterLast = NULL;
- }
- }
-
- return URI_SUCCESS;
-}
-
-
-
-UriBool URI_FUNC(_TESTING_ONLY_ParseIpSix)(const URI_CHAR * text) {
- UriMemoryManager * const memory = &defaultMemoryManager;
- URI_TYPE(Uri) uri;
- URI_TYPE(ParserState) parser;
- const URI_CHAR * const afterIpSix = text + URI_STRLEN(text);
- const URI_CHAR * res;
-
- URI_FUNC(ResetUri)(&uri);
- parser.uri = &uri;
- URI_FUNC(ResetParserStateExceptUri)(&parser);
- parser.uri->hostData.ip6 = memory->malloc(memory, 1 * sizeof(UriIp6));
- res = URI_FUNC(ParseIPv6address2)(&parser, text, afterIpSix, memory);
- URI_FUNC(FreeUriMembersMm)(&uri, memory);
- return res == afterIpSix ? URI_TRUE : URI_FALSE;
-}
-
-
-
-UriBool URI_FUNC(_TESTING_ONLY_ParseIpFour)(const URI_CHAR * text) {
- unsigned char octets[4];
- int res = URI_FUNC(ParseIpFourAddress)(octets, text, text + URI_STRLEN(text));
- return (res == URI_SUCCESS) ? URI_TRUE : URI_FALSE;
-}
-
-
-
-#undef URI_SET_DIGIT
-#undef URI_SET_HEX_LETTER_UPPER
-#undef URI_SET_HEX_LETTER_LOWER
-#undef URI_SET_HEXDIG
-#undef URI_SET_ALPHA
-
-
-
-#endif
+ if (uri->hostText.first != uri->hostText.afterLast) {
+ memory->free(memory, (URI_CHAR *)uri->hostText.first);
+ }
+ uri->hostText.first = NULL;
+ uri->hostText.afterLast = NULL;
+ }
+ }
+
+ /* Host data - IPv4 */
+ if (uri->hostData.ip4 != NULL) {
+ memory->free(memory, uri->hostData.ip4);
+ uri->hostData.ip4 = NULL;
+ }
+
+ /* Host data - IPv6 */
+ if (uri->hostData.ip6 != NULL) {
+ memory->free(memory, uri->hostData.ip6);
+ uri->hostData.ip6 = NULL;
+ }
+
+ /* Port text */
+ if (uri->owner && (uri->portText.first != NULL)) {
+ if (uri->portText.first != uri->portText.afterLast) {
+ memory->free(memory, (URI_CHAR *)uri->portText.first);
+ }
+ uri->portText.first = NULL;
+ uri->portText.afterLast = NULL;
+ }
+
+ /* Path */
+ if (uri->pathHead != NULL) {
+ URI_TYPE(PathSegment) * segWalk = uri->pathHead;
+ while (segWalk != NULL) {
+ URI_TYPE(PathSegment) * const next = segWalk->next;
+ if (uri->owner && (segWalk->text.first != NULL)
+ && (segWalk->text.first < segWalk->text.afterLast)) {
+ memory->free(memory, (URI_CHAR *)segWalk->text.first);
+ }
+ memory->free(memory, segWalk);
+ segWalk = next;
+ }
+ uri->pathHead = NULL;
+ uri->pathTail = NULL;
+ }
+
+ if (uri->owner) {
+ /* Query */
+ if (uri->query.first != NULL) {
+ if (uri->query.first != uri->query.afterLast) {
+ memory->free(memory, (URI_CHAR *)uri->query.first);
+ }
+ uri->query.first = NULL;
+ uri->query.afterLast = NULL;
+ }
+
+ /* Fragment */
+ if (uri->fragment.first != NULL) {
+ if (uri->fragment.first != uri->fragment.afterLast) {
+ memory->free(memory, (URI_CHAR *)uri->fragment.first);
+ }
+ uri->fragment.first = NULL;
+ uri->fragment.afterLast = NULL;
+ }
+ }
+
+ return URI_SUCCESS;
+}
+
+
+
+UriBool URI_FUNC(_TESTING_ONLY_ParseIpSix)(const URI_CHAR * text) {
+ UriMemoryManager * const memory = &defaultMemoryManager;
+ URI_TYPE(Uri) uri;
+ URI_TYPE(ParserState) parser;
+ const URI_CHAR * const afterIpSix = text + URI_STRLEN(text);
+ const URI_CHAR * res;
+
+ URI_FUNC(ResetUri)(&uri);
+ parser.uri = &uri;
+ URI_FUNC(ResetParserStateExceptUri)(&parser);
+ parser.uri->hostData.ip6 = memory->malloc(memory, 1 * sizeof(UriIp6));
+ res = URI_FUNC(ParseIPv6address2)(&parser, text, afterIpSix, memory);
+ URI_FUNC(FreeUriMembersMm)(&uri, memory);
+ return res == afterIpSix ? URI_TRUE : URI_FALSE;
+}
+
+
+
+UriBool URI_FUNC(_TESTING_ONLY_ParseIpFour)(const URI_CHAR * text) {
+ unsigned char octets[4];
+ int res = URI_FUNC(ParseIpFourAddress)(octets, text, text + URI_STRLEN(text));
+ return (res == URI_SUCCESS) ? URI_TRUE : URI_FALSE;
+}
+
+
+
+#undef URI_SET_DIGIT
+#undef URI_SET_HEX_LETTER_UPPER
+#undef URI_SET_HEX_LETTER_LOWER
+#undef URI_SET_HEXDIG
+#undef URI_SET_ALPHA
+
+
+
+#endif
diff --git a/contrib/restricted/uriparser/src/UriParseBase.c b/contrib/restricted/uriparser/src/UriParseBase.c
index 3a4aa08f6b..bba8daa8ae 100644
--- a/contrib/restricted/uriparser/src/UriParseBase.c
+++ b/contrib/restricted/uriparser/src/UriParseBase.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,60 +31,60 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef URI_DOXYGEN
-# include "UriParseBase.h"
-#endif
-
-
-
-void uriWriteQuadToDoubleByte(const unsigned char * hexDigits, int digitCount, unsigned char * output) {
- switch (digitCount) {
- case 1:
- /* 0x___? -> \x00 \x0? */
- output[0] = 0;
- output[1] = hexDigits[0];
- break;
-
- case 2:
- /* 0x__?? -> \0xx \x?? */
- output[0] = 0;
- output[1] = 16 * hexDigits[0] + hexDigits[1];
- break;
-
- case 3:
- /* 0x_??? -> \0x? \x?? */
- output[0] = hexDigits[0];
- output[1] = 16 * hexDigits[1] + hexDigits[2];
- break;
-
- case 4:
- /* 0x???? -> \0?? \x?? */
- output[0] = 16 * hexDigits[0] + hexDigits[1];
- output[1] = 16 * hexDigits[2] + hexDigits[3];
- break;
-
- }
-}
-
-
-
-unsigned char uriGetOctetValue(const unsigned char * digits, int digitCount) {
- switch (digitCount) {
- case 1:
- return digits[0];
-
- case 2:
- return 10 * digits[0] + digits[1];
-
- case 3:
- default:
- return 100 * digits[0] + 10 * digits[1] + digits[2];
-
- }
-}
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef URI_DOXYGEN
+# include "UriParseBase.h"
+#endif
+
+
+
+void uriWriteQuadToDoubleByte(const unsigned char * hexDigits, int digitCount, unsigned char * output) {
+ switch (digitCount) {
+ case 1:
+ /* 0x___? -> \x00 \x0? */
+ output[0] = 0;
+ output[1] = hexDigits[0];
+ break;
+
+ case 2:
+ /* 0x__?? -> \0xx \x?? */
+ output[0] = 0;
+ output[1] = 16 * hexDigits[0] + hexDigits[1];
+ break;
+
+ case 3:
+ /* 0x_??? -> \0x? \x?? */
+ output[0] = hexDigits[0];
+ output[1] = 16 * hexDigits[1] + hexDigits[2];
+ break;
+
+ case 4:
+ /* 0x???? -> \0?? \x?? */
+ output[0] = 16 * hexDigits[0] + hexDigits[1];
+ output[1] = 16 * hexDigits[2] + hexDigits[3];
+ break;
+
+ }
+}
+
+
+
+unsigned char uriGetOctetValue(const unsigned char * digits, int digitCount) {
+ switch (digitCount) {
+ case 1:
+ return digits[0];
+
+ case 2:
+ return 10 * digits[0] + digits[1];
+
+ case 3:
+ default:
+ return 100 * digits[0] + 10 * digits[1] + digits[2];
+
+ }
+}
diff --git a/contrib/restricted/uriparser/src/UriParseBase.h b/contrib/restricted/uriparser/src/UriParseBase.h
index 6d7379de1c..03042b3326 100644
--- a/contrib/restricted/uriparser/src/UriParseBase.h
+++ b/contrib/restricted/uriparser/src/UriParseBase.h
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,25 +31,25 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef URI_PARSE_BASE_H
-#define URI_PARSE_BASE_H 1
-
-
-
-#include <uriparser/UriBase.h>
-
-
-
-void uriWriteQuadToDoubleByte(const unsigned char * hexDigits, int digitCount,
- unsigned char * output);
-unsigned char uriGetOctetValue(const unsigned char * digits, int digitCount);
-
-
-
-#endif /* URI_PARSE_BASE_H */
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef URI_PARSE_BASE_H
+#define URI_PARSE_BASE_H 1
+
+
+
+#include <uriparser/UriBase.h>
+
+
+
+void uriWriteQuadToDoubleByte(const unsigned char * hexDigits, int digitCount,
+ unsigned char * output);
+unsigned char uriGetOctetValue(const unsigned char * digits, int digitCount);
+
+
+
+#endif /* URI_PARSE_BASE_H */
diff --git a/contrib/restricted/uriparser/src/UriQuery.c b/contrib/restricted/uriparser/src/UriQuery.c
index b2734bc2c8..2cc01381d1 100644
--- a/contrib/restricted/uriparser/src/UriQuery.c
+++ b/contrib/restricted/uriparser/src/UriQuery.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,471 +31,471 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* What encodings are enabled? */
-#include <uriparser/UriDefsConfig.h>
-#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* Include SELF twice */
-# ifdef URI_ENABLE_ANSI
-# define URI_PASS_ANSI 1
-# include "UriQuery.c"
-# undef URI_PASS_ANSI
-# endif
-# ifdef URI_ENABLE_UNICODE
-# define URI_PASS_UNICODE 1
-# include "UriQuery.c"
-# undef URI_PASS_UNICODE
-# endif
-#else
-# ifdef URI_PASS_ANSI
-# include <uriparser/UriDefsAnsi.h>
-# else
-# include <uriparser/UriDefsUnicode.h>
-# include <wchar.h>
-# endif
-
-
-
-#ifndef URI_DOXYGEN
-# include <uriparser/Uri.h>
-# include "UriCommon.h"
-# include "UriMemory.h"
-#endif
-
-
-
-#include <limits.h>
-
-
-
-static int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest,
- const URI_TYPE(QueryList) * queryList,
- int maxChars, int * charsWritten, int * charsRequired,
- UriBool spaceToPlus, UriBool normalizeBreaks);
-
-static UriBool URI_FUNC(AppendQueryItem)(URI_TYPE(QueryList) ** prevNext,
- int * itemCount, const URI_CHAR * keyFirst, const URI_CHAR * keyAfter,
- const URI_CHAR * valueFirst, const URI_CHAR * valueAfter,
- UriBool plusToSpace, UriBreakConversion breakConversion,
- UriMemoryManager * memory);
-
-
-
-int URI_FUNC(ComposeQueryCharsRequired)(const URI_TYPE(QueryList) * queryList,
- int * charsRequired) {
- const UriBool spaceToPlus = URI_TRUE;
- const UriBool normalizeBreaks = URI_TRUE;
-
- return URI_FUNC(ComposeQueryCharsRequiredEx)(queryList, charsRequired,
- spaceToPlus, normalizeBreaks);
-}
-
-
-
-int URI_FUNC(ComposeQueryCharsRequiredEx)(const URI_TYPE(QueryList) * queryList,
- int * charsRequired, UriBool spaceToPlus, UriBool normalizeBreaks) {
- if ((queryList == NULL) || (charsRequired == NULL)) {
- return URI_ERROR_NULL;
- }
-
- return URI_FUNC(ComposeQueryEngine)(NULL, queryList, 0, NULL,
- charsRequired, spaceToPlus, normalizeBreaks);
-}
-
-
-
-int URI_FUNC(ComposeQuery)(URI_CHAR * dest,
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* What encodings are enabled? */
+#include <uriparser/UriDefsConfig.h>
+#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* Include SELF twice */
+# ifdef URI_ENABLE_ANSI
+# define URI_PASS_ANSI 1
+# include "UriQuery.c"
+# undef URI_PASS_ANSI
+# endif
+# ifdef URI_ENABLE_UNICODE
+# define URI_PASS_UNICODE 1
+# include "UriQuery.c"
+# undef URI_PASS_UNICODE
+# endif
+#else
+# ifdef URI_PASS_ANSI
+# include <uriparser/UriDefsAnsi.h>
+# else
+# include <uriparser/UriDefsUnicode.h>
+# include <wchar.h>
+# endif
+
+
+
+#ifndef URI_DOXYGEN
+# include <uriparser/Uri.h>
+# include "UriCommon.h"
+# include "UriMemory.h"
+#endif
+
+
+
+#include <limits.h>
+
+
+
+static int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest,
+ const URI_TYPE(QueryList) * queryList,
+ int maxChars, int * charsWritten, int * charsRequired,
+ UriBool spaceToPlus, UriBool normalizeBreaks);
+
+static UriBool URI_FUNC(AppendQueryItem)(URI_TYPE(QueryList) ** prevNext,
+ int * itemCount, const URI_CHAR * keyFirst, const URI_CHAR * keyAfter,
+ const URI_CHAR * valueFirst, const URI_CHAR * valueAfter,
+ UriBool plusToSpace, UriBreakConversion breakConversion,
+ UriMemoryManager * memory);
+
+
+
+int URI_FUNC(ComposeQueryCharsRequired)(const URI_TYPE(QueryList) * queryList,
+ int * charsRequired) {
+ const UriBool spaceToPlus = URI_TRUE;
+ const UriBool normalizeBreaks = URI_TRUE;
+
+ return URI_FUNC(ComposeQueryCharsRequiredEx)(queryList, charsRequired,
+ spaceToPlus, normalizeBreaks);
+}
+
+
+
+int URI_FUNC(ComposeQueryCharsRequiredEx)(const URI_TYPE(QueryList) * queryList,
+ int * charsRequired, UriBool spaceToPlus, UriBool normalizeBreaks) {
+ if ((queryList == NULL) || (charsRequired == NULL)) {
+ return URI_ERROR_NULL;
+ }
+
+ return URI_FUNC(ComposeQueryEngine)(NULL, queryList, 0, NULL,
+ charsRequired, spaceToPlus, normalizeBreaks);
+}
+
+
+
+int URI_FUNC(ComposeQuery)(URI_CHAR * dest,
const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten) {
- const UriBool spaceToPlus = URI_TRUE;
- const UriBool normalizeBreaks = URI_TRUE;
-
- return URI_FUNC(ComposeQueryEx)(dest, queryList, maxChars, charsWritten,
- spaceToPlus, normalizeBreaks);
-}
-
-
-
-int URI_FUNC(ComposeQueryEx)(URI_CHAR * dest,
- const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten,
- UriBool spaceToPlus, UriBool normalizeBreaks) {
- if ((dest == NULL) || (queryList == NULL)) {
- return URI_ERROR_NULL;
- }
-
- if (maxChars < 1) {
- return URI_ERROR_OUTPUT_TOO_LARGE;
- }
-
- return URI_FUNC(ComposeQueryEngine)(dest, queryList, maxChars,
- charsWritten, NULL, spaceToPlus, normalizeBreaks);
-}
-
-
-
-int URI_FUNC(ComposeQueryMalloc)(URI_CHAR ** dest,
- const URI_TYPE(QueryList) * queryList) {
- const UriBool spaceToPlus = URI_TRUE;
- const UriBool normalizeBreaks = URI_TRUE;
-
- return URI_FUNC(ComposeQueryMallocEx)(dest, queryList,
- spaceToPlus, normalizeBreaks);
-}
-
-
-
-int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest,
- const URI_TYPE(QueryList) * queryList,
- UriBool spaceToPlus, UriBool normalizeBreaks) {
- return URI_FUNC(ComposeQueryMallocExMm)(dest, queryList, spaceToPlus,
- normalizeBreaks, NULL);
-}
-
-
-
-int URI_FUNC(ComposeQueryMallocExMm)(URI_CHAR ** dest,
- const URI_TYPE(QueryList) * queryList,
- UriBool spaceToPlus, UriBool normalizeBreaks,
- UriMemoryManager * memory) {
- int charsRequired;
- int res;
- URI_CHAR * queryString;
-
- if (dest == NULL) {
- return URI_ERROR_NULL;
- }
-
- URI_CHECK_MEMORY_MANAGER(memory); /* may return */
-
- /* Calculate space */
- res = URI_FUNC(ComposeQueryCharsRequiredEx)(queryList, &charsRequired,
- spaceToPlus, normalizeBreaks);
- if (res != URI_SUCCESS) {
- return res;
- }
- charsRequired++;
-
- /* Allocate space */
- queryString = memory->malloc(memory, charsRequired * sizeof(URI_CHAR));
- if (queryString == NULL) {
- return URI_ERROR_MALLOC;
- }
-
- /* Put query in */
- res = URI_FUNC(ComposeQueryEx)(queryString, queryList, charsRequired,
- NULL, spaceToPlus, normalizeBreaks);
- if (res != URI_SUCCESS) {
- memory->free(memory, queryString);
- return res;
- }
-
- *dest = queryString;
- return URI_SUCCESS;
-}
-
-
-
-int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest,
- const URI_TYPE(QueryList) * queryList,
- int maxChars, int * charsWritten, int * charsRequired,
- UriBool spaceToPlus, UriBool normalizeBreaks) {
- UriBool firstItem = URI_TRUE;
- int ampersandLen = 0; /* increased to 1 from second item on */
- URI_CHAR * write = dest;
-
- /* Subtract terminator */
- if (dest == NULL) {
- *charsRequired = 0;
- } else {
- maxChars--;
- }
-
- while (queryList != NULL) {
- const URI_CHAR * const key = queryList->key;
- const URI_CHAR * const value = queryList->value;
- const int worstCase = (normalizeBreaks == URI_TRUE ? 6 : 3);
- const int keyLen = (key == NULL) ? 0 : (int)URI_STRLEN(key);
- int keyRequiredChars;
- const int valueLen = (value == NULL) ? 0 : (int)URI_STRLEN(value);
- int valueRequiredChars;
-
- if ((keyLen >= INT_MAX / worstCase) || (valueLen >= INT_MAX / worstCase)) {
- return URI_ERROR_OUTPUT_TOO_LARGE;
- }
- keyRequiredChars = worstCase * keyLen;
- valueRequiredChars = worstCase * valueLen;
-
- if (dest == NULL) {
- (*charsRequired) += ampersandLen + keyRequiredChars + ((value == NULL)
- ? 0
- : 1 + valueRequiredChars);
-
- if (firstItem == URI_TRUE) {
- ampersandLen = 1;
- firstItem = URI_FALSE;
- }
- } else {
- if ((write - dest) + ampersandLen + keyRequiredChars > maxChars) {
- return URI_ERROR_OUTPUT_TOO_LARGE;
- }
-
- /* Copy key */
- if (firstItem == URI_TRUE) {
- ampersandLen = 1;
- firstItem = URI_FALSE;
- } else {
- write[0] = _UT('&');
- write++;
- }
- write = URI_FUNC(EscapeEx)(key, key + keyLen,
- write, spaceToPlus, normalizeBreaks);
-
- if (value != NULL) {
- if ((write - dest) + 1 + valueRequiredChars > maxChars) {
- return URI_ERROR_OUTPUT_TOO_LARGE;
- }
-
- /* Copy value */
- write[0] = _UT('=');
- write++;
- write = URI_FUNC(EscapeEx)(value, value + valueLen,
- write, spaceToPlus, normalizeBreaks);
- }
- }
-
- queryList = queryList->next;
- }
-
- if (dest != NULL) {
- write[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = (int)(write - dest) + 1; /* .. for terminator */
- }
- }
-
- return URI_SUCCESS;
-}
-
-
-
-UriBool URI_FUNC(AppendQueryItem)(URI_TYPE(QueryList) ** prevNext,
- int * itemCount, const URI_CHAR * keyFirst, const URI_CHAR * keyAfter,
- const URI_CHAR * valueFirst, const URI_CHAR * valueAfter,
- UriBool plusToSpace, UriBreakConversion breakConversion,
- UriMemoryManager * memory) {
- const int keyLen = (int)(keyAfter - keyFirst);
- const int valueLen = (int)(valueAfter - valueFirst);
- URI_CHAR * key;
- URI_CHAR * value;
-
- if ((prevNext == NULL) || (itemCount == NULL)
- || (keyFirst == NULL) || (keyAfter == NULL)
- || (keyFirst > keyAfter) || (valueFirst > valueAfter)
- || ((keyFirst == keyAfter)
- && (valueFirst == NULL) && (valueAfter == NULL))) {
- return URI_TRUE;
- }
-
- /* Append new empty item */
- *prevNext = memory->malloc(memory, 1 * sizeof(URI_TYPE(QueryList)));
- if (*prevNext == NULL) {
- return URI_FALSE; /* Raises malloc error */
- }
- (*prevNext)->next = NULL;
-
-
- /* Fill key */
- key = memory->malloc(memory, (keyLen + 1) * sizeof(URI_CHAR));
- if (key == NULL) {
- memory->free(memory, *prevNext);
- *prevNext = NULL;
- return URI_FALSE; /* Raises malloc error */
- }
-
- key[keyLen] = _UT('\0');
- if (keyLen > 0) {
- /* Copy 1:1 */
- memcpy(key, keyFirst, keyLen * sizeof(URI_CHAR));
-
- /* Unescape */
- URI_FUNC(UnescapeInPlaceEx)(key, plusToSpace, breakConversion);
- }
- (*prevNext)->key = key;
-
-
- /* Fill value */
- if (valueFirst != NULL) {
- value = memory->malloc(memory, (valueLen + 1) * sizeof(URI_CHAR));
- if (value == NULL) {
- memory->free(memory, key);
- memory->free(memory, *prevNext);
- *prevNext = NULL;
- return URI_FALSE; /* Raises malloc error */
- }
-
- value[valueLen] = _UT('\0');
- if (valueLen > 0) {
- /* Copy 1:1 */
- memcpy(value, valueFirst, valueLen * sizeof(URI_CHAR));
-
- /* Unescape */
- URI_FUNC(UnescapeInPlaceEx)(value, plusToSpace, breakConversion);
- }
- (*prevNext)->value = value;
- } else {
- value = NULL;
- }
- (*prevNext)->value = value;
-
- (*itemCount)++;
- return URI_TRUE;
-}
-
-
-
-void URI_FUNC(FreeQueryList)(URI_TYPE(QueryList) * queryList) {
- URI_FUNC(FreeQueryListMm)(queryList, NULL);
-}
-
-
-
-int URI_FUNC(FreeQueryListMm)(URI_TYPE(QueryList) * queryList,
- UriMemoryManager * memory) {
- URI_CHECK_MEMORY_MANAGER(memory); /* may return */
- while (queryList != NULL) {
- URI_TYPE(QueryList) * nextBackup = queryList->next;
- memory->free(memory, (URI_CHAR *)queryList->key); /* const cast */
- memory->free(memory, (URI_CHAR *)queryList->value); /* const cast */
- memory->free(memory, queryList);
- queryList = nextBackup;
- }
- return URI_SUCCESS;
-}
-
-
-
-int URI_FUNC(DissectQueryMalloc)(URI_TYPE(QueryList) ** dest, int * itemCount,
- const URI_CHAR * first, const URI_CHAR * afterLast) {
- const UriBool plusToSpace = URI_TRUE;
- const UriBreakConversion breakConversion = URI_BR_DONT_TOUCH;
-
- return URI_FUNC(DissectQueryMallocEx)(dest, itemCount, first, afterLast,
- plusToSpace, breakConversion);
-}
-
-
-
-int URI_FUNC(DissectQueryMallocEx)(URI_TYPE(QueryList) ** dest, int * itemCount,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriBool plusToSpace, UriBreakConversion breakConversion) {
- return URI_FUNC(DissectQueryMallocExMm)(dest, itemCount, first, afterLast,
- plusToSpace, breakConversion, NULL);
-}
-
-
-
-int URI_FUNC(DissectQueryMallocExMm)(URI_TYPE(QueryList) ** dest, int * itemCount,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriBool plusToSpace, UriBreakConversion breakConversion,
- UriMemoryManager * memory) {
- const URI_CHAR * walk = first;
- const URI_CHAR * keyFirst = first;
- const URI_CHAR * keyAfter = NULL;
- const URI_CHAR * valueFirst = NULL;
- const URI_CHAR * valueAfter = NULL;
- URI_TYPE(QueryList) ** prevNext = dest;
- int nullCounter;
- int * itemsAppended = (itemCount == NULL) ? &nullCounter : itemCount;
-
- if ((dest == NULL) || (first == NULL) || (afterLast == NULL)) {
- return URI_ERROR_NULL;
- }
-
- if (first > afterLast) {
- return URI_ERROR_RANGE_INVALID;
- }
-
- URI_CHECK_MEMORY_MANAGER(memory); /* may return */
-
- *dest = NULL;
- *itemsAppended = 0;
-
- /* Parse query string */
- for (; walk < afterLast; walk++) {
- switch (*walk) {
- case _UT('&'):
- if (valueFirst != NULL) {
- valueAfter = walk;
- } else {
- keyAfter = walk;
- }
-
- if (URI_FUNC(AppendQueryItem)(prevNext, itemsAppended,
- keyFirst, keyAfter, valueFirst, valueAfter,
- plusToSpace, breakConversion, memory)
- == URI_FALSE) {
- /* Free list we built */
- *itemsAppended = 0;
- URI_FUNC(FreeQueryListMm)(*dest, memory);
- return URI_ERROR_MALLOC;
- }
-
- /* Make future items children of the current */
- if ((prevNext != NULL) && (*prevNext != NULL)) {
- prevNext = &((*prevNext)->next);
- }
-
- if (walk + 1 < afterLast) {
- keyFirst = walk + 1;
- } else {
- keyFirst = NULL;
- }
- keyAfter = NULL;
- valueFirst = NULL;
- valueAfter = NULL;
- break;
-
- case _UT('='):
- /* NOTE: WE treat the first '=' as a separator, */
- /* all following go into the value part */
- if (keyAfter == NULL) {
- keyAfter = walk;
- if (walk + 1 <= afterLast) {
- valueFirst = walk + 1;
- valueAfter = walk + 1;
- }
- }
- break;
-
- default:
- break;
- }
- }
-
- if (valueFirst != NULL) {
- /* Must be key/value pair */
- valueAfter = walk;
- } else {
- /* Must be key only */
- keyAfter = walk;
- }
-
- if (URI_FUNC(AppendQueryItem)(prevNext, itemsAppended, keyFirst, keyAfter,
- valueFirst, valueAfter, plusToSpace, breakConversion, memory)
- == URI_FALSE) {
- /* Free list we built */
- *itemsAppended = 0;
- URI_FUNC(FreeQueryListMm)(*dest, memory);
- return URI_ERROR_MALLOC;
- }
-
- return URI_SUCCESS;
-}
-
-
-
-#endif
+ const UriBool spaceToPlus = URI_TRUE;
+ const UriBool normalizeBreaks = URI_TRUE;
+
+ return URI_FUNC(ComposeQueryEx)(dest, queryList, maxChars, charsWritten,
+ spaceToPlus, normalizeBreaks);
+}
+
+
+
+int URI_FUNC(ComposeQueryEx)(URI_CHAR * dest,
+ const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten,
+ UriBool spaceToPlus, UriBool normalizeBreaks) {
+ if ((dest == NULL) || (queryList == NULL)) {
+ return URI_ERROR_NULL;
+ }
+
+ if (maxChars < 1) {
+ return URI_ERROR_OUTPUT_TOO_LARGE;
+ }
+
+ return URI_FUNC(ComposeQueryEngine)(dest, queryList, maxChars,
+ charsWritten, NULL, spaceToPlus, normalizeBreaks);
+}
+
+
+
+int URI_FUNC(ComposeQueryMalloc)(URI_CHAR ** dest,
+ const URI_TYPE(QueryList) * queryList) {
+ const UriBool spaceToPlus = URI_TRUE;
+ const UriBool normalizeBreaks = URI_TRUE;
+
+ return URI_FUNC(ComposeQueryMallocEx)(dest, queryList,
+ spaceToPlus, normalizeBreaks);
+}
+
+
+
+int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest,
+ const URI_TYPE(QueryList) * queryList,
+ UriBool spaceToPlus, UriBool normalizeBreaks) {
+ return URI_FUNC(ComposeQueryMallocExMm)(dest, queryList, spaceToPlus,
+ normalizeBreaks, NULL);
+}
+
+
+
+int URI_FUNC(ComposeQueryMallocExMm)(URI_CHAR ** dest,
+ const URI_TYPE(QueryList) * queryList,
+ UriBool spaceToPlus, UriBool normalizeBreaks,
+ UriMemoryManager * memory) {
+ int charsRequired;
+ int res;
+ URI_CHAR * queryString;
+
+ if (dest == NULL) {
+ return URI_ERROR_NULL;
+ }
+
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
+ /* Calculate space */
+ res = URI_FUNC(ComposeQueryCharsRequiredEx)(queryList, &charsRequired,
+ spaceToPlus, normalizeBreaks);
+ if (res != URI_SUCCESS) {
+ return res;
+ }
+ charsRequired++;
+
+ /* Allocate space */
+ queryString = memory->malloc(memory, charsRequired * sizeof(URI_CHAR));
+ if (queryString == NULL) {
+ return URI_ERROR_MALLOC;
+ }
+
+ /* Put query in */
+ res = URI_FUNC(ComposeQueryEx)(queryString, queryList, charsRequired,
+ NULL, spaceToPlus, normalizeBreaks);
+ if (res != URI_SUCCESS) {
+ memory->free(memory, queryString);
+ return res;
+ }
+
+ *dest = queryString;
+ return URI_SUCCESS;
+}
+
+
+
+int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest,
+ const URI_TYPE(QueryList) * queryList,
+ int maxChars, int * charsWritten, int * charsRequired,
+ UriBool spaceToPlus, UriBool normalizeBreaks) {
+ UriBool firstItem = URI_TRUE;
+ int ampersandLen = 0; /* increased to 1 from second item on */
+ URI_CHAR * write = dest;
+
+ /* Subtract terminator */
+ if (dest == NULL) {
+ *charsRequired = 0;
+ } else {
+ maxChars--;
+ }
+
+ while (queryList != NULL) {
+ const URI_CHAR * const key = queryList->key;
+ const URI_CHAR * const value = queryList->value;
+ const int worstCase = (normalizeBreaks == URI_TRUE ? 6 : 3);
+ const int keyLen = (key == NULL) ? 0 : (int)URI_STRLEN(key);
+ int keyRequiredChars;
+ const int valueLen = (value == NULL) ? 0 : (int)URI_STRLEN(value);
+ int valueRequiredChars;
+
+ if ((keyLen >= INT_MAX / worstCase) || (valueLen >= INT_MAX / worstCase)) {
+ return URI_ERROR_OUTPUT_TOO_LARGE;
+ }
+ keyRequiredChars = worstCase * keyLen;
+ valueRequiredChars = worstCase * valueLen;
+
+ if (dest == NULL) {
+ (*charsRequired) += ampersandLen + keyRequiredChars + ((value == NULL)
+ ? 0
+ : 1 + valueRequiredChars);
+
+ if (firstItem == URI_TRUE) {
+ ampersandLen = 1;
+ firstItem = URI_FALSE;
+ }
+ } else {
+ if ((write - dest) + ampersandLen + keyRequiredChars > maxChars) {
+ return URI_ERROR_OUTPUT_TOO_LARGE;
+ }
+
+ /* Copy key */
+ if (firstItem == URI_TRUE) {
+ ampersandLen = 1;
+ firstItem = URI_FALSE;
+ } else {
+ write[0] = _UT('&');
+ write++;
+ }
+ write = URI_FUNC(EscapeEx)(key, key + keyLen,
+ write, spaceToPlus, normalizeBreaks);
+
+ if (value != NULL) {
+ if ((write - dest) + 1 + valueRequiredChars > maxChars) {
+ return URI_ERROR_OUTPUT_TOO_LARGE;
+ }
+
+ /* Copy value */
+ write[0] = _UT('=');
+ write++;
+ write = URI_FUNC(EscapeEx)(value, value + valueLen,
+ write, spaceToPlus, normalizeBreaks);
+ }
+ }
+
+ queryList = queryList->next;
+ }
+
+ if (dest != NULL) {
+ write[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = (int)(write - dest) + 1; /* .. for terminator */
+ }
+ }
+
+ return URI_SUCCESS;
+}
+
+
+
+UriBool URI_FUNC(AppendQueryItem)(URI_TYPE(QueryList) ** prevNext,
+ int * itemCount, const URI_CHAR * keyFirst, const URI_CHAR * keyAfter,
+ const URI_CHAR * valueFirst, const URI_CHAR * valueAfter,
+ UriBool plusToSpace, UriBreakConversion breakConversion,
+ UriMemoryManager * memory) {
+ const int keyLen = (int)(keyAfter - keyFirst);
+ const int valueLen = (int)(valueAfter - valueFirst);
+ URI_CHAR * key;
+ URI_CHAR * value;
+
+ if ((prevNext == NULL) || (itemCount == NULL)
+ || (keyFirst == NULL) || (keyAfter == NULL)
+ || (keyFirst > keyAfter) || (valueFirst > valueAfter)
+ || ((keyFirst == keyAfter)
+ && (valueFirst == NULL) && (valueAfter == NULL))) {
+ return URI_TRUE;
+ }
+
+ /* Append new empty item */
+ *prevNext = memory->malloc(memory, 1 * sizeof(URI_TYPE(QueryList)));
+ if (*prevNext == NULL) {
+ return URI_FALSE; /* Raises malloc error */
+ }
+ (*prevNext)->next = NULL;
+
+
+ /* Fill key */
+ key = memory->malloc(memory, (keyLen + 1) * sizeof(URI_CHAR));
+ if (key == NULL) {
+ memory->free(memory, *prevNext);
+ *prevNext = NULL;
+ return URI_FALSE; /* Raises malloc error */
+ }
+
+ key[keyLen] = _UT('\0');
+ if (keyLen > 0) {
+ /* Copy 1:1 */
+ memcpy(key, keyFirst, keyLen * sizeof(URI_CHAR));
+
+ /* Unescape */
+ URI_FUNC(UnescapeInPlaceEx)(key, plusToSpace, breakConversion);
+ }
+ (*prevNext)->key = key;
+
+
+ /* Fill value */
+ if (valueFirst != NULL) {
+ value = memory->malloc(memory, (valueLen + 1) * sizeof(URI_CHAR));
+ if (value == NULL) {
+ memory->free(memory, key);
+ memory->free(memory, *prevNext);
+ *prevNext = NULL;
+ return URI_FALSE; /* Raises malloc error */
+ }
+
+ value[valueLen] = _UT('\0');
+ if (valueLen > 0) {
+ /* Copy 1:1 */
+ memcpy(value, valueFirst, valueLen * sizeof(URI_CHAR));
+
+ /* Unescape */
+ URI_FUNC(UnescapeInPlaceEx)(value, plusToSpace, breakConversion);
+ }
+ (*prevNext)->value = value;
+ } else {
+ value = NULL;
+ }
+ (*prevNext)->value = value;
+
+ (*itemCount)++;
+ return URI_TRUE;
+}
+
+
+
+void URI_FUNC(FreeQueryList)(URI_TYPE(QueryList) * queryList) {
+ URI_FUNC(FreeQueryListMm)(queryList, NULL);
+}
+
+
+
+int URI_FUNC(FreeQueryListMm)(URI_TYPE(QueryList) * queryList,
+ UriMemoryManager * memory) {
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+ while (queryList != NULL) {
+ URI_TYPE(QueryList) * nextBackup = queryList->next;
+ memory->free(memory, (URI_CHAR *)queryList->key); /* const cast */
+ memory->free(memory, (URI_CHAR *)queryList->value); /* const cast */
+ memory->free(memory, queryList);
+ queryList = nextBackup;
+ }
+ return URI_SUCCESS;
+}
+
+
+
+int URI_FUNC(DissectQueryMalloc)(URI_TYPE(QueryList) ** dest, int * itemCount,
+ const URI_CHAR * first, const URI_CHAR * afterLast) {
+ const UriBool plusToSpace = URI_TRUE;
+ const UriBreakConversion breakConversion = URI_BR_DONT_TOUCH;
+
+ return URI_FUNC(DissectQueryMallocEx)(dest, itemCount, first, afterLast,
+ plusToSpace, breakConversion);
+}
+
+
+
+int URI_FUNC(DissectQueryMallocEx)(URI_TYPE(QueryList) ** dest, int * itemCount,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriBool plusToSpace, UriBreakConversion breakConversion) {
+ return URI_FUNC(DissectQueryMallocExMm)(dest, itemCount, first, afterLast,
+ plusToSpace, breakConversion, NULL);
+}
+
+
+
+int URI_FUNC(DissectQueryMallocExMm)(URI_TYPE(QueryList) ** dest, int * itemCount,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriBool plusToSpace, UriBreakConversion breakConversion,
+ UriMemoryManager * memory) {
+ const URI_CHAR * walk = first;
+ const URI_CHAR * keyFirst = first;
+ const URI_CHAR * keyAfter = NULL;
+ const URI_CHAR * valueFirst = NULL;
+ const URI_CHAR * valueAfter = NULL;
+ URI_TYPE(QueryList) ** prevNext = dest;
+ int nullCounter;
+ int * itemsAppended = (itemCount == NULL) ? &nullCounter : itemCount;
+
+ if ((dest == NULL) || (first == NULL) || (afterLast == NULL)) {
+ return URI_ERROR_NULL;
+ }
+
+ if (first > afterLast) {
+ return URI_ERROR_RANGE_INVALID;
+ }
+
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
+ *dest = NULL;
+ *itemsAppended = 0;
+
+ /* Parse query string */
+ for (; walk < afterLast; walk++) {
+ switch (*walk) {
+ case _UT('&'):
+ if (valueFirst != NULL) {
+ valueAfter = walk;
+ } else {
+ keyAfter = walk;
+ }
+
+ if (URI_FUNC(AppendQueryItem)(prevNext, itemsAppended,
+ keyFirst, keyAfter, valueFirst, valueAfter,
+ plusToSpace, breakConversion, memory)
+ == URI_FALSE) {
+ /* Free list we built */
+ *itemsAppended = 0;
+ URI_FUNC(FreeQueryListMm)(*dest, memory);
+ return URI_ERROR_MALLOC;
+ }
+
+ /* Make future items children of the current */
+ if ((prevNext != NULL) && (*prevNext != NULL)) {
+ prevNext = &((*prevNext)->next);
+ }
+
+ if (walk + 1 < afterLast) {
+ keyFirst = walk + 1;
+ } else {
+ keyFirst = NULL;
+ }
+ keyAfter = NULL;
+ valueFirst = NULL;
+ valueAfter = NULL;
+ break;
+
+ case _UT('='):
+ /* NOTE: WE treat the first '=' as a separator, */
+ /* all following go into the value part */
+ if (keyAfter == NULL) {
+ keyAfter = walk;
+ if (walk + 1 <= afterLast) {
+ valueFirst = walk + 1;
+ valueAfter = walk + 1;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (valueFirst != NULL) {
+ /* Must be key/value pair */
+ valueAfter = walk;
+ } else {
+ /* Must be key only */
+ keyAfter = walk;
+ }
+
+ if (URI_FUNC(AppendQueryItem)(prevNext, itemsAppended, keyFirst, keyAfter,
+ valueFirst, valueAfter, plusToSpace, breakConversion, memory)
+ == URI_FALSE) {
+ /* Free list we built */
+ *itemsAppended = 0;
+ URI_FUNC(FreeQueryListMm)(*dest, memory);
+ return URI_ERROR_MALLOC;
+ }
+
+ return URI_SUCCESS;
+}
+
+
+
+#endif
diff --git a/contrib/restricted/uriparser/src/UriRecompose.c b/contrib/restricted/uriparser/src/UriRecompose.c
index 5027eca6cf..e292aa89ce 100644
--- a/contrib/restricted/uriparser/src/UriRecompose.c
+++ b/contrib/restricted/uriparser/src/UriRecompose.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,547 +31,547 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* What encodings are enabled? */
-#include <uriparser/UriDefsConfig.h>
-#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* Include SELF twice */
-# ifdef URI_ENABLE_ANSI
-# define URI_PASS_ANSI 1
-# include "UriRecompose.c"
-# undef URI_PASS_ANSI
-# endif
-# ifdef URI_ENABLE_UNICODE
-# define URI_PASS_UNICODE 1
-# include "UriRecompose.c"
-# undef URI_PASS_UNICODE
-# endif
-#else
-# ifdef URI_PASS_ANSI
-# include <uriparser/UriDefsAnsi.h>
-# else
-# include <uriparser/UriDefsUnicode.h>
-# include <wchar.h>
-# endif
-
-
-
-#ifndef URI_DOXYGEN
-# include <uriparser/Uri.h>
-# include "UriCommon.h"
-#endif
-
-
-
-static int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(Uri) * uri,
- int maxChars, int * charsWritten, int * charsRequired);
-
-
-
-int URI_FUNC(ToStringCharsRequired)(const URI_TYPE(Uri) * uri,
- int * charsRequired) {
- const int MAX_CHARS = ((unsigned int)-1) >> 1;
- return URI_FUNC(ToStringEngine)(NULL, uri, MAX_CHARS, NULL, charsRequired);
-}
-
-
-
-int URI_FUNC(ToString)(URI_CHAR * dest, const URI_TYPE(Uri) * uri,
- int maxChars, int * charsWritten) {
- return URI_FUNC(ToStringEngine)(dest, uri, maxChars, charsWritten, NULL);
-}
-
-
-
-static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest,
- const URI_TYPE(Uri) * uri, int maxChars, int * charsWritten,
- int * charsRequired) {
- int written = 0;
- if ((uri == NULL) || ((dest == NULL) && (charsRequired == NULL))) {
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_NULL;
- }
-
- if (maxChars < 1) {
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- maxChars--; /* So we don't have to subtract 1 for '\0' all the time */
-
- /* [01/19] result = "" */
- if (dest != NULL) {
- dest[0] = _UT('\0');
- } else {
- (*charsRequired) = 0;
- }
- /* [02/19] if defined(scheme) then */
- if (uri->scheme.first != NULL) {
- /* [03/19] append scheme to result; */
- const int charsToWrite
- = (int)(uri->scheme.afterLast - uri->scheme.first);
- if (dest != NULL) {
- if (written + charsToWrite <= maxChars) {
- memcpy(dest + written, uri->scheme.first,
- charsToWrite * sizeof(URI_CHAR));
- written += charsToWrite;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += charsToWrite;
- }
- /* [04/19] append ":" to result; */
- if (dest != NULL) {
- if (written + 1 <= maxChars) {
- memcpy(dest + written, _UT(":"),
- 1 * sizeof(URI_CHAR));
- written += 1;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += 1;
- }
- /* [05/19] endif; */
- }
- /* [06/19] if defined(authority) then */
- if (URI_FUNC(IsHostSet)(uri)) {
- /* [07/19] append "//" to result; */
- if (dest != NULL) {
- if (written + 2 <= maxChars) {
- memcpy(dest + written, _UT("//"),
- 2 * sizeof(URI_CHAR));
- written += 2;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += 2;
- }
- /* [08/19] append authority to result; */
- /* UserInfo */
- if (uri->userInfo.first != NULL) {
- const int charsToWrite = (int)(uri->userInfo.afterLast - uri->userInfo.first);
- if (dest != NULL) {
- if (written + charsToWrite <= maxChars) {
- memcpy(dest + written, uri->userInfo.first,
- charsToWrite * sizeof(URI_CHAR));
- written += charsToWrite;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
-
- if (written + 1 <= maxChars) {
- memcpy(dest + written, _UT("@"),
- 1 * sizeof(URI_CHAR));
- written += 1;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += charsToWrite + 1;
- }
- }
-
- /* Host */
- if (uri->hostData.ip4 != NULL) {
- /* IPv4 */
- int i = 0;
- for (; i < 4; i++) {
- const unsigned char value = uri->hostData.ip4->data[i];
- const int charsToWrite = (value > 99) ? 3 : ((value > 9) ? 2 : 1);
- if (dest != NULL) {
- if (written + charsToWrite <= maxChars) {
- URI_CHAR text[4];
- if (value > 99) {
- text[0] = _UT('0') + (value / 100);
- text[1] = _UT('0') + ((value % 100) / 10);
- text[2] = _UT('0') + (value % 10);
- } else if (value > 9) {
- text[0] = _UT('0') + (value / 10);
- text[1] = _UT('0') + (value % 10);
- } else {
- text[0] = _UT('0') + value;
- }
- text[charsToWrite] = _UT('\0');
- memcpy(dest + written, text, charsToWrite * sizeof(URI_CHAR));
- written += charsToWrite;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- if (i < 3) {
- if (written + 1 <= maxChars) {
- memcpy(dest + written, _UT("."),
- 1 * sizeof(URI_CHAR));
- written += 1;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- }
- } else {
- (*charsRequired) += charsToWrite + ((i == 3) ? 0 : 1);
- }
- }
- } else if (uri->hostData.ip6 != NULL) {
- /* IPv6 */
- int i = 0;
- if (dest != NULL) {
- if (written + 1 <= maxChars) {
- memcpy(dest + written, _UT("["),
- 1 * sizeof(URI_CHAR));
- written += 1;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += 1;
- }
-
- for (; i < 16; i++) {
- const unsigned char value = uri->hostData.ip6->data[i];
- if (dest != NULL) {
- if (written + 2 <= maxChars) {
- URI_CHAR text[3];
- text[0] = URI_FUNC(HexToLetterEx)(value / 16, URI_FALSE);
- text[1] = URI_FUNC(HexToLetterEx)(value % 16, URI_FALSE);
- text[2] = _UT('\0');
- memcpy(dest + written, text, 2 * sizeof(URI_CHAR));
- written += 2;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += 2;
- }
- if (((i & 1) == 1) && (i < 15)) {
- if (dest != NULL) {
- if (written + 1 <= maxChars) {
- memcpy(dest + written, _UT(":"),
- 1 * sizeof(URI_CHAR));
- written += 1;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += 1;
- }
- }
- }
-
- if (dest != NULL) {
- if (written + 1 <= maxChars) {
- memcpy(dest + written, _UT("]"),
- 1 * sizeof(URI_CHAR));
- written += 1;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += 1;
- }
- } else if (uri->hostData.ipFuture.first != NULL) {
- /* IPvFuture */
- const int charsToWrite = (int)(uri->hostData.ipFuture.afterLast
- - uri->hostData.ipFuture.first);
- if (dest != NULL) {
- if (written + 1 <= maxChars) {
- memcpy(dest + written, _UT("["),
- 1 * sizeof(URI_CHAR));
- written += 1;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
-
- if (written + charsToWrite <= maxChars) {
- memcpy(dest + written, uri->hostData.ipFuture.first, charsToWrite * sizeof(URI_CHAR));
- written += charsToWrite;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
-
- if (written + 1 <= maxChars) {
- memcpy(dest + written, _UT("]"),
- 1 * sizeof(URI_CHAR));
- written += 1;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += 1 + charsToWrite + 1;
- }
- } else if (uri->hostText.first != NULL) {
- /* Regname */
- const int charsToWrite = (int)(uri->hostText.afterLast - uri->hostText.first);
- if (dest != NULL) {
- if (written + charsToWrite <= maxChars) {
- memcpy(dest + written, uri->hostText.first,
- charsToWrite * sizeof(URI_CHAR));
- written += charsToWrite;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += charsToWrite;
- }
- }
-
- /* Port */
- if (uri->portText.first != NULL) {
- const int charsToWrite = (int)(uri->portText.afterLast - uri->portText.first);
- if (dest != NULL) {
- /* Leading ':' */
- if (written + 1 <= maxChars) {
- memcpy(dest + written, _UT(":"),
- 1 * sizeof(URI_CHAR));
- written += 1;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
-
- /* Port number */
- if (written + charsToWrite <= maxChars) {
- memcpy(dest + written, uri->portText.first,
- charsToWrite * sizeof(URI_CHAR));
- written += charsToWrite;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += 1 + charsToWrite;
- }
- }
- /* [09/19] endif; */
- }
- /* [10/19] append path to result; */
- /* Slash needed here? */
- if (uri->absolutePath || ((uri->pathHead != NULL)
- && URI_FUNC(IsHostSet)(uri))) {
- if (dest != NULL) {
- if (written + 1 <= maxChars) {
- memcpy(dest + written, _UT("/"),
- 1 * sizeof(URI_CHAR));
- written += 1;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += 1;
- }
- }
-
- if (uri->pathHead != NULL) {
- URI_TYPE(PathSegment) * walker = uri->pathHead;
- do {
- const int charsToWrite = (int)(walker->text.afterLast - walker->text.first);
- if (dest != NULL) {
- if (written + charsToWrite <= maxChars) {
- memcpy(dest + written, walker->text.first,
- charsToWrite * sizeof(URI_CHAR));
- written += charsToWrite;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += charsToWrite;
- }
-
- /* Not last segment -> append slash */
- if (walker->next != NULL) {
- if (dest != NULL) {
- if (written + 1 <= maxChars) {
- memcpy(dest + written, _UT("/"),
- 1 * sizeof(URI_CHAR));
- written += 1;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += 1;
- }
- }
-
- walker = walker->next;
- } while (walker != NULL);
- }
- /* [11/19] if defined(query) then */
- if (uri->query.first != NULL) {
- /* [12/19] append "?" to result; */
- if (dest != NULL) {
- if (written + 1 <= maxChars) {
- memcpy(dest + written, _UT("?"),
- 1 * sizeof(URI_CHAR));
- written += 1;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += 1;
- }
- /* [13/19] append query to result; */
- {
- const int charsToWrite
- = (int)(uri->query.afterLast - uri->query.first);
- if (dest != NULL) {
- if (written + charsToWrite <= maxChars) {
- memcpy(dest + written, uri->query.first,
- charsToWrite * sizeof(URI_CHAR));
- written += charsToWrite;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += charsToWrite;
- }
- }
- /* [14/19] endif; */
- }
- /* [15/19] if defined(fragment) then */
- if (uri->fragment.first != NULL) {
- /* [16/19] append "#" to result; */
- if (dest != NULL) {
- if (written + 1 <= maxChars) {
- memcpy(dest + written, _UT("#"),
- 1 * sizeof(URI_CHAR));
- written += 1;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += 1;
- }
- /* [17/19] append fragment to result; */
- {
- const int charsToWrite
- = (int)(uri->fragment.afterLast - uri->fragment.first);
- if (dest != NULL) {
- if (written + charsToWrite <= maxChars) {
- memcpy(dest + written, uri->fragment.first,
- charsToWrite * sizeof(URI_CHAR));
- written += charsToWrite;
- } else {
- dest[0] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = 0;
- }
- return URI_ERROR_TOSTRING_TOO_LONG;
- }
- } else {
- (*charsRequired) += charsToWrite;
- }
- }
- /* [18/19] endif; */
- }
- /* [19/19] return result; */
- if (dest != NULL) {
- dest[written++] = _UT('\0');
- if (charsWritten != NULL) {
- *charsWritten = written;
- }
- }
- return URI_SUCCESS;
-}
-
-
-
-#endif
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* What encodings are enabled? */
+#include <uriparser/UriDefsConfig.h>
+#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* Include SELF twice */
+# ifdef URI_ENABLE_ANSI
+# define URI_PASS_ANSI 1
+# include "UriRecompose.c"
+# undef URI_PASS_ANSI
+# endif
+# ifdef URI_ENABLE_UNICODE
+# define URI_PASS_UNICODE 1
+# include "UriRecompose.c"
+# undef URI_PASS_UNICODE
+# endif
+#else
+# ifdef URI_PASS_ANSI
+# include <uriparser/UriDefsAnsi.h>
+# else
+# include <uriparser/UriDefsUnicode.h>
+# include <wchar.h>
+# endif
+
+
+
+#ifndef URI_DOXYGEN
+# include <uriparser/Uri.h>
+# include "UriCommon.h"
+#endif
+
+
+
+static int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(Uri) * uri,
+ int maxChars, int * charsWritten, int * charsRequired);
+
+
+
+int URI_FUNC(ToStringCharsRequired)(const URI_TYPE(Uri) * uri,
+ int * charsRequired) {
+ const int MAX_CHARS = ((unsigned int)-1) >> 1;
+ return URI_FUNC(ToStringEngine)(NULL, uri, MAX_CHARS, NULL, charsRequired);
+}
+
+
+
+int URI_FUNC(ToString)(URI_CHAR * dest, const URI_TYPE(Uri) * uri,
+ int maxChars, int * charsWritten) {
+ return URI_FUNC(ToStringEngine)(dest, uri, maxChars, charsWritten, NULL);
+}
+
+
+
+static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest,
+ const URI_TYPE(Uri) * uri, int maxChars, int * charsWritten,
+ int * charsRequired) {
+ int written = 0;
+ if ((uri == NULL) || ((dest == NULL) && (charsRequired == NULL))) {
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_NULL;
+ }
+
+ if (maxChars < 1) {
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ maxChars--; /* So we don't have to subtract 1 for '\0' all the time */
+
+ /* [01/19] result = "" */
+ if (dest != NULL) {
+ dest[0] = _UT('\0');
+ } else {
+ (*charsRequired) = 0;
+ }
+ /* [02/19] if defined(scheme) then */
+ if (uri->scheme.first != NULL) {
+ /* [03/19] append scheme to result; */
+ const int charsToWrite
+ = (int)(uri->scheme.afterLast - uri->scheme.first);
+ if (dest != NULL) {
+ if (written + charsToWrite <= maxChars) {
+ memcpy(dest + written, uri->scheme.first,
+ charsToWrite * sizeof(URI_CHAR));
+ written += charsToWrite;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += charsToWrite;
+ }
+ /* [04/19] append ":" to result; */
+ if (dest != NULL) {
+ if (written + 1 <= maxChars) {
+ memcpy(dest + written, _UT(":"),
+ 1 * sizeof(URI_CHAR));
+ written += 1;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += 1;
+ }
+ /* [05/19] endif; */
+ }
+ /* [06/19] if defined(authority) then */
+ if (URI_FUNC(IsHostSet)(uri)) {
+ /* [07/19] append "//" to result; */
+ if (dest != NULL) {
+ if (written + 2 <= maxChars) {
+ memcpy(dest + written, _UT("//"),
+ 2 * sizeof(URI_CHAR));
+ written += 2;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += 2;
+ }
+ /* [08/19] append authority to result; */
+ /* UserInfo */
+ if (uri->userInfo.first != NULL) {
+ const int charsToWrite = (int)(uri->userInfo.afterLast - uri->userInfo.first);
+ if (dest != NULL) {
+ if (written + charsToWrite <= maxChars) {
+ memcpy(dest + written, uri->userInfo.first,
+ charsToWrite * sizeof(URI_CHAR));
+ written += charsToWrite;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+
+ if (written + 1 <= maxChars) {
+ memcpy(dest + written, _UT("@"),
+ 1 * sizeof(URI_CHAR));
+ written += 1;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += charsToWrite + 1;
+ }
+ }
+
+ /* Host */
+ if (uri->hostData.ip4 != NULL) {
+ /* IPv4 */
+ int i = 0;
+ for (; i < 4; i++) {
+ const unsigned char value = uri->hostData.ip4->data[i];
+ const int charsToWrite = (value > 99) ? 3 : ((value > 9) ? 2 : 1);
+ if (dest != NULL) {
+ if (written + charsToWrite <= maxChars) {
+ URI_CHAR text[4];
+ if (value > 99) {
+ text[0] = _UT('0') + (value / 100);
+ text[1] = _UT('0') + ((value % 100) / 10);
+ text[2] = _UT('0') + (value % 10);
+ } else if (value > 9) {
+ text[0] = _UT('0') + (value / 10);
+ text[1] = _UT('0') + (value % 10);
+ } else {
+ text[0] = _UT('0') + value;
+ }
+ text[charsToWrite] = _UT('\0');
+ memcpy(dest + written, text, charsToWrite * sizeof(URI_CHAR));
+ written += charsToWrite;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ if (i < 3) {
+ if (written + 1 <= maxChars) {
+ memcpy(dest + written, _UT("."),
+ 1 * sizeof(URI_CHAR));
+ written += 1;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ }
+ } else {
+ (*charsRequired) += charsToWrite + ((i == 3) ? 0 : 1);
+ }
+ }
+ } else if (uri->hostData.ip6 != NULL) {
+ /* IPv6 */
+ int i = 0;
+ if (dest != NULL) {
+ if (written + 1 <= maxChars) {
+ memcpy(dest + written, _UT("["),
+ 1 * sizeof(URI_CHAR));
+ written += 1;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += 1;
+ }
+
+ for (; i < 16; i++) {
+ const unsigned char value = uri->hostData.ip6->data[i];
+ if (dest != NULL) {
+ if (written + 2 <= maxChars) {
+ URI_CHAR text[3];
+ text[0] = URI_FUNC(HexToLetterEx)(value / 16, URI_FALSE);
+ text[1] = URI_FUNC(HexToLetterEx)(value % 16, URI_FALSE);
+ text[2] = _UT('\0');
+ memcpy(dest + written, text, 2 * sizeof(URI_CHAR));
+ written += 2;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += 2;
+ }
+ if (((i & 1) == 1) && (i < 15)) {
+ if (dest != NULL) {
+ if (written + 1 <= maxChars) {
+ memcpy(dest + written, _UT(":"),
+ 1 * sizeof(URI_CHAR));
+ written += 1;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += 1;
+ }
+ }
+ }
+
+ if (dest != NULL) {
+ if (written + 1 <= maxChars) {
+ memcpy(dest + written, _UT("]"),
+ 1 * sizeof(URI_CHAR));
+ written += 1;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += 1;
+ }
+ } else if (uri->hostData.ipFuture.first != NULL) {
+ /* IPvFuture */
+ const int charsToWrite = (int)(uri->hostData.ipFuture.afterLast
+ - uri->hostData.ipFuture.first);
+ if (dest != NULL) {
+ if (written + 1 <= maxChars) {
+ memcpy(dest + written, _UT("["),
+ 1 * sizeof(URI_CHAR));
+ written += 1;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+
+ if (written + charsToWrite <= maxChars) {
+ memcpy(dest + written, uri->hostData.ipFuture.first, charsToWrite * sizeof(URI_CHAR));
+ written += charsToWrite;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+
+ if (written + 1 <= maxChars) {
+ memcpy(dest + written, _UT("]"),
+ 1 * sizeof(URI_CHAR));
+ written += 1;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += 1 + charsToWrite + 1;
+ }
+ } else if (uri->hostText.first != NULL) {
+ /* Regname */
+ const int charsToWrite = (int)(uri->hostText.afterLast - uri->hostText.first);
+ if (dest != NULL) {
+ if (written + charsToWrite <= maxChars) {
+ memcpy(dest + written, uri->hostText.first,
+ charsToWrite * sizeof(URI_CHAR));
+ written += charsToWrite;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += charsToWrite;
+ }
+ }
+
+ /* Port */
+ if (uri->portText.first != NULL) {
+ const int charsToWrite = (int)(uri->portText.afterLast - uri->portText.first);
+ if (dest != NULL) {
+ /* Leading ':' */
+ if (written + 1 <= maxChars) {
+ memcpy(dest + written, _UT(":"),
+ 1 * sizeof(URI_CHAR));
+ written += 1;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+
+ /* Port number */
+ if (written + charsToWrite <= maxChars) {
+ memcpy(dest + written, uri->portText.first,
+ charsToWrite * sizeof(URI_CHAR));
+ written += charsToWrite;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += 1 + charsToWrite;
+ }
+ }
+ /* [09/19] endif; */
+ }
+ /* [10/19] append path to result; */
+ /* Slash needed here? */
+ if (uri->absolutePath || ((uri->pathHead != NULL)
+ && URI_FUNC(IsHostSet)(uri))) {
+ if (dest != NULL) {
+ if (written + 1 <= maxChars) {
+ memcpy(dest + written, _UT("/"),
+ 1 * sizeof(URI_CHAR));
+ written += 1;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += 1;
+ }
+ }
+
+ if (uri->pathHead != NULL) {
+ URI_TYPE(PathSegment) * walker = uri->pathHead;
+ do {
+ const int charsToWrite = (int)(walker->text.afterLast - walker->text.first);
+ if (dest != NULL) {
+ if (written + charsToWrite <= maxChars) {
+ memcpy(dest + written, walker->text.first,
+ charsToWrite * sizeof(URI_CHAR));
+ written += charsToWrite;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += charsToWrite;
+ }
+
+ /* Not last segment -> append slash */
+ if (walker->next != NULL) {
+ if (dest != NULL) {
+ if (written + 1 <= maxChars) {
+ memcpy(dest + written, _UT("/"),
+ 1 * sizeof(URI_CHAR));
+ written += 1;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += 1;
+ }
+ }
+
+ walker = walker->next;
+ } while (walker != NULL);
+ }
+ /* [11/19] if defined(query) then */
+ if (uri->query.first != NULL) {
+ /* [12/19] append "?" to result; */
+ if (dest != NULL) {
+ if (written + 1 <= maxChars) {
+ memcpy(dest + written, _UT("?"),
+ 1 * sizeof(URI_CHAR));
+ written += 1;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += 1;
+ }
+ /* [13/19] append query to result; */
+ {
+ const int charsToWrite
+ = (int)(uri->query.afterLast - uri->query.first);
+ if (dest != NULL) {
+ if (written + charsToWrite <= maxChars) {
+ memcpy(dest + written, uri->query.first,
+ charsToWrite * sizeof(URI_CHAR));
+ written += charsToWrite;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += charsToWrite;
+ }
+ }
+ /* [14/19] endif; */
+ }
+ /* [15/19] if defined(fragment) then */
+ if (uri->fragment.first != NULL) {
+ /* [16/19] append "#" to result; */
+ if (dest != NULL) {
+ if (written + 1 <= maxChars) {
+ memcpy(dest + written, _UT("#"),
+ 1 * sizeof(URI_CHAR));
+ written += 1;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += 1;
+ }
+ /* [17/19] append fragment to result; */
+ {
+ const int charsToWrite
+ = (int)(uri->fragment.afterLast - uri->fragment.first);
+ if (dest != NULL) {
+ if (written + charsToWrite <= maxChars) {
+ memcpy(dest + written, uri->fragment.first,
+ charsToWrite * sizeof(URI_CHAR));
+ written += charsToWrite;
+ } else {
+ dest[0] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = 0;
+ }
+ return URI_ERROR_TOSTRING_TOO_LONG;
+ }
+ } else {
+ (*charsRequired) += charsToWrite;
+ }
+ }
+ /* [18/19] endif; */
+ }
+ /* [19/19] return result; */
+ if (dest != NULL) {
+ dest[written++] = _UT('\0');
+ if (charsWritten != NULL) {
+ *charsWritten = written;
+ }
+ }
+ return URI_SUCCESS;
+}
+
+
+
+#endif
diff --git a/contrib/restricted/uriparser/src/UriResolve.c b/contrib/restricted/uriparser/src/UriResolve.c
index 80031a894d..a4543dc5a1 100644
--- a/contrib/restricted/uriparser/src/UriResolve.c
+++ b/contrib/restricted/uriparser/src/UriResolve.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,299 +31,299 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* What encodings are enabled? */
-#include <uriparser/UriDefsConfig.h>
-#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* Include SELF twice */
-# ifdef URI_ENABLE_ANSI
-# define URI_PASS_ANSI 1
-# include "UriResolve.c"
-# undef URI_PASS_ANSI
-# endif
-# ifdef URI_ENABLE_UNICODE
-# define URI_PASS_UNICODE 1
-# include "UriResolve.c"
-# undef URI_PASS_UNICODE
-# endif
-#else
-# ifdef URI_PASS_ANSI
-# include <uriparser/UriDefsAnsi.h>
-# else
-# include <uriparser/UriDefsUnicode.h>
-# include <wchar.h>
-# endif
-
-
-
-#ifndef URI_DOXYGEN
-# include <uriparser/Uri.h>
-# include "UriCommon.h"
-# include "UriMemory.h"
-#endif
-
-
-
-/* Appends a relative URI to an absolute. The last path segment of
- * the absolute URI is replaced. */
-static URI_INLINE UriBool URI_FUNC(MergePath)(URI_TYPE(Uri) * absWork,
- const URI_TYPE(Uri) * relAppend, UriMemoryManager * memory) {
- URI_TYPE(PathSegment) * sourceWalker;
- URI_TYPE(PathSegment) * destPrev;
- if (relAppend->pathHead == NULL) {
- return URI_TRUE;
- }
-
- /* Replace last segment ("" if trailing slash) with first of append chain */
- if (absWork->pathHead == NULL) {
- URI_TYPE(PathSegment) * const dup = memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
- if (dup == NULL) {
- return URI_FALSE; /* Raises malloc error */
- }
- dup->next = NULL;
- absWork->pathHead = dup;
- absWork->pathTail = dup;
- }
- absWork->pathTail->text.first = relAppend->pathHead->text.first;
- absWork->pathTail->text.afterLast = relAppend->pathHead->text.afterLast;
-
- /* Append all the others */
- sourceWalker = relAppend->pathHead->next;
- if (sourceWalker == NULL) {
- return URI_TRUE;
- }
- destPrev = absWork->pathTail;
-
- for (;;) {
- URI_TYPE(PathSegment) * const dup = memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
- if (dup == NULL) {
- destPrev->next = NULL;
- absWork->pathTail = destPrev;
- return URI_FALSE; /* Raises malloc error */
- }
- dup->text = sourceWalker->text;
- destPrev->next = dup;
-
- if (sourceWalker->next == NULL) {
- absWork->pathTail = dup;
- absWork->pathTail->next = NULL;
- break;
- }
- destPrev = dup;
- sourceWalker = sourceWalker->next;
- }
-
- return URI_TRUE;
-}
-
-
-static int URI_FUNC(ResolveAbsolutePathFlag)(URI_TYPE(Uri) * absWork,
- UriMemoryManager * memory) {
- if (absWork == NULL) {
- return URI_ERROR_NULL;
- }
-
- if (URI_FUNC(IsHostSet)(absWork) && absWork->absolutePath) {
- /* Empty segment needed, instead? */
- if (absWork->pathHead == NULL) {
- URI_TYPE(PathSegment) * const segment = memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
- if (segment == NULL) {
- return URI_ERROR_MALLOC;
- }
- segment->text.first = URI_FUNC(SafeToPointTo);
- segment->text.afterLast = URI_FUNC(SafeToPointTo);
- segment->next = NULL;
-
- absWork->pathHead = segment;
- absWork->pathTail = segment;
- }
-
- absWork->absolutePath = URI_FALSE;
- }
-
- return URI_SUCCESS;
-}
-
-
-static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest,
- const URI_TYPE(Uri) * relSource,
- const URI_TYPE(Uri) * absBase,
- UriResolutionOptions options, UriMemoryManager * memory) {
- UriBool relSourceHasScheme;
-
- if (absDest == NULL) {
- return URI_ERROR_NULL;
- }
- URI_FUNC(ResetUri)(absDest);
-
- if ((relSource == NULL) || (absBase == NULL)) {
- return URI_ERROR_NULL;
- }
-
- /* absBase absolute? */
- if (absBase->scheme.first == NULL) {
- return URI_ERROR_ADDBASE_REL_BASE;
- }
-
- /* [00/32] -- A non-strict parser may ignore a scheme in the reference */
- /* [00/32] -- if it is identical to the base URI's scheme. */
- /* [00/32] if ((not strict) and (R.scheme == Base.scheme)) then */
- relSourceHasScheme = (relSource->scheme.first != NULL) ? URI_TRUE : URI_FALSE;
- if ((options & URI_RESOLVE_IDENTICAL_SCHEME_COMPAT)
- && (absBase->scheme.first != NULL)
- && (relSource->scheme.first != NULL)
- && (0 == URI_FUNC(CompareRange)(&(absBase->scheme), &(relSource->scheme)))) {
- /* [00/32] undefine(R.scheme); */
- relSourceHasScheme = URI_FALSE;
- /* [00/32] endif; */
- }
-
- /* [01/32] if defined(R.scheme) then */
- if (relSourceHasScheme) {
- /* [02/32] T.scheme = R.scheme; */
- absDest->scheme = relSource->scheme;
- /* [03/32] T.authority = R.authority; */
- if (!URI_FUNC(CopyAuthority)(absDest, relSource, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [04/32] T.path = remove_dot_segments(R.path); */
- if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) {
- return URI_ERROR_MALLOC;
- }
- if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [05/32] T.query = R.query; */
- absDest->query = relSource->query;
- /* [06/32] else */
- } else {
- /* [07/32] if defined(R.authority) then */
- if (URI_FUNC(IsHostSet)(relSource)) {
- /* [08/32] T.authority = R.authority; */
- if (!URI_FUNC(CopyAuthority)(absDest, relSource, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [09/32] T.path = remove_dot_segments(R.path); */
- if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) {
- return URI_ERROR_MALLOC;
- }
- if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [10/32] T.query = R.query; */
- absDest->query = relSource->query;
- /* [11/32] else */
- } else {
- /* [28/32] T.authority = Base.authority; */
- if (!URI_FUNC(CopyAuthority)(absDest, absBase, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [12/32] if (R.path == "") then */
- if (relSource->pathHead == NULL && !relSource->absolutePath) {
- /* [13/32] T.path = Base.path; */
- if (!URI_FUNC(CopyPath)(absDest, absBase, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [14/32] if defined(R.query) then */
- if (relSource->query.first != NULL) {
- /* [15/32] T.query = R.query; */
- absDest->query = relSource->query;
- /* [16/32] else */
- } else {
- /* [17/32] T.query = Base.query; */
- absDest->query = absBase->query;
- /* [18/32] endif; */
- }
- /* [19/32] else */
- } else {
- /* [20/32] if (R.path starts-with "/") then */
- if (relSource->absolutePath) {
- int res;
- /* [21/32] T.path = remove_dot_segments(R.path); */
- if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) {
- return URI_ERROR_MALLOC;
- }
- res = URI_FUNC(ResolveAbsolutePathFlag)(absDest, memory);
- if (res != URI_SUCCESS) {
- return res;
- }
- if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [22/32] else */
- } else {
- /* [23/32] T.path = merge(Base.path, R.path); */
- if (!URI_FUNC(CopyPath)(absDest, absBase, memory)) {
- return URI_ERROR_MALLOC;
- }
- if (!URI_FUNC(MergePath)(absDest, relSource, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [24/32] T.path = remove_dot_segments(T.path); */
- if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) {
- return URI_ERROR_MALLOC;
- }
-
- if (!URI_FUNC(FixAmbiguity)(absDest, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [25/32] endif; */
- }
- /* [26/32] T.query = R.query; */
- absDest->query = relSource->query;
- /* [27/32] endif; */
- }
- URI_FUNC(FixEmptyTrailSegment)(absDest, memory);
- /* [29/32] endif; */
- }
- /* [30/32] T.scheme = Base.scheme; */
- absDest->scheme = absBase->scheme;
- /* [31/32] endif; */
- }
- /* [32/32] T.fragment = R.fragment; */
- absDest->fragment = relSource->fragment;
-
- return URI_SUCCESS;
-
-}
-
-
-
-int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absDest,
- const URI_TYPE(Uri) * relSource, const URI_TYPE(Uri) * absBase) {
- const UriResolutionOptions options = URI_RESOLVE_STRICTLY;
- return URI_FUNC(AddBaseUriEx)(absDest, relSource, absBase, options);
-}
-
-
-
-int URI_FUNC(AddBaseUriEx)(URI_TYPE(Uri) * absDest,
- const URI_TYPE(Uri) * relSource, const URI_TYPE(Uri) * absBase,
- UriResolutionOptions options) {
- return URI_FUNC(AddBaseUriExMm)(absDest, relSource, absBase, options, NULL);
-}
-
-
-
-int URI_FUNC(AddBaseUriExMm)(URI_TYPE(Uri) * absDest,
- const URI_TYPE(Uri) * relSource, const URI_TYPE(Uri) * absBase,
- UriResolutionOptions options, UriMemoryManager * memory) {
- int res;
-
- URI_CHECK_MEMORY_MANAGER(memory); /* may return */
-
- res = URI_FUNC(AddBaseUriImpl)(absDest, relSource, absBase, options, memory);
- if ((res != URI_SUCCESS) && (absDest != NULL)) {
- URI_FUNC(FreeUriMembersMm)(absDest, memory);
- }
- return res;
-}
-
-
-
-#endif
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* What encodings are enabled? */
+#include <uriparser/UriDefsConfig.h>
+#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* Include SELF twice */
+# ifdef URI_ENABLE_ANSI
+# define URI_PASS_ANSI 1
+# include "UriResolve.c"
+# undef URI_PASS_ANSI
+# endif
+# ifdef URI_ENABLE_UNICODE
+# define URI_PASS_UNICODE 1
+# include "UriResolve.c"
+# undef URI_PASS_UNICODE
+# endif
+#else
+# ifdef URI_PASS_ANSI
+# include <uriparser/UriDefsAnsi.h>
+# else
+# include <uriparser/UriDefsUnicode.h>
+# include <wchar.h>
+# endif
+
+
+
+#ifndef URI_DOXYGEN
+# include <uriparser/Uri.h>
+# include "UriCommon.h"
+# include "UriMemory.h"
+#endif
+
+
+
+/* Appends a relative URI to an absolute. The last path segment of
+ * the absolute URI is replaced. */
+static URI_INLINE UriBool URI_FUNC(MergePath)(URI_TYPE(Uri) * absWork,
+ const URI_TYPE(Uri) * relAppend, UriMemoryManager * memory) {
+ URI_TYPE(PathSegment) * sourceWalker;
+ URI_TYPE(PathSegment) * destPrev;
+ if (relAppend->pathHead == NULL) {
+ return URI_TRUE;
+ }
+
+ /* Replace last segment ("" if trailing slash) with first of append chain */
+ if (absWork->pathHead == NULL) {
+ URI_TYPE(PathSegment) * const dup = memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
+ if (dup == NULL) {
+ return URI_FALSE; /* Raises malloc error */
+ }
+ dup->next = NULL;
+ absWork->pathHead = dup;
+ absWork->pathTail = dup;
+ }
+ absWork->pathTail->text.first = relAppend->pathHead->text.first;
+ absWork->pathTail->text.afterLast = relAppend->pathHead->text.afterLast;
+
+ /* Append all the others */
+ sourceWalker = relAppend->pathHead->next;
+ if (sourceWalker == NULL) {
+ return URI_TRUE;
+ }
+ destPrev = absWork->pathTail;
+
+ for (;;) {
+ URI_TYPE(PathSegment) * const dup = memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
+ if (dup == NULL) {
+ destPrev->next = NULL;
+ absWork->pathTail = destPrev;
+ return URI_FALSE; /* Raises malloc error */
+ }
+ dup->text = sourceWalker->text;
+ destPrev->next = dup;
+
+ if (sourceWalker->next == NULL) {
+ absWork->pathTail = dup;
+ absWork->pathTail->next = NULL;
+ break;
+ }
+ destPrev = dup;
+ sourceWalker = sourceWalker->next;
+ }
+
+ return URI_TRUE;
+}
+
+
+static int URI_FUNC(ResolveAbsolutePathFlag)(URI_TYPE(Uri) * absWork,
+ UriMemoryManager * memory) {
+ if (absWork == NULL) {
+ return URI_ERROR_NULL;
+ }
+
+ if (URI_FUNC(IsHostSet)(absWork) && absWork->absolutePath) {
+ /* Empty segment needed, instead? */
+ if (absWork->pathHead == NULL) {
+ URI_TYPE(PathSegment) * const segment = memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
+ if (segment == NULL) {
+ return URI_ERROR_MALLOC;
+ }
+ segment->text.first = URI_FUNC(SafeToPointTo);
+ segment->text.afterLast = URI_FUNC(SafeToPointTo);
+ segment->next = NULL;
+
+ absWork->pathHead = segment;
+ absWork->pathTail = segment;
+ }
+
+ absWork->absolutePath = URI_FALSE;
+ }
+
+ return URI_SUCCESS;
+}
+
+
+static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest,
+ const URI_TYPE(Uri) * relSource,
+ const URI_TYPE(Uri) * absBase,
+ UriResolutionOptions options, UriMemoryManager * memory) {
+ UriBool relSourceHasScheme;
+
+ if (absDest == NULL) {
+ return URI_ERROR_NULL;
+ }
+ URI_FUNC(ResetUri)(absDest);
+
+ if ((relSource == NULL) || (absBase == NULL)) {
+ return URI_ERROR_NULL;
+ }
+
+ /* absBase absolute? */
+ if (absBase->scheme.first == NULL) {
+ return URI_ERROR_ADDBASE_REL_BASE;
+ }
+
+ /* [00/32] -- A non-strict parser may ignore a scheme in the reference */
+ /* [00/32] -- if it is identical to the base URI's scheme. */
+ /* [00/32] if ((not strict) and (R.scheme == Base.scheme)) then */
+ relSourceHasScheme = (relSource->scheme.first != NULL) ? URI_TRUE : URI_FALSE;
+ if ((options & URI_RESOLVE_IDENTICAL_SCHEME_COMPAT)
+ && (absBase->scheme.first != NULL)
+ && (relSource->scheme.first != NULL)
+ && (0 == URI_FUNC(CompareRange)(&(absBase->scheme), &(relSource->scheme)))) {
+ /* [00/32] undefine(R.scheme); */
+ relSourceHasScheme = URI_FALSE;
+ /* [00/32] endif; */
+ }
+
+ /* [01/32] if defined(R.scheme) then */
+ if (relSourceHasScheme) {
+ /* [02/32] T.scheme = R.scheme; */
+ absDest->scheme = relSource->scheme;
+ /* [03/32] T.authority = R.authority; */
+ if (!URI_FUNC(CopyAuthority)(absDest, relSource, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [04/32] T.path = remove_dot_segments(R.path); */
+ if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [05/32] T.query = R.query; */
+ absDest->query = relSource->query;
+ /* [06/32] else */
+ } else {
+ /* [07/32] if defined(R.authority) then */
+ if (URI_FUNC(IsHostSet)(relSource)) {
+ /* [08/32] T.authority = R.authority; */
+ if (!URI_FUNC(CopyAuthority)(absDest, relSource, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [09/32] T.path = remove_dot_segments(R.path); */
+ if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [10/32] T.query = R.query; */
+ absDest->query = relSource->query;
+ /* [11/32] else */
+ } else {
+ /* [28/32] T.authority = Base.authority; */
+ if (!URI_FUNC(CopyAuthority)(absDest, absBase, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [12/32] if (R.path == "") then */
+ if (relSource->pathHead == NULL && !relSource->absolutePath) {
+ /* [13/32] T.path = Base.path; */
+ if (!URI_FUNC(CopyPath)(absDest, absBase, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [14/32] if defined(R.query) then */
+ if (relSource->query.first != NULL) {
+ /* [15/32] T.query = R.query; */
+ absDest->query = relSource->query;
+ /* [16/32] else */
+ } else {
+ /* [17/32] T.query = Base.query; */
+ absDest->query = absBase->query;
+ /* [18/32] endif; */
+ }
+ /* [19/32] else */
+ } else {
+ /* [20/32] if (R.path starts-with "/") then */
+ if (relSource->absolutePath) {
+ int res;
+ /* [21/32] T.path = remove_dot_segments(R.path); */
+ if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ res = URI_FUNC(ResolveAbsolutePathFlag)(absDest, memory);
+ if (res != URI_SUCCESS) {
+ return res;
+ }
+ if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [22/32] else */
+ } else {
+ /* [23/32] T.path = merge(Base.path, R.path); */
+ if (!URI_FUNC(CopyPath)(absDest, absBase, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ if (!URI_FUNC(MergePath)(absDest, relSource, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [24/32] T.path = remove_dot_segments(T.path); */
+ if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+
+ if (!URI_FUNC(FixAmbiguity)(absDest, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [25/32] endif; */
+ }
+ /* [26/32] T.query = R.query; */
+ absDest->query = relSource->query;
+ /* [27/32] endif; */
+ }
+ URI_FUNC(FixEmptyTrailSegment)(absDest, memory);
+ /* [29/32] endif; */
+ }
+ /* [30/32] T.scheme = Base.scheme; */
+ absDest->scheme = absBase->scheme;
+ /* [31/32] endif; */
+ }
+ /* [32/32] T.fragment = R.fragment; */
+ absDest->fragment = relSource->fragment;
+
+ return URI_SUCCESS;
+
+}
+
+
+
+int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absDest,
+ const URI_TYPE(Uri) * relSource, const URI_TYPE(Uri) * absBase) {
+ const UriResolutionOptions options = URI_RESOLVE_STRICTLY;
+ return URI_FUNC(AddBaseUriEx)(absDest, relSource, absBase, options);
+}
+
+
+
+int URI_FUNC(AddBaseUriEx)(URI_TYPE(Uri) * absDest,
+ const URI_TYPE(Uri) * relSource, const URI_TYPE(Uri) * absBase,
+ UriResolutionOptions options) {
+ return URI_FUNC(AddBaseUriExMm)(absDest, relSource, absBase, options, NULL);
+}
+
+
+
+int URI_FUNC(AddBaseUriExMm)(URI_TYPE(Uri) * absDest,
+ const URI_TYPE(Uri) * relSource, const URI_TYPE(Uri) * absBase,
+ UriResolutionOptions options, UriMemoryManager * memory) {
+ int res;
+
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
+ res = URI_FUNC(AddBaseUriImpl)(absDest, relSource, absBase, options, memory);
+ if ((res != URI_SUCCESS) && (absDest != NULL)) {
+ URI_FUNC(FreeUriMembersMm)(absDest, memory);
+ }
+ return res;
+}
+
+
+
+#endif
diff --git a/contrib/restricted/uriparser/src/UriShorten.c b/contrib/restricted/uriparser/src/UriShorten.c
index d2f893592d..f3dad903c0 100644
--- a/contrib/restricted/uriparser/src/UriShorten.c
+++ b/contrib/restricted/uriparser/src/UriShorten.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,294 +31,294 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* What encodings are enabled? */
-#include <uriparser/UriDefsConfig.h>
-#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
-/* Include SELF twice */
-# ifdef URI_ENABLE_ANSI
-# define URI_PASS_ANSI 1
-# include "UriShorten.c"
-# undef URI_PASS_ANSI
-# endif
-# ifdef URI_ENABLE_UNICODE
-# define URI_PASS_UNICODE 1
-# include "UriShorten.c"
-# undef URI_PASS_UNICODE
-# endif
-#else
-# ifdef URI_PASS_ANSI
-# include <uriparser/UriDefsAnsi.h>
-# else
-# include <uriparser/UriDefsUnicode.h>
-# include <wchar.h>
-# endif
-
-
-
-#ifndef URI_DOXYGEN
-# include <uriparser/Uri.h>
-# include "UriCommon.h"
-# include "UriMemory.h"
-#endif
-
-
-
-static URI_INLINE UriBool URI_FUNC(AppendSegment)(URI_TYPE(Uri) * uri,
- const URI_CHAR * first, const URI_CHAR * afterLast,
- UriMemoryManager * memory) {
- /* Create segment */
- URI_TYPE(PathSegment) * segment = memory->malloc(memory, 1 * sizeof(URI_TYPE(PathSegment)));
- if (segment == NULL) {
- return URI_FALSE; /* Raises malloc error */
- }
- segment->next = NULL;
- segment->text.first = first;
- segment->text.afterLast = afterLast;
-
- /* Put into chain */
- if (uri->pathTail == NULL) {
- uri->pathHead = segment;
- } else {
- uri->pathTail->next = segment;
- }
- uri->pathTail = segment;
-
- return URI_TRUE;
-}
-
-
-
-static URI_INLINE UriBool URI_FUNC(EqualsAuthority)(const URI_TYPE(Uri) * first,
- const URI_TYPE(Uri) * second) {
- /* IPv4 */
- if (first->hostData.ip4 != NULL) {
- return ((second->hostData.ip4 != NULL)
- && !memcmp(first->hostData.ip4->data,
- second->hostData.ip4->data, 4)) ? URI_TRUE : URI_FALSE;
- }
-
- /* IPv6 */
- if (first->hostData.ip6 != NULL) {
- return ((second->hostData.ip6 != NULL)
- && !memcmp(first->hostData.ip6->data,
- second->hostData.ip6->data, 16)) ? URI_TRUE : URI_FALSE;
- }
-
- /* IPvFuture */
- if (first->hostData.ipFuture.first != NULL) {
- return ((second->hostData.ipFuture.first != NULL)
- && !URI_FUNC(CompareRange)(&first->hostData.ipFuture,
- &second->hostData.ipFuture)) ? URI_TRUE : URI_FALSE;
- }
-
- return !URI_FUNC(CompareRange)(&first->hostText, &second->hostText)
- ? URI_TRUE : URI_FALSE;
-}
-
-
-
-static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
- const URI_TYPE(Uri) * absSource,
- const URI_TYPE(Uri) * absBase,
- UriBool domainRootMode, UriMemoryManager * memory) {
- if (dest == NULL) {
- return URI_ERROR_NULL;
- }
- URI_FUNC(ResetUri)(dest);
-
- if ((absSource == NULL) || (absBase == NULL)) {
- return URI_ERROR_NULL;
- }
-
- /* absBase absolute? */
- if (absBase->scheme.first == NULL) {
- return URI_ERROR_REMOVEBASE_REL_BASE;
- }
-
- /* absSource absolute? */
- if (absSource->scheme.first == NULL) {
- return URI_ERROR_REMOVEBASE_REL_SOURCE;
- }
-
- /* [01/50] if (A.scheme != Base.scheme) then */
- if (URI_FUNC(CompareRange)(&absSource->scheme, &absBase->scheme)) {
- /* [02/50] T.scheme = A.scheme; */
- dest->scheme = absSource->scheme;
- /* [03/50] T.authority = A.authority; */
- if (!URI_FUNC(CopyAuthority)(dest, absSource, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [04/50] T.path = A.path; */
- if (!URI_FUNC(CopyPath)(dest, absSource, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [05/50] else */
- } else {
- /* [06/50] undef(T.scheme); */
- /* NOOP */
- /* [07/50] if (A.authority != Base.authority) then */
- if (!URI_FUNC(EqualsAuthority)(absSource, absBase)) {
- /* [08/50] T.authority = A.authority; */
- if (!URI_FUNC(CopyAuthority)(dest, absSource, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [09/50] T.path = A.path; */
- if (!URI_FUNC(CopyPath)(dest, absSource, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [10/50] else */
- } else {
- /* [11/50] if domainRootMode then */
- if (domainRootMode == URI_TRUE) {
- /* [12/50] undef(T.authority); */
- /* NOOP */
- /* [13/50] if (first(A.path) == "") then */
- /* GROUPED */
- /* [14/50] T.path = "/." + A.path; */
- /* GROUPED */
- /* [15/50] else */
- /* GROUPED */
- /* [16/50] T.path = A.path; */
- /* GROUPED */
- /* [17/50] endif; */
- if (!URI_FUNC(CopyPath)(dest, absSource, memory)) {
- return URI_ERROR_MALLOC;
- }
- dest->absolutePath = URI_TRUE;
-
- if (!URI_FUNC(FixAmbiguity)(dest, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [18/50] else */
- } else {
- const URI_TYPE(PathSegment) * sourceSeg = absSource->pathHead;
- const URI_TYPE(PathSegment) * baseSeg = absBase->pathHead;
- /* [19/50] bool pathNaked = true; */
- UriBool pathNaked = URI_TRUE;
- /* [20/50] undef(last(Base.path)); */
- /* NOOP */
- /* [21/50] T.path = ""; */
- dest->absolutePath = URI_FALSE;
- /* [22/50] while (first(A.path) == first(Base.path)) do */
- while ((sourceSeg != NULL) && (baseSeg != NULL)
- && !URI_FUNC(CompareRange)(&sourceSeg->text, &baseSeg->text)
- && !((sourceSeg->text.first == sourceSeg->text.afterLast)
- && ((sourceSeg->next == NULL) != (baseSeg->next == NULL)))) {
- /* [23/50] A.path++; */
- sourceSeg = sourceSeg->next;
- /* [24/50] Base.path++; */
- baseSeg = baseSeg->next;
- /* [25/50] endwhile; */
- }
- /* [26/50] while defined(first(Base.path)) do */
- while ((baseSeg != NULL) && (baseSeg->next != NULL)) {
- /* [27/50] Base.path++; */
- baseSeg = baseSeg->next;
- /* [28/50] T.path += "../"; */
- if (!URI_FUNC(AppendSegment)(dest, URI_FUNC(ConstParent),
- URI_FUNC(ConstParent) + 2, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [29/50] pathNaked = false; */
- pathNaked = URI_FALSE;
- /* [30/50] endwhile; */
- }
- /* [31/50] while defined(first(A.path)) do */
- while (sourceSeg != NULL) {
- /* [32/50] if pathNaked then */
- if (pathNaked == URI_TRUE) {
- /* [33/50] if (first(A.path) contains ":") then */
- UriBool containsColon = URI_FALSE;
- const URI_CHAR * ch = sourceSeg->text.first;
- for (; ch < sourceSeg->text.afterLast; ch++) {
- if (*ch == _UT(':')) {
- containsColon = URI_TRUE;
- break;
- }
- }
-
- if (containsColon) {
- /* [34/50] T.path += "./"; */
- if (!URI_FUNC(AppendSegment)(dest, URI_FUNC(ConstPwd),
- URI_FUNC(ConstPwd) + 1, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [35/50] elseif (first(A.path) == "") then */
- } else if (sourceSeg->text.first == sourceSeg->text.afterLast) {
- /* [36/50] T.path += "/."; */
- if (!URI_FUNC(AppendSegment)(dest, URI_FUNC(ConstPwd),
- URI_FUNC(ConstPwd) + 1, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [37/50] endif; */
- }
- /* [38/50] endif; */
- }
- /* [39/50] T.path += first(A.path); */
- if (!URI_FUNC(AppendSegment)(dest, sourceSeg->text.first,
- sourceSeg->text.afterLast, memory)) {
- return URI_ERROR_MALLOC;
- }
- /* [40/50] pathNaked = false; */
- pathNaked = URI_FALSE;
- /* [41/50] A.path++; */
- sourceSeg = sourceSeg->next;
- /* [42/50] if defined(first(A.path)) then */
- /* NOOP */
- /* [43/50] T.path += + "/"; */
- /* NOOP */
- /* [44/50] endif; */
- /* NOOP */
- /* [45/50] endwhile; */
- }
- /* [46/50] endif; */
- }
- /* [47/50] endif; */
- }
- /* [48/50] endif; */
- }
- /* [49/50] T.query = A.query; */
- dest->query = absSource->query;
- /* [50/50] T.fragment = A.fragment; */
- dest->fragment = absSource->fragment;
-
- return URI_SUCCESS;
-}
-
-
-
-int URI_FUNC(RemoveBaseUri)(URI_TYPE(Uri) * dest,
- const URI_TYPE(Uri) * absSource,
- const URI_TYPE(Uri) * absBase,
- UriBool domainRootMode) {
- return URI_FUNC(RemoveBaseUriMm)(dest, absSource, absBase,
- domainRootMode, NULL);
-}
-
-
-
-int URI_FUNC(RemoveBaseUriMm)(URI_TYPE(Uri) * dest,
- const URI_TYPE(Uri) * absSource,
- const URI_TYPE(Uri) * absBase,
- UriBool domainRootMode, UriMemoryManager * memory) {
- int res;
-
- URI_CHECK_MEMORY_MANAGER(memory); /* may return */
-
- res = URI_FUNC(RemoveBaseUriImpl)(dest, absSource,
- absBase, domainRootMode, memory);
- if ((res != URI_SUCCESS) && (dest != NULL)) {
- URI_FUNC(FreeUriMembersMm)(dest, memory);
- }
- return res;
-}
-
-
-
-#endif
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* What encodings are enabled? */
+#include <uriparser/UriDefsConfig.h>
+#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+/* Include SELF twice */
+# ifdef URI_ENABLE_ANSI
+# define URI_PASS_ANSI 1
+# include "UriShorten.c"
+# undef URI_PASS_ANSI
+# endif
+# ifdef URI_ENABLE_UNICODE
+# define URI_PASS_UNICODE 1
+# include "UriShorten.c"
+# undef URI_PASS_UNICODE
+# endif
+#else
+# ifdef URI_PASS_ANSI
+# include <uriparser/UriDefsAnsi.h>
+# else
+# include <uriparser/UriDefsUnicode.h>
+# include <wchar.h>
+# endif
+
+
+
+#ifndef URI_DOXYGEN
+# include <uriparser/Uri.h>
+# include "UriCommon.h"
+# include "UriMemory.h"
+#endif
+
+
+
+static URI_INLINE UriBool URI_FUNC(AppendSegment)(URI_TYPE(Uri) * uri,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
+ /* Create segment */
+ URI_TYPE(PathSegment) * segment = memory->malloc(memory, 1 * sizeof(URI_TYPE(PathSegment)));
+ if (segment == NULL) {
+ return URI_FALSE; /* Raises malloc error */
+ }
+ segment->next = NULL;
+ segment->text.first = first;
+ segment->text.afterLast = afterLast;
+
+ /* Put into chain */
+ if (uri->pathTail == NULL) {
+ uri->pathHead = segment;
+ } else {
+ uri->pathTail->next = segment;
+ }
+ uri->pathTail = segment;
+
+ return URI_TRUE;
+}
+
+
+
+static URI_INLINE UriBool URI_FUNC(EqualsAuthority)(const URI_TYPE(Uri) * first,
+ const URI_TYPE(Uri) * second) {
+ /* IPv4 */
+ if (first->hostData.ip4 != NULL) {
+ return ((second->hostData.ip4 != NULL)
+ && !memcmp(first->hostData.ip4->data,
+ second->hostData.ip4->data, 4)) ? URI_TRUE : URI_FALSE;
+ }
+
+ /* IPv6 */
+ if (first->hostData.ip6 != NULL) {
+ return ((second->hostData.ip6 != NULL)
+ && !memcmp(first->hostData.ip6->data,
+ second->hostData.ip6->data, 16)) ? URI_TRUE : URI_FALSE;
+ }
+
+ /* IPvFuture */
+ if (first->hostData.ipFuture.first != NULL) {
+ return ((second->hostData.ipFuture.first != NULL)
+ && !URI_FUNC(CompareRange)(&first->hostData.ipFuture,
+ &second->hostData.ipFuture)) ? URI_TRUE : URI_FALSE;
+ }
+
+ return !URI_FUNC(CompareRange)(&first->hostText, &second->hostText)
+ ? URI_TRUE : URI_FALSE;
+}
+
+
+
+static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
+ const URI_TYPE(Uri) * absSource,
+ const URI_TYPE(Uri) * absBase,
+ UriBool domainRootMode, UriMemoryManager * memory) {
+ if (dest == NULL) {
+ return URI_ERROR_NULL;
+ }
+ URI_FUNC(ResetUri)(dest);
+
+ if ((absSource == NULL) || (absBase == NULL)) {
+ return URI_ERROR_NULL;
+ }
+
+ /* absBase absolute? */
+ if (absBase->scheme.first == NULL) {
+ return URI_ERROR_REMOVEBASE_REL_BASE;
+ }
+
+ /* absSource absolute? */
+ if (absSource->scheme.first == NULL) {
+ return URI_ERROR_REMOVEBASE_REL_SOURCE;
+ }
+
+ /* [01/50] if (A.scheme != Base.scheme) then */
+ if (URI_FUNC(CompareRange)(&absSource->scheme, &absBase->scheme)) {
+ /* [02/50] T.scheme = A.scheme; */
+ dest->scheme = absSource->scheme;
+ /* [03/50] T.authority = A.authority; */
+ if (!URI_FUNC(CopyAuthority)(dest, absSource, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [04/50] T.path = A.path; */
+ if (!URI_FUNC(CopyPath)(dest, absSource, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [05/50] else */
+ } else {
+ /* [06/50] undef(T.scheme); */
+ /* NOOP */
+ /* [07/50] if (A.authority != Base.authority) then */
+ if (!URI_FUNC(EqualsAuthority)(absSource, absBase)) {
+ /* [08/50] T.authority = A.authority; */
+ if (!URI_FUNC(CopyAuthority)(dest, absSource, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [09/50] T.path = A.path; */
+ if (!URI_FUNC(CopyPath)(dest, absSource, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [10/50] else */
+ } else {
+ /* [11/50] if domainRootMode then */
+ if (domainRootMode == URI_TRUE) {
+ /* [12/50] undef(T.authority); */
+ /* NOOP */
+ /* [13/50] if (first(A.path) == "") then */
+ /* GROUPED */
+ /* [14/50] T.path = "/." + A.path; */
+ /* GROUPED */
+ /* [15/50] else */
+ /* GROUPED */
+ /* [16/50] T.path = A.path; */
+ /* GROUPED */
+ /* [17/50] endif; */
+ if (!URI_FUNC(CopyPath)(dest, absSource, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ dest->absolutePath = URI_TRUE;
+
+ if (!URI_FUNC(FixAmbiguity)(dest, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [18/50] else */
+ } else {
+ const URI_TYPE(PathSegment) * sourceSeg = absSource->pathHead;
+ const URI_TYPE(PathSegment) * baseSeg = absBase->pathHead;
+ /* [19/50] bool pathNaked = true; */
+ UriBool pathNaked = URI_TRUE;
+ /* [20/50] undef(last(Base.path)); */
+ /* NOOP */
+ /* [21/50] T.path = ""; */
+ dest->absolutePath = URI_FALSE;
+ /* [22/50] while (first(A.path) == first(Base.path)) do */
+ while ((sourceSeg != NULL) && (baseSeg != NULL)
+ && !URI_FUNC(CompareRange)(&sourceSeg->text, &baseSeg->text)
+ && !((sourceSeg->text.first == sourceSeg->text.afterLast)
+ && ((sourceSeg->next == NULL) != (baseSeg->next == NULL)))) {
+ /* [23/50] A.path++; */
+ sourceSeg = sourceSeg->next;
+ /* [24/50] Base.path++; */
+ baseSeg = baseSeg->next;
+ /* [25/50] endwhile; */
+ }
+ /* [26/50] while defined(first(Base.path)) do */
+ while ((baseSeg != NULL) && (baseSeg->next != NULL)) {
+ /* [27/50] Base.path++; */
+ baseSeg = baseSeg->next;
+ /* [28/50] T.path += "../"; */
+ if (!URI_FUNC(AppendSegment)(dest, URI_FUNC(ConstParent),
+ URI_FUNC(ConstParent) + 2, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [29/50] pathNaked = false; */
+ pathNaked = URI_FALSE;
+ /* [30/50] endwhile; */
+ }
+ /* [31/50] while defined(first(A.path)) do */
+ while (sourceSeg != NULL) {
+ /* [32/50] if pathNaked then */
+ if (pathNaked == URI_TRUE) {
+ /* [33/50] if (first(A.path) contains ":") then */
+ UriBool containsColon = URI_FALSE;
+ const URI_CHAR * ch = sourceSeg->text.first;
+ for (; ch < sourceSeg->text.afterLast; ch++) {
+ if (*ch == _UT(':')) {
+ containsColon = URI_TRUE;
+ break;
+ }
+ }
+
+ if (containsColon) {
+ /* [34/50] T.path += "./"; */
+ if (!URI_FUNC(AppendSegment)(dest, URI_FUNC(ConstPwd),
+ URI_FUNC(ConstPwd) + 1, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [35/50] elseif (first(A.path) == "") then */
+ } else if (sourceSeg->text.first == sourceSeg->text.afterLast) {
+ /* [36/50] T.path += "/."; */
+ if (!URI_FUNC(AppendSegment)(dest, URI_FUNC(ConstPwd),
+ URI_FUNC(ConstPwd) + 1, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [37/50] endif; */
+ }
+ /* [38/50] endif; */
+ }
+ /* [39/50] T.path += first(A.path); */
+ if (!URI_FUNC(AppendSegment)(dest, sourceSeg->text.first,
+ sourceSeg->text.afterLast, memory)) {
+ return URI_ERROR_MALLOC;
+ }
+ /* [40/50] pathNaked = false; */
+ pathNaked = URI_FALSE;
+ /* [41/50] A.path++; */
+ sourceSeg = sourceSeg->next;
+ /* [42/50] if defined(first(A.path)) then */
+ /* NOOP */
+ /* [43/50] T.path += + "/"; */
+ /* NOOP */
+ /* [44/50] endif; */
+ /* NOOP */
+ /* [45/50] endwhile; */
+ }
+ /* [46/50] endif; */
+ }
+ /* [47/50] endif; */
+ }
+ /* [48/50] endif; */
+ }
+ /* [49/50] T.query = A.query; */
+ dest->query = absSource->query;
+ /* [50/50] T.fragment = A.fragment; */
+ dest->fragment = absSource->fragment;
+
+ return URI_SUCCESS;
+}
+
+
+
+int URI_FUNC(RemoveBaseUri)(URI_TYPE(Uri) * dest,
+ const URI_TYPE(Uri) * absSource,
+ const URI_TYPE(Uri) * absBase,
+ UriBool domainRootMode) {
+ return URI_FUNC(RemoveBaseUriMm)(dest, absSource, absBase,
+ domainRootMode, NULL);
+}
+
+
+
+int URI_FUNC(RemoveBaseUriMm)(URI_TYPE(Uri) * dest,
+ const URI_TYPE(Uri) * absSource,
+ const URI_TYPE(Uri) * absBase,
+ UriBool domainRootMode, UriMemoryManager * memory) {
+ int res;
+
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
+ res = URI_FUNC(RemoveBaseUriImpl)(dest, absSource,
+ absBase, domainRootMode, memory);
+ if ((res != URI_SUCCESS) && (dest != NULL)) {
+ URI_FUNC(FreeUriMembersMm)(dest, memory);
+ }
+ return res;
+}
+
+
+
+#endif
diff --git a/contrib/restricted/uriparser/tool/uriparse.c b/contrib/restricted/uriparser/tool/uriparse.c
index 027f2d2892..2220680ce4 100644
--- a/contrib/restricted/uriparser/tool/uriparse.c
+++ b/contrib/restricted/uriparser/tool/uriparse.c
@@ -1,29 +1,29 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2013, Radu Hociung <radu.uriparser@ohmi.org>
- * Copyright (C) 2013, Sebastian Pipping <sebastian@pipping.org>
- * All rights reserved.
- *
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2013, Radu Hociung <radu.uriparser@ohmi.org>
+ * Copyright (C) 2013, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- * are met:
- *
+ * are met:
+ *
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* 3. Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -31,110 +31,110 @@
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <uriparser/Uri.h>
-
-#ifdef _WIN32
-# include <winsock2.h>
-# include <ws2tcpip.h>
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <uriparser/Uri.h>
+
+#ifdef _WIN32
+# include <winsock2.h>
+# include <ws2tcpip.h>
# ifdef __MINGW32__
WINSOCK_API_LINKAGE const char * WSAAPI inet_ntop(
int af, const void *src, char *dst, socklen_t size);
# endif
-#else
-# include <sys/socket.h>
-# include <arpa/inet.h>
-# include <netinet/in.h>
-#endif
-
-
-#define RANGE(x) (int)((x).afterLast-(x).first), ((x).first)
-
-
-void usage() {
- printf("Usage: uriparse URI [..]\n");
-}
-
-
-int main(int argc, char *argv[]) {
- int retval = EXIT_SUCCESS;
- int i = 1;
-
- if (argc < 2) {
- usage();
- exit(1);
- }
-
- for (; i < argc; i++) {
- UriParserStateA state;
- UriUriA uri;
- char ipstr[INET6_ADDRSTRLEN];
-
- state.uri = &uri;
- printf("uri: %s\n", argv[i]);
- if (uriParseUriA(&state, argv[i]) != URI_SUCCESS) {
- /* Failure */
- printf("Failure: %s @ '%.18s' (#%lu)\n",
- (state.errorCode == URI_ERROR_SYNTAX)
- ? "syntax"
- : (state.errorCode == URI_ERROR_MALLOC)
- ? "not enough memory"
- : "liburiparser bug (please report)",
- state.errorPos,
- (long unsigned int)(state.errorPos - argv[i]));
- retval = EXIT_FAILURE;
- } else {
- if (uri.scheme.first) {
- printf("scheme: %.*s\n", RANGE(uri.scheme));
- }
- if (uri.userInfo.first) {
- printf("userInfo: %.*s\n", RANGE(uri.userInfo));
- }
- if (uri.hostText.first) {
- printf("hostText: %.*s\n", RANGE(uri.hostText));
- }
- if (uri.hostData.ip4) {
- inet_ntop(AF_INET, uri.hostData.ip4->data, ipstr, sizeof ipstr);
- printf("hostData.ip4: %s\n", ipstr);
- }
- if (uri.hostData.ip6) {
- inet_ntop(AF_INET6, uri.hostData.ip6->data, ipstr, sizeof ipstr);
- printf("hostData.ip6: %s\n", ipstr);
- }
- if (uri.portText.first) {
- printf("portText: %.*s\n", RANGE(uri.portText));
- }
- if (uri.pathHead) {
- const UriPathSegmentA * p = uri.pathHead;
- for (; p; p = p->next) {
- printf(" .. pathSeg: %.*s\n", RANGE(p->text));
- }
- }
- if (uri.query.first) {
- printf("query: %.*s\n", RANGE(uri.query));
- }
- if (uri.fragment.first) {
- printf("fragment: %.*s\n", RANGE(uri.fragment));
- }
- {
- const char * const absolutePathLabel = "absolutePath: ";
- printf("%s%s\n", absolutePathLabel,
- (uri.absolutePath == URI_TRUE) ? "true" : "false");
- if (uri.hostText.first != NULL) {
- printf("%*s%s\n", (int)strlen(absolutePathLabel), "",
- "(always false for URIs with host)");
- }
- }
- }
- printf("\n");
-
- uriFreeUriMembersA(&uri);
- }
- return retval;
-}
+#else
+# include <sys/socket.h>
+# include <arpa/inet.h>
+# include <netinet/in.h>
+#endif
+
+
+#define RANGE(x) (int)((x).afterLast-(x).first), ((x).first)
+
+
+void usage() {
+ printf("Usage: uriparse URI [..]\n");
+}
+
+
+int main(int argc, char *argv[]) {
+ int retval = EXIT_SUCCESS;
+ int i = 1;
+
+ if (argc < 2) {
+ usage();
+ exit(1);
+ }
+
+ for (; i < argc; i++) {
+ UriParserStateA state;
+ UriUriA uri;
+ char ipstr[INET6_ADDRSTRLEN];
+
+ state.uri = &uri;
+ printf("uri: %s\n", argv[i]);
+ if (uriParseUriA(&state, argv[i]) != URI_SUCCESS) {
+ /* Failure */
+ printf("Failure: %s @ '%.18s' (#%lu)\n",
+ (state.errorCode == URI_ERROR_SYNTAX)
+ ? "syntax"
+ : (state.errorCode == URI_ERROR_MALLOC)
+ ? "not enough memory"
+ : "liburiparser bug (please report)",
+ state.errorPos,
+ (long unsigned int)(state.errorPos - argv[i]));
+ retval = EXIT_FAILURE;
+ } else {
+ if (uri.scheme.first) {
+ printf("scheme: %.*s\n", RANGE(uri.scheme));
+ }
+ if (uri.userInfo.first) {
+ printf("userInfo: %.*s\n", RANGE(uri.userInfo));
+ }
+ if (uri.hostText.first) {
+ printf("hostText: %.*s\n", RANGE(uri.hostText));
+ }
+ if (uri.hostData.ip4) {
+ inet_ntop(AF_INET, uri.hostData.ip4->data, ipstr, sizeof ipstr);
+ printf("hostData.ip4: %s\n", ipstr);
+ }
+ if (uri.hostData.ip6) {
+ inet_ntop(AF_INET6, uri.hostData.ip6->data, ipstr, sizeof ipstr);
+ printf("hostData.ip6: %s\n", ipstr);
+ }
+ if (uri.portText.first) {
+ printf("portText: %.*s\n", RANGE(uri.portText));
+ }
+ if (uri.pathHead) {
+ const UriPathSegmentA * p = uri.pathHead;
+ for (; p; p = p->next) {
+ printf(" .. pathSeg: %.*s\n", RANGE(p->text));
+ }
+ }
+ if (uri.query.first) {
+ printf("query: %.*s\n", RANGE(uri.query));
+ }
+ if (uri.fragment.first) {
+ printf("fragment: %.*s\n", RANGE(uri.fragment));
+ }
+ {
+ const char * const absolutePathLabel = "absolutePath: ";
+ printf("%s%s\n", absolutePathLabel,
+ (uri.absolutePath == URI_TRUE) ? "true" : "false");
+ if (uri.hostText.first != NULL) {
+ printf("%*s%s\n", (int)strlen(absolutePathLabel), "",
+ "(always false for URIs with host)");
+ }
+ }
+ }
+ printf("\n");
+
+ uriFreeUriMembersA(&uri);
+ }
+ return retval;
+}
diff --git a/contrib/restricted/uriparser/tool/ya.make b/contrib/restricted/uriparser/tool/ya.make
index 3692ca78e5..43f08d2888 100644
--- a/contrib/restricted/uriparser/tool/ya.make
+++ b/contrib/restricted/uriparser/tool/ya.make
@@ -1,32 +1,32 @@
-# Generated by devtools/yamaker.
-
-PROGRAM(uriparse)
-
+# Generated by devtools/yamaker.
+
+PROGRAM(uriparse)
+
OWNER(
kikht
shindo
g:cpp-contrib
g:mds
)
-
-LICENSE(BSD-3-Clause)
-
+
+LICENSE(BSD-3-Clause)
+
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-PEERDIR(
+PEERDIR(
contrib/restricted/uriparser
-)
-
+)
+
ADDINCL(
contrib/restricted/uriparser/include
)
-
-NO_COMPILER_WARNINGS()
-
+
+NO_COMPILER_WARNINGS()
+
NO_RUNTIME()
-
-SRCS(
- uriparse.c
-)
-
-END()
+
+SRCS(
+ uriparse.c
+)
+
+END()
diff --git a/contrib/restricted/uriparser/ya.make b/contrib/restricted/uriparser/ya.make
index a2b64f8229..50e68492d7 100644
--- a/contrib/restricted/uriparser/ya.make
+++ b/contrib/restricted/uriparser/ya.make
@@ -1,61 +1,61 @@
# Generated by devtools/yamaker from nixpkgs 21.11.
-
-LIBRARY()
-
+
+LIBRARY()
+
OWNER(
kikht
shindo
g:cpp-contrib
g:mds
)
-
+
VERSION(0.9.6)
-
+
ORIGINAL_SOURCE(https://github.com/uriparser/uriparser/archive/uriparser-0.9.6.tar.gz)
-LICENSE(BSD-3-Clause)
-
+LICENSE(BSD-3-Clause)
+
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
PEERDIR(
contrib/libs/libc_compat
)
-ADDINCL(
+ADDINCL(
GLOBAL contrib/restricted/uriparser/include
contrib/restricted/uriparser
-)
-
-NO_COMPILER_WARNINGS()
-
+)
+
+NO_COMPILER_WARNINGS()
+
NO_RUNTIME()
-
+
CFLAGS(
-DURI_LIBRARY_BUILD
-DURI_VISIBILITY
)
-SRCS(
- src/UriCommon.c
- src/UriCompare.c
- src/UriEscape.c
- src/UriFile.c
- src/UriIp4.c
- src/UriIp4Base.c
- src/UriMemory.c
- src/UriNormalize.c
- src/UriNormalizeBase.c
- src/UriParse.c
- src/UriParseBase.c
- src/UriQuery.c
- src/UriRecompose.c
- src/UriResolve.c
- src/UriShorten.c
-)
-
-END()
-
-RECURSE(
+SRCS(
+ src/UriCommon.c
+ src/UriCompare.c
+ src/UriEscape.c
+ src/UriFile.c
+ src/UriIp4.c
+ src/UriIp4Base.c
+ src/UriMemory.c
+ src/UriNormalize.c
+ src/UriNormalizeBase.c
+ src/UriParse.c
+ src/UriParseBase.c
+ src/UriQuery.c
+ src/UriRecompose.c
+ src/UriResolve.c
+ src/UriShorten.c
+)
+
+END()
+
+RECURSE(
test
- tool
-)
+ tool
+)
diff --git a/library/cpp/cache/cache.h b/library/cpp/cache/cache.h
index 6dc997076d..c5231e42d3 100644
--- a/library/cpp/cache/cache.h
+++ b/library/cpp/cache/cache.h
@@ -101,20 +101,20 @@ public:
return ItemsAmount;
}
- size_t GetTotalSize() const {
- return TotalSize;
- }
-
- size_t GetMaxSize() const {
- return MaxSize;
- }
-
- // It does not remove current items if newSize is less than TotalSize.
- // Caller should use RemoveIfOverflown to clean up list in this case
- void SetMaxSize(size_t newSize) {
- MaxSize = newSize;
- }
-
+ size_t GetTotalSize() const {
+ return TotalSize;
+ }
+
+ size_t GetMaxSize() const {
+ return MaxSize;
+ }
+
+ // It does not remove current items if newSize is less than TotalSize.
+ // Caller should use RemoveIfOverflown to clean up list in this case
+ void SetMaxSize(size_t newSize) {
+ MaxSize = newSize;
+ }
+
private:
typedef TIntrusiveList<TItem> TListType;
TListType List;
@@ -212,16 +212,16 @@ public:
return ListSize;
}
- size_t GetMaxSize() const {
- return MaxSize;
- }
-
- // It does not remove current items if newSize is less than TotalSize.
- // Caller should use RemoveIfOverflown to clean up list in this case
- void SetMaxSize(size_t newSize) {
- MaxSize = newSize;
- }
-
+ size_t GetMaxSize() const {
+ return MaxSize;
+ }
+
+ // It does not remove current items if newSize is less than TotalSize.
+ // Caller should use RemoveIfOverflown to clean up list in this case
+ void SetMaxSize(size_t newSize) {
+ MaxSize = newSize;
+ }
+
private:
typedef TIntrusiveList<TItem> TListType;
TListType List;
@@ -333,16 +333,16 @@ public:
return Size;
}
- size_t GetMaxSize() const {
- return MaxSize;
- }
-
- // It does not remove current items if newSize is less than TotalSize.
- // Caller should use RemoveIfOverflown to clean up list in this case
- void SetMaxSize(size_t newSize) {
- MaxSize = newSize;
- }
-
+ size_t GetMaxSize() const {
+ return MaxSize;
+ }
+
+ // It does not remove current items if newSize is less than TotalSize.
+ // Caller should use RemoveIfOverflown to clean up list in this case
+ void SetMaxSize(size_t newSize) {
+ MaxSize = newSize;
+ }
+
void Clear() {
Heap.clear();
Removed.clear();
@@ -531,20 +531,20 @@ public:
Index.clear();
}
- void SetMaxSize(size_t newSize) {
- List.SetMaxSize(newSize);
-
- TItem* removedItem = nullptr;
- while ((removedItem = List.RemoveIfOverflown())) {
- EraseFromIndex(removedItem);
- }
- Y_ASSERT(Index.size() == List.GetSize());
- }
-
- size_t GetMaxSize() const {
- return List.GetMaxSize();
- }
-
+ void SetMaxSize(size_t newSize) {
+ List.SetMaxSize(newSize);
+
+ TItem* removedItem = nullptr;
+ while ((removedItem = List.RemoveIfOverflown())) {
+ EraseFromIndex(removedItem);
+ }
+ Y_ASSERT(Index.size() == List.GetSize());
+ }
+
+ size_t GetMaxSize() const {
+ return List.GetMaxSize();
+ }
+
protected:
TIndex Index;
TListType List;
@@ -595,10 +595,10 @@ public:
TIterator FindOldest() {
return TBase::Empty() ? TBase::End() : this->FindByItem(TBase::List.GetOldest());
}
-
+
size_t TotalSize() const {
- return TBase::List.GetTotalSize();
- }
+ return TBase::List.GetTotalSize();
+ }
};
template <typename TKey, typename TValue, typename TDeleter = TNoopDelete>
diff --git a/library/cpp/cache/ut/cache_ut.cpp b/library/cpp/cache/ut/cache_ut.cpp
index 329872cfde..87601ae3d6 100644
--- a/library/cpp/cache/ut/cache_ut.cpp
+++ b/library/cpp/cache/ut/cache_ut.cpp
@@ -172,145 +172,145 @@ Y_UNIT_TEST_SUITE(TCacheTest) {
UNIT_ASSERT(s.Find(3) == s.End());
}
- Y_UNIT_TEST(LRUSetMaxSizeTest) {
- typedef TLRUCache<int, TString> TCache;
- TCache s(2); // size 2
- s.Insert(1, "abcd");
- s.Insert(2, "efgh");
- s.Insert(3, "ijkl");
- UNIT_ASSERT(s.GetOldest() == "efgh");
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) != s.End());
- UNIT_ASSERT(s.Find(3) != s.End());
-
- // Increasing size should not change anything
- s.SetMaxSize(3);
- UNIT_ASSERT(s.GetOldest() == "efgh");
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) != s.End());
- UNIT_ASSERT(s.Find(3) != s.End());
-
- // And we should be able to add fit more entries
- s.Insert(4, "mnop");
- s.Insert(5, "qrst");
- UNIT_ASSERT(s.GetOldest() == "ijkl");
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) == s.End());
- UNIT_ASSERT(s.Find(3) != s.End());
- UNIT_ASSERT(s.Find(4) != s.End());
- UNIT_ASSERT(s.Find(5) != s.End());
-
- // Decreasing size should remove oldest entries
- s.SetMaxSize(2);
- UNIT_ASSERT(s.GetOldest() == "mnop");
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) == s.End());
- UNIT_ASSERT(s.Find(3) == s.End());
- UNIT_ASSERT(s.Find(4) != s.End());
- UNIT_ASSERT(s.Find(5) != s.End());
-
- // Ano no more entries will fit
- s.Insert(6, "uvwx");
- UNIT_ASSERT(s.GetOldest() == "qrst");
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) == s.End());
- UNIT_ASSERT(s.Find(3) == s.End());
- UNIT_ASSERT(s.Find(4) == s.End());
- UNIT_ASSERT(s.Find(5) != s.End());
- UNIT_ASSERT(s.Find(6) != s.End());
- }
-
- Y_UNIT_TEST(LWSetMaxSizeTest) {
- typedef TLWCache<int, TString, size_t, TStrokaWeighter> TCache;
- TCache s(2); // size 2
- s.Insert(1, "a");
- s.Insert(2, "aa");
- s.Insert(3, "aaa");
- UNIT_ASSERT(s.GetLightest() == "aa");
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) != s.End());
- UNIT_ASSERT(s.Find(3) != s.End());
-
- // Increasing size should not change anything
- s.SetMaxSize(3);
- UNIT_ASSERT(s.GetLightest() == "aa");
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) != s.End());
- UNIT_ASSERT(s.Find(3) != s.End());
-
- // And we should be able to add fit more entries
- s.Insert(4, "aaaa");
- s.Insert(5, "aaaaa");
- UNIT_ASSERT(s.GetLightest() == "aaa");
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) == s.End());
- UNIT_ASSERT(s.Find(3) != s.End());
- UNIT_ASSERT(s.Find(4) != s.End());
- UNIT_ASSERT(s.Find(5) != s.End());
-
- // Decreasing size should remove oldest entries
- s.SetMaxSize(2);
- UNIT_ASSERT(s.GetLightest() == "aaaa");
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) == s.End());
- UNIT_ASSERT(s.Find(3) == s.End());
- UNIT_ASSERT(s.Find(4) != s.End());
- UNIT_ASSERT(s.Find(5) != s.End());
-
- // Ano no more entries will fit
- s.Insert(6, "aaaaaa");
- UNIT_ASSERT(s.GetLightest() == "aaaaa");
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) == s.End());
- UNIT_ASSERT(s.Find(3) == s.End());
- UNIT_ASSERT(s.Find(4) == s.End());
- UNIT_ASSERT(s.Find(5) != s.End());
- UNIT_ASSERT(s.Find(6) != s.End());
- }
-
- Y_UNIT_TEST(LFUSetMaxSizeTest) {
- typedef TLFUCache<int, TString> TCache;
- TCache s(2); // size 2
- s.Insert(1, "abcd");
- s.Insert(2, "efgh");
- s.Insert(3, "ijkl");
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) != s.End());
- UNIT_ASSERT(s.Find(3) != s.End());
-
- // Increasing size should not change anything
- s.SetMaxSize(3);
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) != s.End());
- UNIT_ASSERT(s.Find(3) != s.End());
-
- // And we should be able to add fit more entries
- s.Insert(4, "mnop");
- s.Insert(5, "qrst");
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) == s.End());
- UNIT_ASSERT(s.Find(3) != s.End());
- UNIT_ASSERT(s.Find(4) != s.End());
- UNIT_ASSERT(s.Find(5) != s.End());
-
- // Decreasing size should remove oldest entries
- s.SetMaxSize(2);
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) == s.End());
- UNIT_ASSERT(s.Find(3) != s.End());
- UNIT_ASSERT(s.Find(4) == s.End());
- UNIT_ASSERT(s.Find(5) != s.End());
-
- // Ano no more entries will fit
- s.Insert(6, "uvwx");
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) == s.End());
- UNIT_ASSERT(s.Find(3) != s.End());
- UNIT_ASSERT(s.Find(4) == s.End());
- UNIT_ASSERT(s.Find(5) == s.End());
- UNIT_ASSERT(s.Find(6) != s.End());
- }
-
+ Y_UNIT_TEST(LRUSetMaxSizeTest) {
+ typedef TLRUCache<int, TString> TCache;
+ TCache s(2); // size 2
+ s.Insert(1, "abcd");
+ s.Insert(2, "efgh");
+ s.Insert(3, "ijkl");
+ UNIT_ASSERT(s.GetOldest() == "efgh");
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) != s.End());
+ UNIT_ASSERT(s.Find(3) != s.End());
+
+ // Increasing size should not change anything
+ s.SetMaxSize(3);
+ UNIT_ASSERT(s.GetOldest() == "efgh");
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) != s.End());
+ UNIT_ASSERT(s.Find(3) != s.End());
+
+ // And we should be able to add fit more entries
+ s.Insert(4, "mnop");
+ s.Insert(5, "qrst");
+ UNIT_ASSERT(s.GetOldest() == "ijkl");
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) == s.End());
+ UNIT_ASSERT(s.Find(3) != s.End());
+ UNIT_ASSERT(s.Find(4) != s.End());
+ UNIT_ASSERT(s.Find(5) != s.End());
+
+ // Decreasing size should remove oldest entries
+ s.SetMaxSize(2);
+ UNIT_ASSERT(s.GetOldest() == "mnop");
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) == s.End());
+ UNIT_ASSERT(s.Find(3) == s.End());
+ UNIT_ASSERT(s.Find(4) != s.End());
+ UNIT_ASSERT(s.Find(5) != s.End());
+
+ // Ano no more entries will fit
+ s.Insert(6, "uvwx");
+ UNIT_ASSERT(s.GetOldest() == "qrst");
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) == s.End());
+ UNIT_ASSERT(s.Find(3) == s.End());
+ UNIT_ASSERT(s.Find(4) == s.End());
+ UNIT_ASSERT(s.Find(5) != s.End());
+ UNIT_ASSERT(s.Find(6) != s.End());
+ }
+
+ Y_UNIT_TEST(LWSetMaxSizeTest) {
+ typedef TLWCache<int, TString, size_t, TStrokaWeighter> TCache;
+ TCache s(2); // size 2
+ s.Insert(1, "a");
+ s.Insert(2, "aa");
+ s.Insert(3, "aaa");
+ UNIT_ASSERT(s.GetLightest() == "aa");
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) != s.End());
+ UNIT_ASSERT(s.Find(3) != s.End());
+
+ // Increasing size should not change anything
+ s.SetMaxSize(3);
+ UNIT_ASSERT(s.GetLightest() == "aa");
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) != s.End());
+ UNIT_ASSERT(s.Find(3) != s.End());
+
+ // And we should be able to add fit more entries
+ s.Insert(4, "aaaa");
+ s.Insert(5, "aaaaa");
+ UNIT_ASSERT(s.GetLightest() == "aaa");
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) == s.End());
+ UNIT_ASSERT(s.Find(3) != s.End());
+ UNIT_ASSERT(s.Find(4) != s.End());
+ UNIT_ASSERT(s.Find(5) != s.End());
+
+ // Decreasing size should remove oldest entries
+ s.SetMaxSize(2);
+ UNIT_ASSERT(s.GetLightest() == "aaaa");
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) == s.End());
+ UNIT_ASSERT(s.Find(3) == s.End());
+ UNIT_ASSERT(s.Find(4) != s.End());
+ UNIT_ASSERT(s.Find(5) != s.End());
+
+ // Ano no more entries will fit
+ s.Insert(6, "aaaaaa");
+ UNIT_ASSERT(s.GetLightest() == "aaaaa");
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) == s.End());
+ UNIT_ASSERT(s.Find(3) == s.End());
+ UNIT_ASSERT(s.Find(4) == s.End());
+ UNIT_ASSERT(s.Find(5) != s.End());
+ UNIT_ASSERT(s.Find(6) != s.End());
+ }
+
+ Y_UNIT_TEST(LFUSetMaxSizeTest) {
+ typedef TLFUCache<int, TString> TCache;
+ TCache s(2); // size 2
+ s.Insert(1, "abcd");
+ s.Insert(2, "efgh");
+ s.Insert(3, "ijkl");
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) != s.End());
+ UNIT_ASSERT(s.Find(3) != s.End());
+
+ // Increasing size should not change anything
+ s.SetMaxSize(3);
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) != s.End());
+ UNIT_ASSERT(s.Find(3) != s.End());
+
+ // And we should be able to add fit more entries
+ s.Insert(4, "mnop");
+ s.Insert(5, "qrst");
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) == s.End());
+ UNIT_ASSERT(s.Find(3) != s.End());
+ UNIT_ASSERT(s.Find(4) != s.End());
+ UNIT_ASSERT(s.Find(5) != s.End());
+
+ // Decreasing size should remove oldest entries
+ s.SetMaxSize(2);
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) == s.End());
+ UNIT_ASSERT(s.Find(3) != s.End());
+ UNIT_ASSERT(s.Find(4) == s.End());
+ UNIT_ASSERT(s.Find(5) != s.End());
+
+ // Ano no more entries will fit
+ s.Insert(6, "uvwx");
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) == s.End());
+ UNIT_ASSERT(s.Find(3) != s.End());
+ UNIT_ASSERT(s.Find(4) == s.End());
+ UNIT_ASSERT(s.Find(5) == s.End());
+ UNIT_ASSERT(s.Find(6) != s.End());
+ }
+
Y_UNIT_TEST(MultiCacheTest) {
typedef TLRUCache<int, TString> TCache;
TCache s(3, true);
diff --git a/library/cpp/coroutine/engine/impl.cpp b/library/cpp/coroutine/engine/impl.cpp
index 7ae6f74051..f8793e0b61 100644
--- a/library/cpp/coroutine/engine/impl.cpp
+++ b/library/cpp/coroutine/engine/impl.cpp
@@ -277,12 +277,12 @@ void TContExecutor::ScheduleExecutionNow(TCont* cont) noexcept {
}
namespace {
- inline TContExecutor*& ThisThreadExecutor() {
- struct TThisThreadExecutorHolder {
+ inline TContExecutor*& ThisThreadExecutor() {
+ struct TThisThreadExecutorHolder {
TContExecutor* Executor = nullptr;
- };
- return FastTlsSingletonWithPriority<TThisThreadExecutorHolder, 0>()->Executor;
- }
+ };
+ return FastTlsSingletonWithPriority<TThisThreadExecutorHolder, 0>()->Executor;
+ }
}
void TContExecutor::DeleteScheduled() noexcept {
@@ -292,14 +292,14 @@ void TContExecutor::DeleteScheduled() noexcept {
}
TCont* RunningCont() {
- TContExecutor* thisThreadExecutor = ThisThreadExecutor();
+ TContExecutor* thisThreadExecutor = ThisThreadExecutor();
return thisThreadExecutor ? thisThreadExecutor->Running() : nullptr;
}
void TContExecutor::RunScheduler() noexcept {
try {
TContExecutor* const prev = ThisThreadExecutor();
- ThisThreadExecutor() = this;
+ ThisThreadExecutor() = this;
TCont* caller = Current_;
TExceptionSafeContext* context = caller ? caller->Trampoline_.Context() : &SchedContext_;
Y_DEFER {
diff --git a/library/cpp/coroutine/engine/poller.cpp b/library/cpp/coroutine/engine/poller.cpp
index 61164fa56b..0c1258e3b1 100644
--- a/library/cpp/coroutine/engine/poller.cpp
+++ b/library/cpp/coroutine/engine/poller.cpp
@@ -356,7 +356,7 @@ namespace {
}
THolder<IPollerFace> IPollerFace::Default() {
- return Construct(*SingletonWithPriority<TUserPoller, 0>());
+ return Construct(*SingletonWithPriority<TUserPoller, 0>());
}
THolder<IPollerFace> IPollerFace::Construct(TStringBuf name) {
diff --git a/library/cpp/messagebus/acceptor.cpp b/library/cpp/messagebus/acceptor.cpp
index 64a38619c2..6669512b5b 100644
--- a/library/cpp/messagebus/acceptor.cpp
+++ b/library/cpp/messagebus/acceptor.cpp
@@ -1,13 +1,13 @@
-#include "acceptor.h"
+#include "acceptor.h"
#include "key_value_printer.h"
#include "mb_lwtrace.h"
-#include "network.h"
+#include "network.h"
-#include <util/network/init.h>
-#include <util/system/defaults.h>
-#include <util/system/error.h>
-#include <util/system/yassert.h>
+#include <util/network/init.h>
+#include <util/system/defaults.h>
+#include <util/system/error.h>
+#include <util/system/yassert.h>
LWTRACE_USING(LWTRACE_MESSAGEBUS_PROVIDER)
diff --git a/library/cpp/messagebus/acceptor.h b/library/cpp/messagebus/acceptor.h
index 57cb010bf2..0eeb162aea 100644
--- a/library/cpp/messagebus/acceptor.h
+++ b/library/cpp/messagebus/acceptor.h
@@ -1,16 +1,16 @@
#pragma once
-#include "acceptor_status.h"
-#include "defs.h"
+#include "acceptor_status.h"
+#include "defs.h"
#include "event_loop.h"
#include "netaddr.h"
#include "session_impl.h"
#include "shutdown_state.h"
#include <library/cpp/messagebus/actor/actor.h>
-
-#include <util/system/event.h>
-
+
+#include <util/system/event.h>
+
namespace NBus {
namespace NPrivate {
class TAcceptor
diff --git a/library/cpp/messagebus/acceptor_status.cpp b/library/cpp/messagebus/acceptor_status.cpp
index 5006ff68ae..6c481bfb6f 100644
--- a/library/cpp/messagebus/acceptor_status.cpp
+++ b/library/cpp/messagebus/acceptor_status.cpp
@@ -1,9 +1,9 @@
-#include "acceptor_status.h"
+#include "acceptor_status.h"
#include "key_value_printer.h"
-#include <util/stream/format.h>
-#include <util/stream/output.h>
+#include <util/stream/format.h>
+#include <util/stream/output.h>
using namespace NBus;
using namespace NBus::NPrivate;
diff --git a/library/cpp/messagebus/acceptor_status.h b/library/cpp/messagebus/acceptor_status.h
index 6aa1404f4d..c799eee6a7 100644
--- a/library/cpp/messagebus/acceptor_status.h
+++ b/library/cpp/messagebus/acceptor_status.h
@@ -1,7 +1,7 @@
#pragma once
-#include "netaddr.h"
-
+#include "netaddr.h"
+
#include <util/network/init.h>
namespace NBus {
diff --git a/library/cpp/messagebus/actor/actor.h b/library/cpp/messagebus/actor/actor.h
index 9b8f20298a..6d6b394a51 100644
--- a/library/cpp/messagebus/actor/actor.h
+++ b/library/cpp/messagebus/actor/actor.h
@@ -1,11 +1,11 @@
#pragma once
-#include "executor.h"
+#include "executor.h"
#include "tasks.h"
#include "what_thread_does.h"
-#include <util/system/yassert.h>
-
+#include <util/system/yassert.h>
+
namespace NActor {
class IActor: protected IWorkItem {
public:
diff --git a/library/cpp/messagebus/actor/actor_ut.cpp b/library/cpp/messagebus/actor/actor_ut.cpp
index b76ab55bfa..4329aabd77 100644
--- a/library/cpp/messagebus/actor/actor_ut.cpp
+++ b/library/cpp/messagebus/actor/actor_ut.cpp
@@ -4,10 +4,10 @@
#include "queue_in_actor.h"
#include <library/cpp/messagebus/misc/test_sync.h>
-
-#include <util/generic/object_counter.h>
-#include <util/system/event.h>
-
+
+#include <util/generic/object_counter.h>
+#include <util/system/event.h>
+
using namespace NActor;
template <typename TThis>
diff --git a/library/cpp/messagebus/actor/executor.cpp b/library/cpp/messagebus/actor/executor.cpp
index 7a2227a458..b6d33c7c0e 100644
--- a/library/cpp/messagebus/actor/executor.cpp
+++ b/library/cpp/messagebus/actor/executor.cpp
@@ -1,14 +1,14 @@
-#include "executor.h"
+#include "executor.h"
#include "thread_extra.h"
#include "what_thread_does.h"
#include "what_thread_does_guard.h"
-#include <util/generic/utility.h>
-#include <util/random/random.h>
-#include <util/stream/str.h>
-#include <util/system/tls.h>
-#include <util/system/yassert.h>
+#include <util/generic/utility.h>
+#include <util/random/random.h>
+#include <util/stream/str.h>
+#include <util/system/tls.h>
+#include <util/system/yassert.h>
#include <array>
diff --git a/library/cpp/messagebus/actor/executor.h b/library/cpp/messagebus/actor/executor.h
index 7292d8be53..538b2196f0 100644
--- a/library/cpp/messagebus/actor/executor.h
+++ b/library/cpp/messagebus/actor/executor.h
@@ -1,13 +1,13 @@
#pragma once
-#include "ring_buffer_with_spin_lock.h"
-
+#include "ring_buffer_with_spin_lock.h"
+
#include <util/generic/array_ref.h>
#include <util/generic/vector.h>
#include <util/system/condvar.h>
#include <util/system/event.h>
-#include <util/system/mutex.h>
-#include <util/system/thread.h>
+#include <util/system/mutex.h>
+#include <util/system/thread.h>
#include <util/thread/lfqueue.h>
namespace NActor {
diff --git a/library/cpp/messagebus/actor/queue_in_actor.h b/library/cpp/messagebus/actor/queue_in_actor.h
index 9865996532..df6b53557d 100644
--- a/library/cpp/messagebus/actor/queue_in_actor.h
+++ b/library/cpp/messagebus/actor/queue_in_actor.h
@@ -3,8 +3,8 @@
#include "actor.h"
#include "queue_for_actor.h"
-#include <functional>
-
+#include <functional>
+
namespace NActor {
template <typename TItem>
class IQueueInActor {
diff --git a/library/cpp/messagebus/actor/ring_buffer.h b/library/cpp/messagebus/actor/ring_buffer.h
index ec5706f7c7..6346756d85 100644
--- a/library/cpp/messagebus/actor/ring_buffer.h
+++ b/library/cpp/messagebus/actor/ring_buffer.h
@@ -1,9 +1,9 @@
#pragma once
-#include <util/generic/array_ref.h>
-#include <util/generic/maybe.h>
-#include <util/generic/utility.h>
-#include <util/generic/vector.h>
+#include <util/generic/array_ref.h>
+#include <util/generic/maybe.h>
+#include <util/generic/utility.h>
+#include <util/generic/vector.h>
#include <util/system/yassert.h>
template <typename T>
diff --git a/library/cpp/messagebus/actor/ring_buffer_ut.cpp b/library/cpp/messagebus/actor/ring_buffer_ut.cpp
index bdb379b3a9..b0dd1bb933 100644
--- a/library/cpp/messagebus/actor/ring_buffer_ut.cpp
+++ b/library/cpp/messagebus/actor/ring_buffer_ut.cpp
@@ -2,8 +2,8 @@
#include "ring_buffer.h"
-#include <util/random/random.h>
-
+#include <util/random/random.h>
+
Y_UNIT_TEST_SUITE(RingBuffer) {
struct TRingBufferTester {
TRingBuffer<unsigned> RingBuffer;
diff --git a/library/cpp/messagebus/actor/ring_buffer_with_spin_lock.h b/library/cpp/messagebus/actor/ring_buffer_with_spin_lock.h
index f0b7cd90e4..325d8bb397 100644
--- a/library/cpp/messagebus/actor/ring_buffer_with_spin_lock.h
+++ b/library/cpp/messagebus/actor/ring_buffer_with_spin_lock.h
@@ -1,7 +1,7 @@
#pragma once
-#include "ring_buffer.h"
-
+#include "ring_buffer.h"
+
#include <util/system/spinlock.h>
template <typename T>
diff --git a/library/cpp/messagebus/actor/tasks.h b/library/cpp/messagebus/actor/tasks.h
index 31d35931d2..9df0453931 100644
--- a/library/cpp/messagebus/actor/tasks.h
+++ b/library/cpp/messagebus/actor/tasks.h
@@ -1,6 +1,6 @@
#pragma once
-#include <util/system/atomic.h>
+#include <util/system/atomic.h>
#include <util/system/yassert.h>
namespace NActor {
diff --git a/library/cpp/messagebus/actor/temp_tls_vector.h b/library/cpp/messagebus/actor/temp_tls_vector.h
index 675d92f5b0..1860f544ff 100644
--- a/library/cpp/messagebus/actor/temp_tls_vector.h
+++ b/library/cpp/messagebus/actor/temp_tls_vector.h
@@ -1,8 +1,8 @@
#pragma once
-#include "thread_extra.h"
-
-#include <util/generic/vector.h>
+#include "thread_extra.h"
+
+#include <util/generic/vector.h>
#include <util/system/yassert.h>
template <typename T, typename TTag = void, template <typename, class> class TVectorType = TVector>
diff --git a/library/cpp/messagebus/actor/thread_extra.cpp b/library/cpp/messagebus/actor/thread_extra.cpp
index 048480f255..bce931ff1d 100644
--- a/library/cpp/messagebus/actor/thread_extra.cpp
+++ b/library/cpp/messagebus/actor/thread_extra.cpp
@@ -1,7 +1,7 @@
-#include "thread_extra.h"
-
-#include <util/stream/str.h>
-#include <util/system/execpath.h>
+#include "thread_extra.h"
+
+#include <util/stream/str.h>
+#include <util/system/execpath.h>
#include <util/system/platform.h>
#include <util/system/thread.h>
diff --git a/library/cpp/messagebus/actor/what_thread_does.cpp b/library/cpp/messagebus/actor/what_thread_does.cpp
index bebb6a888c..bda58de407 100644
--- a/library/cpp/messagebus/actor/what_thread_does.cpp
+++ b/library/cpp/messagebus/actor/what_thread_does.cpp
@@ -1,9 +1,9 @@
-#include "what_thread_does.h"
+#include "what_thread_does.h"
#include "thread_extra.h"
-#include <util/system/tls.h>
-
+#include <util/system/tls.h>
+
Y_POD_STATIC_THREAD(const char*)
WhatThreadDoes;
diff --git a/library/cpp/messagebus/actor/what_thread_does_guard_ut.cpp b/library/cpp/messagebus/actor/what_thread_does_guard_ut.cpp
index e4b218a7ca..12efbfc89e 100644
--- a/library/cpp/messagebus/actor/what_thread_does_guard_ut.cpp
+++ b/library/cpp/messagebus/actor/what_thread_does_guard_ut.cpp
@@ -2,8 +2,8 @@
#include "what_thread_does_guard.h"
-#include <util/system/mutex.h>
-
+#include <util/system/mutex.h>
+
Y_UNIT_TEST_SUITE(WhatThreadDoesGuard) {
Y_UNIT_TEST(Simple) {
TMutex mutex;
diff --git a/library/cpp/messagebus/async_result.h b/library/cpp/messagebus/async_result.h
index d24dde284a..dc7281e02f 100644
--- a/library/cpp/messagebus/async_result.h
+++ b/library/cpp/messagebus/async_result.h
@@ -2,9 +2,9 @@
#include <util/generic/maybe.h>
#include <util/generic/noncopyable.h>
-#include <util/system/condvar.h>
-#include <util/system/mutex.h>
-#include <util/system/yassert.h>
+#include <util/system/condvar.h>
+#include <util/system/mutex.h>
+#include <util/system/yassert.h>
#include <functional>
diff --git a/library/cpp/messagebus/cc_semaphore_ut.cpp b/library/cpp/messagebus/cc_semaphore_ut.cpp
index 206bb7c96a..b534dbde7b 100644
--- a/library/cpp/messagebus/cc_semaphore_ut.cpp
+++ b/library/cpp/messagebus/cc_semaphore_ut.cpp
@@ -2,8 +2,8 @@
#include "cc_semaphore.h"
-#include <util/system/atomic.h>
-
+#include <util/system/atomic.h>
+
namespace {
struct TTestSemaphore: public TComplexConditionSemaphore<TTestSemaphore> {
TAtomic Current;
diff --git a/library/cpp/messagebus/config/defs.h b/library/cpp/messagebus/config/defs.h
index 92b1df9969..c27ea26b77 100644
--- a/library/cpp/messagebus/config/defs.h
+++ b/library/cpp/messagebus/config/defs.h
@@ -2,13 +2,13 @@
// unique tag to fix pragma once gcc glueing: ./library/cpp/messagebus/defs.h
-#include "codegen.h"
-#include "netaddr.h"
-
+#include "codegen.h"
+#include "netaddr.h"
+
#include <library/cpp/deprecated/enum_codegen/enum_codegen.h>
-
+
#include <util/generic/list.h>
-
+
#include <utility>
// For historical reasons TCrawlerModule need to access
diff --git a/library/cpp/messagebus/config/netaddr.cpp b/library/cpp/messagebus/config/netaddr.cpp
index 962ac538e2..4e189ccfde 100644
--- a/library/cpp/messagebus/config/netaddr.cpp
+++ b/library/cpp/messagebus/config/netaddr.cpp
@@ -1,5 +1,5 @@
-#include "netaddr.h"
-
+#include "netaddr.h"
+
#include <util/network/address.h>
#include <cstdlib>
diff --git a/library/cpp/messagebus/config/netaddr.h b/library/cpp/messagebus/config/netaddr.h
index b79c0cc355..2d43cc014b 100644
--- a/library/cpp/messagebus/config/netaddr.h
+++ b/library/cpp/messagebus/config/netaddr.h
@@ -3,7 +3,7 @@
#include <util/digest/numeric.h>
#include <util/generic/hash.h>
#include <util/generic/ptr.h>
-#include <util/generic/strbuf.h>
+#include <util/generic/strbuf.h>
#include <util/generic/vector.h>
#include <util/network/address.h>
diff --git a/library/cpp/messagebus/connection.cpp b/library/cpp/messagebus/connection.cpp
index 07580ce18a..9b6796d36b 100644
--- a/library/cpp/messagebus/connection.cpp
+++ b/library/cpp/messagebus/connection.cpp
@@ -1,8 +1,8 @@
-#include "connection.h"
+#include "connection.h"
#include "remote_client_connection.h"
-#include <util/generic/cast.h>
+#include <util/generic/cast.h>
using namespace NBus;
using namespace NBus::NPrivate;
diff --git a/library/cpp/messagebus/connection.h b/library/cpp/messagebus/connection.h
index b1df64ddc1..ae2107b251 100644
--- a/library/cpp/messagebus/connection.h
+++ b/library/cpp/messagebus/connection.h
@@ -3,8 +3,8 @@
#include "defs.h"
#include "message.h"
-#include <util/generic/ptr.h>
-
+#include <util/generic/ptr.h>
+
namespace NBus {
struct TBusClientConnection {
/// if you want to open connection early
diff --git a/library/cpp/messagebus/coreconn.cpp b/library/cpp/messagebus/coreconn.cpp
index d9411bb5db..470b8fa102 100644
--- a/library/cpp/messagebus/coreconn.cpp
+++ b/library/cpp/messagebus/coreconn.cpp
@@ -1,5 +1,5 @@
#include "coreconn.h"
-
+
#include "remote_connection.h"
#include <util/datetime/base.h>
diff --git a/library/cpp/messagebus/coreconn.h b/library/cpp/messagebus/coreconn.h
index fca228d82e..ddc783aa9d 100644
--- a/library/cpp/messagebus/coreconn.h
+++ b/library/cpp/messagebus/coreconn.h
@@ -25,7 +25,7 @@
#include <util/thread/lfqueue.h>
#include <deque>
-#include <utility>
+#include <utility>
#ifdef NO_ERROR
#undef NO_ERROR
diff --git a/library/cpp/messagebus/coreconn_ut.cpp b/library/cpp/messagebus/coreconn_ut.cpp
index beb6850f26..87ef125bd8 100644
--- a/library/cpp/messagebus/coreconn_ut.cpp
+++ b/library/cpp/messagebus/coreconn_ut.cpp
@@ -1,5 +1,5 @@
#include <library/cpp/testing/unittest/registar.h>
-
+
#include "coreconn.h"
#include <util/generic/yexception.h>
diff --git a/library/cpp/messagebus/debug_receiver/debug_receiver_handler.cpp b/library/cpp/messagebus/debug_receiver/debug_receiver_handler.cpp
index 05f99e94ca..131476182c 100644
--- a/library/cpp/messagebus/debug_receiver/debug_receiver_handler.cpp
+++ b/library/cpp/messagebus/debug_receiver/debug_receiver_handler.cpp
@@ -1,9 +1,9 @@
-#include "debug_receiver_handler.h"
+#include "debug_receiver_handler.h"
#include "debug_receiver_proto.h"
-#include <util/generic/cast.h>
-#include <util/string/printf.h>
+#include <util/generic/cast.h>
+#include <util/string/printf.h>
void TDebugReceiverHandler::OnError(TAutoPtr<NBus::TBusMessage>, NBus::EMessageStatus status) {
Cerr << "error " << status << "\n";
diff --git a/library/cpp/messagebus/duration_histogram.cpp b/library/cpp/messagebus/duration_histogram.cpp
index 32a0001d41..ebefee7918 100644
--- a/library/cpp/messagebus/duration_histogram.cpp
+++ b/library/cpp/messagebus/duration_histogram.cpp
@@ -1,6 +1,6 @@
-#include "duration_histogram.h"
-
-#include <util/generic/singleton.h>
+#include "duration_histogram.h"
+
+#include <util/generic/singleton.h>
#include <util/stream/str.h>
namespace {
diff --git a/library/cpp/messagebus/duration_histogram.h b/library/cpp/messagebus/duration_histogram.h
index ed060b0101..93a5c5d992 100644
--- a/library/cpp/messagebus/duration_histogram.h
+++ b/library/cpp/messagebus/duration_histogram.h
@@ -1,7 +1,7 @@
#pragma once
#include <util/datetime/base.h>
-#include <util/generic/bitops.h>
+#include <util/generic/bitops.h>
#include <util/generic/string.h>
#include <array>
diff --git a/library/cpp/messagebus/event_loop.cpp b/library/cpp/messagebus/event_loop.cpp
index f685135bed..f8462cc8d4 100644
--- a/library/cpp/messagebus/event_loop.cpp
+++ b/library/cpp/messagebus/event_loop.cpp
@@ -1,18 +1,18 @@
-#include "event_loop.h"
+#include "event_loop.h"
-#include "network.h"
+#include "network.h"
#include "thread_extra.h"
#include <util/generic/hash.h>
#include <util/network/pair.h>
#include <util/network/poller.h>
-#include <util/system/event.h>
-#include <util/system/mutex.h>
+#include <util/system/event.h>
+#include <util/system/mutex.h>
#include <util/system/thread.h>
#include <util/system/yassert.h>
#include <util/thread/lfqueue.h>
-#include <errno.h>
+#include <errno.h>
using namespace NEventLoop;
diff --git a/library/cpp/messagebus/event_loop.h b/library/cpp/messagebus/event_loop.h
index d5b0a53b0c..6fc2c1837b 100644
--- a/library/cpp/messagebus/event_loop.h
+++ b/library/cpp/messagebus/event_loop.h
@@ -1,6 +1,6 @@
#pragma once
-#include <util/generic/object_counter.h>
+#include <util/generic/object_counter.h>
#include <util/generic/ptr.h>
#include <util/network/init.h>
#include <util/network/socket.h>
diff --git a/library/cpp/messagebus/futex_like.h b/library/cpp/messagebus/futex_like.h
index 31d60c60f1..5171806e74 100644
--- a/library/cpp/messagebus/futex_like.h
+++ b/library/cpp/messagebus/futex_like.h
@@ -1,7 +1,7 @@
#pragma once
-#include <util/system/condvar.h>
-#include <util/system/mutex.h>
+#include <util/system/condvar.h>
+#include <util/system/mutex.h>
#include <util/system/platform.h>
class TFutexLike {
diff --git a/library/cpp/messagebus/handler.cpp b/library/cpp/messagebus/handler.cpp
index 333bd52934..1cef09d63d 100644
--- a/library/cpp/messagebus/handler.cpp
+++ b/library/cpp/messagebus/handler.cpp
@@ -1,6 +1,6 @@
#include "handler.h"
-
-#include "remote_server_connection.h"
+
+#include "remote_server_connection.h"
#include "ybus.h"
using namespace NBus;
diff --git a/library/cpp/messagebus/handler.h b/library/cpp/messagebus/handler.h
index 60002c68a6..3c8496d6a3 100644
--- a/library/cpp/messagebus/handler.h
+++ b/library/cpp/messagebus/handler.h
@@ -1,13 +1,13 @@
#pragma once
#include "defs.h"
-#include "message.h"
+#include "message.h"
#include "message_status.h"
#include "use_after_free_checker.h"
#include "use_count_checker.h"
-#include <util/generic/noncopyable.h>
-
+#include <util/generic/noncopyable.h>
+
namespace NBus {
/////////////////////////////////////////////////////////////////
/// \brief Interface to message bus handler
diff --git a/library/cpp/messagebus/handler_impl.h b/library/cpp/messagebus/handler_impl.h
index 6593f04cc3..70fb02e575 100644
--- a/library/cpp/messagebus/handler_impl.h
+++ b/library/cpp/messagebus/handler_impl.h
@@ -1,7 +1,7 @@
#pragma once
-#include "handler.h"
-#include "local_flags.h"
+#include "handler.h"
+#include "local_flags.h"
#include "session.h"
namespace NBus {
diff --git a/library/cpp/messagebus/key_value_printer.cpp b/library/cpp/messagebus/key_value_printer.cpp
index c8592145c7..5c2567e495 100644
--- a/library/cpp/messagebus/key_value_printer.cpp
+++ b/library/cpp/messagebus/key_value_printer.cpp
@@ -1,5 +1,5 @@
-#include "key_value_printer.h"
-
+#include "key_value_printer.h"
+
#include <util/stream/format.h>
TKeyValuePrinter::TKeyValuePrinter(const TString& sep)
diff --git a/library/cpp/messagebus/key_value_printer.h b/library/cpp/messagebus/key_value_printer.h
index bca1fde50e..6ee63a30fa 100644
--- a/library/cpp/messagebus/key_value_printer.h
+++ b/library/cpp/messagebus/key_value_printer.h
@@ -2,8 +2,8 @@
#include <util/generic/string.h>
#include <util/generic/typetraits.h>
-#include <util/generic/vector.h>
-#include <util/string/cast.h>
+#include <util/generic/vector.h>
+#include <util/string/cast.h>
class TKeyValuePrinter {
private:
diff --git a/library/cpp/messagebus/latch.h b/library/cpp/messagebus/latch.h
index 373f4c0e13..7e01f2d035 100644
--- a/library/cpp/messagebus/latch.h
+++ b/library/cpp/messagebus/latch.h
@@ -1,6 +1,6 @@
#pragma once
-#include <util/system/condvar.h>
+#include <util/system/condvar.h>
#include <util/system/mutex.h>
class TLatch {
diff --git a/library/cpp/messagebus/left_right_buffer.h b/library/cpp/messagebus/left_right_buffer.h
index f937cefad0..fc92d6917c 100644
--- a/library/cpp/messagebus/left_right_buffer.h
+++ b/library/cpp/messagebus/left_right_buffer.h
@@ -1,7 +1,7 @@
#pragma once
-#include <util/generic/buffer.h>
-#include <util/generic/noncopyable.h>
+#include <util/generic/buffer.h>
+#include <util/generic/noncopyable.h>
#include <util/system/yassert.h>
namespace NBus {
diff --git a/library/cpp/messagebus/lfqueue_batch.h b/library/cpp/messagebus/lfqueue_batch.h
index 8128d3154d..aa67b6ae40 100644
--- a/library/cpp/messagebus/lfqueue_batch.h
+++ b/library/cpp/messagebus/lfqueue_batch.h
@@ -1,7 +1,7 @@
#pragma once
#include <library/cpp/messagebus/actor/temp_tls_vector.h>
-
+
#include <util/generic/vector.h>
#include <util/thread/lfstack.h>
diff --git a/library/cpp/messagebus/local_flags.cpp b/library/cpp/messagebus/local_flags.cpp
index 877e533f76..ad0a30e232 100644
--- a/library/cpp/messagebus/local_flags.cpp
+++ b/library/cpp/messagebus/local_flags.cpp
@@ -1,6 +1,6 @@
-#include "local_flags.h"
-
-#include <util/stream/str.h>
+#include "local_flags.h"
+
+#include <util/stream/str.h>
#include <util/string/printf.h>
using namespace NBus;
diff --git a/library/cpp/messagebus/local_flags.h b/library/cpp/messagebus/local_flags.h
index f589283188..fc3f126443 100644
--- a/library/cpp/messagebus/local_flags.h
+++ b/library/cpp/messagebus/local_flags.h
@@ -1,7 +1,7 @@
#pragma once
#include <library/cpp/deprecated/enum_codegen/enum_codegen.h>
-
+
#include <util/generic/string.h>
#include <util/stream/output.h>
diff --git a/library/cpp/messagebus/locator.cpp b/library/cpp/messagebus/locator.cpp
index e38a35c426..7ca49fda3f 100644
--- a/library/cpp/messagebus/locator.cpp
+++ b/library/cpp/messagebus/locator.cpp
@@ -4,8 +4,8 @@
#include "locator.h"
-#include "ybus.h"
-
+#include "ybus.h"
+
#include <util/generic/hash_set.h>
#include <util/system/hostname.h>
diff --git a/library/cpp/messagebus/locator.h b/library/cpp/messagebus/locator.h
index f8556a3fce..39ca346748 100644
--- a/library/cpp/messagebus/locator.h
+++ b/library/cpp/messagebus/locator.h
@@ -1,13 +1,13 @@
#pragma once
-#include "defs.h"
-
+#include "defs.h"
+
#include <util/generic/hash.h>
-#include <util/generic/map.h>
-#include <util/generic/set.h>
-#include <util/generic/string.h>
+#include <util/generic/map.h>
+#include <util/generic/set.h>
+#include <util/generic/string.h>
#include <util/network/interface.h>
-#include <util/system/mutex.h>
+#include <util/system/mutex.h>
namespace NBus {
///////////////////////////////////////////////
diff --git a/library/cpp/messagebus/mb_lwtrace.cpp b/library/cpp/messagebus/mb_lwtrace.cpp
index c54cd5ab71..1bd0096654 100644
--- a/library/cpp/messagebus/mb_lwtrace.cpp
+++ b/library/cpp/messagebus/mb_lwtrace.cpp
@@ -1,8 +1,8 @@
-#include "mb_lwtrace.h"
+#include "mb_lwtrace.h"
#include <library/cpp/lwtrace/all.h>
-#include <util/generic/singleton.h>
+#include <util/generic/singleton.h>
LWTRACE_DEFINE_PROVIDER(LWTRACE_MESSAGEBUS_PROVIDER)
diff --git a/library/cpp/messagebus/mb_lwtrace.h b/library/cpp/messagebus/mb_lwtrace.h
index e62728b265..465e630c4b 100644
--- a/library/cpp/messagebus/mb_lwtrace.h
+++ b/library/cpp/messagebus/mb_lwtrace.h
@@ -2,8 +2,8 @@
#include <library/cpp/lwtrace/all.h>
-#include <util/generic/string.h>
-
+#include <util/generic/string.h>
+
#define LWTRACE_MESSAGEBUS_PROVIDER(PROBE, EVENT, GROUPS, TYPES, NAMES) \
PROBE(Error, GROUPS("MessagebusRare"), TYPES(TString, TString, TString), NAMES("status", "address", "misc")) \
PROBE(ServerUnknownVersion, GROUPS("MessagebusRare"), TYPES(TString, ui32), NAMES("address", "version")) \
diff --git a/library/cpp/messagebus/message.cpp b/library/cpp/messagebus/message.cpp
index bfa7ed8e9b..01e3b5440b 100644
--- a/library/cpp/messagebus/message.cpp
+++ b/library/cpp/messagebus/message.cpp
@@ -1,11 +1,11 @@
-#include "remote_server_connection.h"
-#include "ybus.h"
+#include "remote_server_connection.h"
+#include "ybus.h"
-#include <util/random/random.h>
-#include <util/string/printf.h>
+#include <util/random/random.h>
+#include <util/string/printf.h>
#include <util/system/atomic.h>
-#include <string.h>
+#include <string.h>
using namespace NBus;
diff --git a/library/cpp/messagebus/message.h b/library/cpp/messagebus/message.h
index 005ca10c65..783cbeeb94 100644
--- a/library/cpp/messagebus/message.h
+++ b/library/cpp/messagebus/message.h
@@ -1,16 +1,16 @@
#pragma once
-#include "base.h"
-#include "local_flags.h"
-#include "message_status.h"
-#include "netaddr.h"
-#include "socket_addr.h"
-
-#include <util/generic/array_ref.h>
-#include <util/generic/noncopyable.h>
+#include "base.h"
+#include "local_flags.h"
+#include "message_status.h"
+#include "netaddr.h"
+#include "socket_addr.h"
+
+#include <util/generic/array_ref.h>
+#include <util/generic/noncopyable.h>
#include <util/generic/ptr.h>
#include <util/generic/string.h>
-#include <util/system/defaults.h>
+#include <util/system/defaults.h>
#include <util/system/type_name.h>
#include <util/system/yassert.h>
diff --git a/library/cpp/messagebus/message_counter.cpp b/library/cpp/messagebus/message_counter.cpp
index 04d9343f6a..29f567b355 100644
--- a/library/cpp/messagebus/message_counter.cpp
+++ b/library/cpp/messagebus/message_counter.cpp
@@ -1,5 +1,5 @@
-#include "message_counter.h"
-
+#include "message_counter.h"
+
#include <util/stream/str.h>
using namespace NBus;
diff --git a/library/cpp/messagebus/message_counter.h b/library/cpp/messagebus/message_counter.h
index e4be1180b0..0a1e094824 100644
--- a/library/cpp/messagebus/message_counter.h
+++ b/library/cpp/messagebus/message_counter.h
@@ -1,9 +1,9 @@
#pragma once
-#include <util/generic/string.h>
-
-#include <cstddef>
-
+#include <util/generic/string.h>
+
+#include <cstddef>
+
namespace NBus {
namespace NPrivate {
struct TMessageCounter {
diff --git a/library/cpp/messagebus/message_ptr_and_header.h b/library/cpp/messagebus/message_ptr_and_header.h
index 9b4e2fd270..dea9af70a5 100644
--- a/library/cpp/messagebus/message_ptr_and_header.h
+++ b/library/cpp/messagebus/message_ptr_and_header.h
@@ -1,10 +1,10 @@
#pragma once
-#include "message.h"
+#include "message.h"
#include "nondestroying_holder.h"
-#include <util/generic/noncopyable.h>
-#include <util/generic/utility.h>
+#include <util/generic/noncopyable.h>
+#include <util/generic/utility.h>
namespace NBus {
namespace NPrivate {
diff --git a/library/cpp/messagebus/message_status.h b/library/cpp/messagebus/message_status.h
index e1878960b3..cf9816be1a 100644
--- a/library/cpp/messagebus/message_status.h
+++ b/library/cpp/messagebus/message_status.h
@@ -1,8 +1,8 @@
#pragma once
-#include "codegen.h"
-#include "defs.h"
-
+#include "codegen.h"
+#include "defs.h"
+
#include <library/cpp/deprecated/enum_codegen/enum_codegen.h>
namespace NBus {
diff --git a/library/cpp/messagebus/message_status_counter.cpp b/library/cpp/messagebus/message_status_counter.cpp
index 891c8f5bb2..d69ba3fdcb 100644
--- a/library/cpp/messagebus/message_status_counter.cpp
+++ b/library/cpp/messagebus/message_status_counter.cpp
@@ -1,5 +1,5 @@
-#include "message_status_counter.h"
-
+#include "message_status_counter.h"
+
#include "key_value_printer.h"
#include "text_utils.h"
diff --git a/library/cpp/messagebus/message_status_counter.h b/library/cpp/messagebus/message_status_counter.h
index e8ba2fdd31..b3be955ab5 100644
--- a/library/cpp/messagebus/message_status_counter.h
+++ b/library/cpp/messagebus/message_status_counter.h
@@ -1,7 +1,7 @@
#pragma once
-#include "message_status.h"
-
+#include "message_status.h"
+
#include <library/cpp/messagebus/monitoring/mon_proto.pb.h>
#include <util/generic/string.h>
diff --git a/library/cpp/messagebus/message_status_counter_ut.cpp b/library/cpp/messagebus/message_status_counter_ut.cpp
index 9598651329..eb6923f1bb 100644
--- a/library/cpp/messagebus/message_status_counter_ut.cpp
+++ b/library/cpp/messagebus/message_status_counter_ut.cpp
@@ -1,7 +1,7 @@
#include <library/cpp/testing/unittest/registar.h>
-#include "message_status_counter.h"
-
+#include "message_status_counter.h"
+
#include <library/cpp/messagebus/monitoring/mon_proto.pb.h>
using namespace NBus;
diff --git a/library/cpp/messagebus/messqueue.cpp b/library/cpp/messagebus/messqueue.cpp
index 3474d62705..5f9bae04e8 100644
--- a/library/cpp/messagebus/messqueue.cpp
+++ b/library/cpp/messagebus/messqueue.cpp
@@ -1,11 +1,11 @@
-#include "key_value_printer.h"
-#include "mb_lwtrace.h"
+#include "key_value_printer.h"
+#include "mb_lwtrace.h"
#include "remote_client_session.h"
#include "remote_server_session.h"
-#include "ybus.h"
-
-#include <util/generic/singleton.h>
+#include "ybus.h"
+#include <util/generic/singleton.h>
+
using namespace NBus;
using namespace NBus::NPrivate;
using namespace NActor;
diff --git a/library/cpp/messagebus/misc/atomic_box.h b/library/cpp/messagebus/misc/atomic_box.h
index 401621f933..ac4a602cc1 100644
--- a/library/cpp/messagebus/misc/atomic_box.h
+++ b/library/cpp/messagebus/misc/atomic_box.h
@@ -1,7 +1,7 @@
#pragma once
-#include <util/system/atomic.h>
-
+#include <util/system/atomic.h>
+
// TAtomic with human interface
template <typename T>
class TAtomicBox {
diff --git a/library/cpp/messagebus/misc/granup.h b/library/cpp/messagebus/misc/granup.h
index 36ecfebc93..ec8648711f 100644
--- a/library/cpp/messagebus/misc/granup.h
+++ b/library/cpp/messagebus/misc/granup.h
@@ -1,7 +1,7 @@
#pragma once
-#include <util/datetime/base.h>
-#include <util/system/guard.h>
+#include <util/datetime/base.h>
+#include <util/system/guard.h>
#include <util/system/mutex.h>
#include <util/system/spinlock.h>
diff --git a/library/cpp/messagebus/misc/test_sync.h b/library/cpp/messagebus/misc/test_sync.h
index be3f4f20b8..2752f79ac9 100644
--- a/library/cpp/messagebus/misc/test_sync.h
+++ b/library/cpp/messagebus/misc/test_sync.h
@@ -1,6 +1,6 @@
#pragma once
-#include <util/system/condvar.h>
+#include <util/system/condvar.h>
#include <util/system/mutex.h>
class TTestSync {
diff --git a/library/cpp/messagebus/network.cpp b/library/cpp/messagebus/network.cpp
index 304bedae5a..6554d160d7 100644
--- a/library/cpp/messagebus/network.cpp
+++ b/library/cpp/messagebus/network.cpp
@@ -1,10 +1,10 @@
#include "network.h"
-#include <util/generic/maybe.h>
-#include <util/generic/ptr.h>
+#include <util/generic/maybe.h>
+#include <util/generic/ptr.h>
#include <util/network/init.h>
#include <util/network/socket.h>
-#include <util/system/platform.h>
+#include <util/system/platform.h>
using namespace NBus;
using namespace NBus::NPrivate;
diff --git a/library/cpp/messagebus/network.h b/library/cpp/messagebus/network.h
index cc4bd76ea3..a3a8b6e7e6 100644
--- a/library/cpp/messagebus/network.h
+++ b/library/cpp/messagebus/network.h
@@ -1,12 +1,12 @@
#pragma once
-#include "netaddr.h"
+#include "netaddr.h"
#include <util/generic/array_ref.h>
-#include <util/generic/ptr.h>
+#include <util/generic/ptr.h>
#include <util/network/socket.h>
-#include <utility>
+#include <utility>
namespace NBus {
namespace NPrivate {
diff --git a/library/cpp/messagebus/network_ut.cpp b/library/cpp/messagebus/network_ut.cpp
index f1798419db..9fe8dc7620 100644
--- a/library/cpp/messagebus/network_ut.cpp
+++ b/library/cpp/messagebus/network_ut.cpp
@@ -3,7 +3,7 @@
#include "network.h"
#include <library/cpp/messagebus/test/helper/fixed_port.h>
-
+
using namespace NBus;
using namespace NBus::NPrivate;
using namespace NBus::NTest;
diff --git a/library/cpp/messagebus/oldmodule/module.cpp b/library/cpp/messagebus/oldmodule/module.cpp
index 24bd778799..6b8ec2b2a6 100644
--- a/library/cpp/messagebus/oldmodule/module.cpp
+++ b/library/cpp/messagebus/oldmodule/module.cpp
@@ -6,9 +6,9 @@
#include <library/cpp/messagebus/actor/queue_in_actor.h>
#include <library/cpp/messagebus/actor/what_thread_does.h>
#include <library/cpp/messagebus/actor/what_thread_does_guard.h>
-
-#include <util/generic/singleton.h>
-#include <util/string/printf.h>
+
+#include <util/generic/singleton.h>
+#include <util/string/printf.h>
#include <util/system/event.h>
using namespace NActor;
diff --git a/library/cpp/messagebus/oldmodule/module.h b/library/cpp/messagebus/oldmodule/module.h
index 8d1c4a5d52..df79bfcbd9 100644
--- a/library/cpp/messagebus/oldmodule/module.h
+++ b/library/cpp/messagebus/oldmodule/module.h
@@ -39,13 +39,13 @@
/// for a later time. This should be done in case NBus::TBusJob::Send() returns
/// error (not MESSAGE_OK)
-#include "startsession.h"
+#include "startsession.h"
#include <library/cpp/messagebus/ybus.h>
-#include <util/generic/noncopyable.h>
-#include <util/generic/object_counter.h>
-
+#include <util/generic/noncopyable.h>
+#include <util/generic/object_counter.h>
+
namespace NBus {
class TBusJob;
class TBusModule;
diff --git a/library/cpp/messagebus/oldmodule/startsession.cpp b/library/cpp/messagebus/oldmodule/startsession.cpp
index 7c38801d62..787952affe 100644
--- a/library/cpp/messagebus/oldmodule/startsession.cpp
+++ b/library/cpp/messagebus/oldmodule/startsession.cpp
@@ -14,10 +14,10 @@
#include "startsession.h"
-#include "module.h"
-
+#include "module.h"
+
#include <library/cpp/messagebus/ybus.h>
-
+
namespace NBus {
void* TBusStarter::_starter(void* data) {
TBusStarter* pThis = static_cast<TBusStarter*>(data);
diff --git a/library/cpp/messagebus/oldmodule/startsession.h b/library/cpp/messagebus/oldmodule/startsession.h
index 5e26e7e1e5..87c2f47982 100644
--- a/library/cpp/messagebus/oldmodule/startsession.h
+++ b/library/cpp/messagebus/oldmodule/startsession.h
@@ -1,7 +1,7 @@
#pragma once
#include <library/cpp/messagebus/ybus.h>
-
+
#include <util/system/thread.h>
namespace NBus {
diff --git a/library/cpp/messagebus/protobuf/ybusbuf.cpp b/library/cpp/messagebus/protobuf/ybusbuf.cpp
index 63415b3737..4d1433164e 100644
--- a/library/cpp/messagebus/protobuf/ybusbuf.cpp
+++ b/library/cpp/messagebus/protobuf/ybusbuf.cpp
@@ -1,7 +1,7 @@
-#include "ybusbuf.h"
+#include "ybusbuf.h"
#include <library/cpp/messagebus/actor/what_thread_does.h>
-
+
#include <google/protobuf/io/coded_stream.h>
using namespace NBus;
diff --git a/library/cpp/messagebus/protobuf/ybusbuf.h b/library/cpp/messagebus/protobuf/ybusbuf.h
index 57b4267ea5..48f2f0ebc9 100644
--- a/library/cpp/messagebus/protobuf/ybusbuf.h
+++ b/library/cpp/messagebus/protobuf/ybusbuf.h
@@ -5,9 +5,9 @@
#include <google/protobuf/descriptor.h>
#include <google/protobuf/message.h>
-#include <util/generic/cast.h>
-#include <util/generic/vector.h>
-#include <util/stream/mem.h>
+#include <util/generic/cast.h>
+#include <util/generic/vector.h>
+#include <util/stream/mem.h>
#include <array>
diff --git a/library/cpp/messagebus/rain_check/core/coro.cpp b/library/cpp/messagebus/rain_check/core/coro.cpp
index 500841dd5b..a133fe8a9f 100644
--- a/library/cpp/messagebus/rain_check/core/coro.cpp
+++ b/library/cpp/messagebus/rain_check/core/coro.cpp
@@ -1,9 +1,9 @@
-#include "coro.h"
+#include "coro.h"
#include "coro_stack.h"
-#include <util/system/tls.h>
-#include <util/system/yassert.h>
+#include <util/system/tls.h>
+#include <util/system/yassert.h>
using namespace NRainCheck;
diff --git a/library/cpp/messagebus/rain_check/core/coro_stack.cpp b/library/cpp/messagebus/rain_check/core/coro_stack.cpp
index 83b984ca6e..31e820b030 100644
--- a/library/cpp/messagebus/rain_check/core/coro_stack.cpp
+++ b/library/cpp/messagebus/rain_check/core/coro_stack.cpp
@@ -1,10 +1,10 @@
-#include "coro_stack.h"
+#include "coro_stack.h"
#include <util/generic/singleton.h>
#include <util/system/valgrind.h>
#include <cstdlib>
-#include <stdio.h>
+#include <stdio.h>
using namespace NRainCheck;
using namespace NRainCheck::NPrivate;
diff --git a/library/cpp/messagebus/rain_check/core/coro_ut.cpp b/library/cpp/messagebus/rain_check/core/coro_ut.cpp
index 61a33584a5..26e2d00724 100644
--- a/library/cpp/messagebus/rain_check/core/coro_ut.cpp
+++ b/library/cpp/messagebus/rain_check/core/coro_ut.cpp
@@ -1,6 +1,6 @@
#include <library/cpp/testing/unittest/registar.h>
-#include "coro.h"
+#include "coro.h"
#include "spawn.h"
#include <library/cpp/messagebus/rain_check/test/ut/test.h>
diff --git a/library/cpp/messagebus/rain_check/core/env.h b/library/cpp/messagebus/rain_check/core/env.h
index f6dd7fceb6..a8bcecd18c 100644
--- a/library/cpp/messagebus/rain_check/core/env.h
+++ b/library/cpp/messagebus/rain_check/core/env.h
@@ -1,11 +1,11 @@
#pragma once
-#include "sleep.h"
-#include "spawn.h"
+#include "sleep.h"
+#include "spawn.h"
#include <library/cpp/messagebus/actor/executor.h>
-#include <util/generic/ptr.h>
+#include <util/generic/ptr.h>
namespace NRainCheck {
struct IEnv {
diff --git a/library/cpp/messagebus/rain_check/core/rain_check.h b/library/cpp/messagebus/rain_check/core/rain_check.h
index 0f289717a2..cd651a390f 100644
--- a/library/cpp/messagebus/rain_check/core/rain_check.h
+++ b/library/cpp/messagebus/rain_check/core/rain_check.h
@@ -1,8 +1,8 @@
#pragma once
#include "coro.h"
-#include "env.h"
+#include "env.h"
#include "simple.h"
#include "sleep.h"
#include "spawn.h"
-#include "task.h"
+#include "task.h"
diff --git a/library/cpp/messagebus/rain_check/core/simple_ut.cpp b/library/cpp/messagebus/rain_check/core/simple_ut.cpp
index d4545e05aa..df0fa14379 100644
--- a/library/cpp/messagebus/rain_check/core/simple_ut.cpp
+++ b/library/cpp/messagebus/rain_check/core/simple_ut.cpp
@@ -1,10 +1,10 @@
#include <library/cpp/testing/unittest/registar.h>
#include <library/cpp/messagebus/rain_check/test/ut/test.h>
-
+
#include <library/cpp/messagebus/latch.h>
-#include <util/system/event.h>
+#include <util/system/event.h>
using namespace NRainCheck;
diff --git a/library/cpp/messagebus/rain_check/core/sleep.cpp b/library/cpp/messagebus/rain_check/core/sleep.cpp
index f5d0b4cac9..012586f4b1 100644
--- a/library/cpp/messagebus/rain_check/core/sleep.cpp
+++ b/library/cpp/messagebus/rain_check/core/sleep.cpp
@@ -1,5 +1,5 @@
-#include "rain_check.h"
-
+#include "rain_check.h"
+
#include <util/system/yassert.h>
using namespace NRainCheck;
diff --git a/library/cpp/messagebus/rain_check/core/sleep.h b/library/cpp/messagebus/rain_check/core/sleep.h
index 1a7a1f8674..71d3ba2cee 100644
--- a/library/cpp/messagebus/rain_check/core/sleep.h
+++ b/library/cpp/messagebus/rain_check/core/sleep.h
@@ -1,10 +1,10 @@
#pragma once
-#include "fwd.h"
+#include "fwd.h"
#include <library/cpp/messagebus/scheduler/scheduler.h>
-#include <util/datetime/base.h>
+#include <util/datetime/base.h>
namespace NRainCheck {
class TSleepService {
diff --git a/library/cpp/messagebus/rain_check/core/sleep_ut.cpp b/library/cpp/messagebus/rain_check/core/sleep_ut.cpp
index 2ae85a87b1..5c7d0bb85b 100644
--- a/library/cpp/messagebus/rain_check/core/sleep_ut.cpp
+++ b/library/cpp/messagebus/rain_check/core/sleep_ut.cpp
@@ -2,8 +2,8 @@
#include <library/cpp/messagebus/rain_check/test/ut/test.h>
-#include <util/system/event.h>
-
+#include <util/system/event.h>
+
using namespace NRainCheck;
using namespace NActor;
diff --git a/library/cpp/messagebus/rain_check/core/spawn.h b/library/cpp/messagebus/rain_check/core/spawn.h
index f2b146bf29..cb15157a0d 100644
--- a/library/cpp/messagebus/rain_check/core/spawn.h
+++ b/library/cpp/messagebus/rain_check/core/spawn.h
@@ -2,7 +2,7 @@
#include "coro.h"
#include "simple.h"
-#include "task.h"
+#include "task.h"
namespace NRainCheck {
namespace NPrivate {
diff --git a/library/cpp/messagebus/rain_check/core/spawn_ut.cpp b/library/cpp/messagebus/rain_check/core/spawn_ut.cpp
index ba5a5e41cf..f4d538d101 100644
--- a/library/cpp/messagebus/rain_check/core/spawn_ut.cpp
+++ b/library/cpp/messagebus/rain_check/core/spawn_ut.cpp
@@ -2,10 +2,10 @@
#include <library/cpp/messagebus/rain_check/test/helper/misc.h>
#include <library/cpp/messagebus/rain_check/test/ut/test.h>
-
+
#include <library/cpp/messagebus/latch.h>
-#include <util/system/event.h>
+#include <util/system/event.h>
#include <array>
diff --git a/library/cpp/messagebus/rain_check/core/task.cpp b/library/cpp/messagebus/rain_check/core/task.cpp
index a098437d53..f89a69e9ff 100644
--- a/library/cpp/messagebus/rain_check/core/task.cpp
+++ b/library/cpp/messagebus/rain_check/core/task.cpp
@@ -1,9 +1,9 @@
-#include "rain_check.h"
+#include "rain_check.h"
#include <library/cpp/messagebus/actor/temp_tls_vector.h>
#include <util/system/type_name.h>
-#include <util/system/tls.h>
+#include <util/system/tls.h>
using namespace NRainCheck;
using namespace NRainCheck::NPrivate;
diff --git a/library/cpp/messagebus/rain_check/core/task.h b/library/cpp/messagebus/rain_check/core/task.h
index 7d8778bcda..bf669a11f5 100644
--- a/library/cpp/messagebus/rain_check/core/task.h
+++ b/library/cpp/messagebus/rain_check/core/task.h
@@ -1,12 +1,12 @@
#pragma once
-#include "fwd.h"
-
+#include "fwd.h"
+
#include <library/cpp/messagebus/actor/actor.h>
#include <library/cpp/messagebus/misc/atomic_box.h>
-
+
#include <library/cpp/deprecated/enum_codegen/enum_codegen.h>
-
+
#include <util/generic/noncopyable.h>
#include <util/generic/ptr.h>
#include <util/thread/lfstack.h>
diff --git a/library/cpp/messagebus/rain_check/core/track.h b/library/cpp/messagebus/rain_check/core/track.h
index d387de7574..6277c807bc 100644
--- a/library/cpp/messagebus/rain_check/core/track.h
+++ b/library/cpp/messagebus/rain_check/core/track.h
@@ -1,15 +1,15 @@
#pragma once
-#include "spawn.h"
-#include "task.h"
+#include "spawn.h"
+#include "task.h"
#include <library/cpp/messagebus/async_result.h>
#include <library/cpp/messagebus/actor/queue_in_actor.h>
#include <library/cpp/messagebus/misc/atomic_box.h>
-#include <util/generic/intrlist.h>
-#include <util/system/event.h>
-
+#include <util/generic/intrlist.h>
+#include <util/system/event.h>
+
namespace NRainCheck {
class TTaskTracker;
diff --git a/library/cpp/messagebus/rain_check/core/track_ut.cpp b/library/cpp/messagebus/rain_check/core/track_ut.cpp
index 05f7de1319..3caee731dd 100644
--- a/library/cpp/messagebus/rain_check/core/track_ut.cpp
+++ b/library/cpp/messagebus/rain_check/core/track_ut.cpp
@@ -1,7 +1,7 @@
#include <library/cpp/testing/unittest/registar.h>
-#include "track.h"
-
+#include "track.h"
+
#include <library/cpp/messagebus/rain_check/test/helper/misc.h>
#include <library/cpp/messagebus/rain_check/test/ut/test.h>
diff --git a/library/cpp/messagebus/rain_check/http/client.cpp b/library/cpp/messagebus/rain_check/http/client.cpp
index 5ef5ceeece..d2e36093dc 100644
--- a/library/cpp/messagebus/rain_check/http/client.cpp
+++ b/library/cpp/messagebus/rain_check/http/client.cpp
@@ -8,7 +8,7 @@
#include <library/cpp/neh/location.h>
#include <library/cpp/neh/neh.h>
-#include <util/generic/ptr.h>
+#include <util/generic/ptr.h>
#include <util/generic/strbuf.h>
#include <util/network/socket.h>
#include <util/stream/str.h>
diff --git a/library/cpp/messagebus/rain_check/http/client.h b/library/cpp/messagebus/rain_check/http/client.h
index d4199c4c98..689718b65e 100644
--- a/library/cpp/messagebus/rain_check/http/client.h
+++ b/library/cpp/messagebus/rain_check/http/client.h
@@ -3,7 +3,7 @@
#include <library/cpp/messagebus/rain_check/core/task.h>
#include <library/cpp/http/misc/httpcodes.h>
-
+
#include <util/generic/maybe.h>
#include <util/generic/ptr.h>
#include <util/generic/string.h>
diff --git a/library/cpp/messagebus/rain_check/http/client_ut.cpp b/library/cpp/messagebus/rain_check/http/client_ut.cpp
index 1628114391..0a39c6b1b1 100644
--- a/library/cpp/messagebus/rain_check/http/client_ut.cpp
+++ b/library/cpp/messagebus/rain_check/http/client_ut.cpp
@@ -1,10 +1,10 @@
#include <library/cpp/testing/unittest/registar.h>
-
+
#include "client.h"
#include "http_code_extractor.h"
-
+
#include <library/cpp/messagebus/rain_check/test/ut/test.h>
-
+
#include <library/cpp/messagebus/test/helper/fixed_port.h>
#include <library/cpp/http/io/stream.h>
@@ -16,13 +16,13 @@
#include <util/generic/string.h>
#include <util/generic/vector.h>
#include <util/network/ip.h>
-#include <util/stream/str.h>
-#include <util/string/printf.h>
+#include <util/stream/str.h>
+#include <util/string/printf.h>
#include <util/system/defaults.h>
#include <util/system/yassert.h>
#include <cstdlib>
-#include <utility>
+#include <utility>
using namespace NRainCheck;
using namespace NBus::NTest;
diff --git a/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp b/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp
index 51d75762f6..2b02c17435 100644
--- a/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp
+++ b/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp
@@ -2,8 +2,8 @@
#include <library/cpp/http/io/stream.h>
#include <library/cpp/http/misc/httpcodes.h>
-
-#include <util/generic/maybe.h>
+
+#include <util/generic/maybe.h>
#include <util/generic/strbuf.h>
#include <util/string/cast.h>
diff --git a/library/cpp/messagebus/rain_check/http/http_code_extractor.h b/library/cpp/messagebus/rain_check/http/http_code_extractor.h
index 33b565fa1c..43f860b731 100644
--- a/library/cpp/messagebus/rain_check/http/http_code_extractor.h
+++ b/library/cpp/messagebus/rain_check/http/http_code_extractor.h
@@ -1,7 +1,7 @@
#pragma once
#include <library/cpp/http/misc/httpcodes.h>
-
+
#include <util/generic/maybe.h>
#include <util/generic/strbuf.h>
diff --git a/library/cpp/messagebus/rain_check/messagebus/messagebus_client.h b/library/cpp/messagebus/rain_check/messagebus/messagebus_client.h
index 0a291cdea6..6d9144cf3e 100644
--- a/library/cpp/messagebus/rain_check/messagebus/messagebus_client.h
+++ b/library/cpp/messagebus/rain_check/messagebus/messagebus_client.h
@@ -1,7 +1,7 @@
#pragma once
#include <library/cpp/messagebus/rain_check/core/task.h>
-
+
#include <library/cpp/messagebus/ybus.h>
namespace NRainCheck {
diff --git a/library/cpp/messagebus/rain_check/messagebus/messagebus_client_ut.cpp b/library/cpp/messagebus/rain_check/messagebus/messagebus_client_ut.cpp
index 1b3618558b..05d2d6e02f 100644
--- a/library/cpp/messagebus/rain_check/messagebus/messagebus_client_ut.cpp
+++ b/library/cpp/messagebus/rain_check/messagebus/messagebus_client_ut.cpp
@@ -1,13 +1,13 @@
#include <library/cpp/testing/unittest/registar.h>
-#include "messagebus_client.h"
-
+#include "messagebus_client.h"
+
#include <library/cpp/messagebus/rain_check/test/ut/test.h>
-
+
#include <library/cpp/messagebus/test/helper/example.h>
#include <library/cpp/messagebus/test/helper/object_count_check.h>
-#include <util/generic/cast.h>
+#include <util/generic/cast.h>
using namespace NBus;
using namespace NBus::NTest;
diff --git a/library/cpp/messagebus/rain_check/messagebus/messagebus_server.cpp b/library/cpp/messagebus/rain_check/messagebus/messagebus_server.cpp
index 5d4b13d664..88995e36f8 100644
--- a/library/cpp/messagebus/rain_check/messagebus/messagebus_server.cpp
+++ b/library/cpp/messagebus/rain_check/messagebus/messagebus_server.cpp
@@ -1,5 +1,5 @@
-#include "messagebus_server.h"
-
+#include "messagebus_server.h"
+
#include <library/cpp/messagebus/rain_check/core/spawn.h>
using namespace NRainCheck;
diff --git a/library/cpp/messagebus/rain_check/messagebus/messagebus_server_ut.cpp b/library/cpp/messagebus/rain_check/messagebus/messagebus_server_ut.cpp
index 7c11399f1b..68060e62e7 100644
--- a/library/cpp/messagebus/rain_check/messagebus/messagebus_server_ut.cpp
+++ b/library/cpp/messagebus/rain_check/messagebus/messagebus_server_ut.cpp
@@ -1,6 +1,6 @@
#include <library/cpp/testing/unittest/registar.h>
-#include "messagebus_server.h"
+#include "messagebus_server.h"
#include <library/cpp/messagebus/rain_check/test/ut/test.h>
diff --git a/library/cpp/messagebus/rain_check/test/helper/misc.cpp b/library/cpp/messagebus/rain_check/test/helper/misc.cpp
index c0fcb27252..0fe3700b96 100644
--- a/library/cpp/messagebus/rain_check/test/helper/misc.cpp
+++ b/library/cpp/messagebus/rain_check/test/helper/misc.cpp
@@ -1,5 +1,5 @@
-#include "misc.h"
-
+#include "misc.h"
+
#include <util/system/yassert.h>
using namespace NRainCheck;
diff --git a/library/cpp/messagebus/rain_check/test/perftest/perftest.cpp b/library/cpp/messagebus/rain_check/test/perftest/perftest.cpp
index 22edbd8c6b..980b6b2abf 100644
--- a/library/cpp/messagebus/rain_check/test/perftest/perftest.cpp
+++ b/library/cpp/messagebus/rain_check/test/perftest/perftest.cpp
@@ -2,8 +2,8 @@
#include <library/cpp/messagebus/rain_check/core/rain_check.h>
-#include <util/datetime/base.h>
-
+#include <util/datetime/base.h>
+
#include <array>
using namespace NRainCheck;
diff --git a/library/cpp/messagebus/rain_check/test/ut/test.h b/library/cpp/messagebus/rain_check/test/ut/test.h
index 724f6b7530..e91470d3a3 100644
--- a/library/cpp/messagebus/rain_check/test/ut/test.h
+++ b/library/cpp/messagebus/rain_check/test/ut/test.h
@@ -1,7 +1,7 @@
#pragma once
#include <library/cpp/messagebus/rain_check/core/rain_check.h>
-
+
#include <library/cpp/messagebus/misc/test_sync.h>
template <typename TSelf>
diff --git a/library/cpp/messagebus/remote_client_connection.cpp b/library/cpp/messagebus/remote_client_connection.cpp
index 8c7a6db3a8..051618afe0 100644
--- a/library/cpp/messagebus/remote_client_connection.cpp
+++ b/library/cpp/messagebus/remote_client_connection.cpp
@@ -1,14 +1,14 @@
#include "remote_client_connection.h"
-#include "mb_lwtrace.h"
-#include "network.h"
+#include "mb_lwtrace.h"
+#include "network.h"
#include "remote_client_session.h"
#include <library/cpp/messagebus/actor/executor.h>
#include <library/cpp/messagebus/actor/temp_tls_vector.h>
-#include <util/generic/cast.h>
-#include <util/thread/singleton.h>
+#include <util/generic/cast.h>
+#include <util/thread/singleton.h>
LWTRACE_USING(LWTRACE_MESSAGEBUS_PROVIDER)
diff --git a/library/cpp/messagebus/remote_client_connection.h b/library/cpp/messagebus/remote_client_connection.h
index fe80b7d2f9..557cc2e03d 100644
--- a/library/cpp/messagebus/remote_client_connection.h
+++ b/library/cpp/messagebus/remote_client_connection.h
@@ -1,12 +1,12 @@
#pragma once
-#include "connection.h"
+#include "connection.h"
#include "local_tasks.h"
-#include "remote_client_session.h"
+#include "remote_client_session.h"
#include "remote_connection.h"
-#include <util/generic/object_counter.h>
-
+#include <util/generic/object_counter.h>
+
namespace NBus {
namespace NPrivate {
class TRemoteClientConnection: public TRemoteConnection, public TBusClientConnection {
diff --git a/library/cpp/messagebus/remote_client_session.cpp b/library/cpp/messagebus/remote_client_session.cpp
index 3bc421944f..b2f98a19f2 100644
--- a/library/cpp/messagebus/remote_client_session.cpp
+++ b/library/cpp/messagebus/remote_client_session.cpp
@@ -1,12 +1,12 @@
#include "remote_client_session.h"
-#include "mb_lwtrace.h"
+#include "mb_lwtrace.h"
#include "remote_client_connection.h"
#include <library/cpp/messagebus/scheduler/scheduler.h>
-#include <util/generic/cast.h>
-#include <util/system/defaults.h>
+#include <util/generic/cast.h>
+#include <util/system/defaults.h>
LWTRACE_USING(LWTRACE_MESSAGEBUS_PROVIDER)
diff --git a/library/cpp/messagebus/remote_client_session.h b/library/cpp/messagebus/remote_client_session.h
index 7160d0dae9..9758235195 100644
--- a/library/cpp/messagebus/remote_client_session.h
+++ b/library/cpp/messagebus/remote_client_session.h
@@ -3,9 +3,9 @@
#include "remote_client_session_semaphore.h"
#include "session_impl.h"
-#include <util/generic/array_ref.h>
-#include <util/generic/object_counter.h>
-
+#include <util/generic/array_ref.h>
+#include <util/generic/object_counter.h>
+
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250) // 'NBus::NPrivate::TRemoteClientSession' : inherits 'NBus::NPrivate::TBusSessionImpl::NBus::NPrivate::TBusSessionImpl::GetConfig' via dominance
diff --git a/library/cpp/messagebus/remote_client_session_semaphore.cpp b/library/cpp/messagebus/remote_client_session_semaphore.cpp
index f877ed4257..c5601e5511 100644
--- a/library/cpp/messagebus/remote_client_session_semaphore.cpp
+++ b/library/cpp/messagebus/remote_client_session_semaphore.cpp
@@ -1,6 +1,6 @@
-#include "remote_client_session_semaphore.h"
-
-#include <util/stream/output.h>
+#include "remote_client_session_semaphore.h"
+
+#include <util/stream/output.h>
#include <util/system/yassert.h>
using namespace NBus;
diff --git a/library/cpp/messagebus/remote_client_session_semaphore.h b/library/cpp/messagebus/remote_client_session_semaphore.h
index 286ca3c86f..c3850d7d90 100644
--- a/library/cpp/messagebus/remote_client_session_semaphore.h
+++ b/library/cpp/messagebus/remote_client_session_semaphore.h
@@ -1,10 +1,10 @@
#pragma once
-#include "cc_semaphore.h"
-
+#include "cc_semaphore.h"
+
#include <util/generic/noncopyable.h>
-#include <util/system/atomic.h>
-#include <util/system/condvar.h>
+#include <util/system/atomic.h>
+#include <util/system/condvar.h>
#include <util/system/mutex.h>
namespace NBus {
diff --git a/library/cpp/messagebus/remote_connection.cpp b/library/cpp/messagebus/remote_connection.cpp
index 22932569db..18cb3ebd39 100644
--- a/library/cpp/messagebus/remote_connection.cpp
+++ b/library/cpp/messagebus/remote_connection.cpp
@@ -1,19 +1,19 @@
-#include "remote_connection.h"
+#include "remote_connection.h"
#include "key_value_printer.h"
-#include "mb_lwtrace.h"
-#include "network.h"
+#include "mb_lwtrace.h"
+#include "network.h"
#include "remote_client_connection.h"
#include "remote_client_session.h"
#include "remote_server_session.h"
-#include "session_impl.h"
+#include "session_impl.h"
#include <library/cpp/messagebus/actor/what_thread_does.h>
-#include <util/generic/cast.h>
-#include <util/network/init.h>
-#include <util/system/atomic.h>
-
+#include <util/generic/cast.h>
+#include <util/network/init.h>
+#include <util/system/atomic.h>
+
LWTRACE_USING(LWTRACE_MESSAGEBUS_PROVIDER)
using namespace NActor;
diff --git a/library/cpp/messagebus/remote_connection.h b/library/cpp/messagebus/remote_connection.h
index 4538947368..91e343e171 100644
--- a/library/cpp/messagebus/remote_connection.h
+++ b/library/cpp/messagebus/remote_connection.h
@@ -1,18 +1,18 @@
#pragma once
#include "async_result.h"
-#include "defs.h"
+#include "defs.h"
#include "event_loop.h"
-#include "left_right_buffer.h"
-#include "lfqueue_batch.h"
-#include "message_ptr_and_header.h"
+#include "left_right_buffer.h"
+#include "lfqueue_batch.h"
+#include "message_ptr_and_header.h"
#include "nondestroying_holder.h"
#include "remote_connection_status.h"
#include "scheduler_actor.h"
#include "socket_addr.h"
-#include "storage.h"
+#include "storage.h"
#include "vector_swaps.h"
-#include "ybus.h"
+#include "ybus.h"
#include "misc/granup.h"
#include "misc/tokenquota.h"
@@ -21,11 +21,11 @@
#include <library/cpp/messagebus/actor/queue_for_actor.h>
#include <library/cpp/messagebus/actor/queue_in_actor.h>
#include <library/cpp/messagebus/scheduler/scheduler.h>
-
-#include <util/system/atomic.h>
-#include <util/system/event.h>
-#include <util/thread/lfstack.h>
-
+
+#include <util/system/atomic.h>
+#include <util/system/event.h>
+#include <util/thread/lfstack.h>
+
namespace NBus {
namespace NPrivate {
class TRemoteConnection;
diff --git a/library/cpp/messagebus/remote_connection_status.cpp b/library/cpp/messagebus/remote_connection_status.cpp
index 2c48b2a287..a79fc01587 100644
--- a/library/cpp/messagebus/remote_connection_status.cpp
+++ b/library/cpp/messagebus/remote_connection_status.cpp
@@ -1,13 +1,13 @@
-#include "remote_connection_status.h"
+#include "remote_connection_status.h"
#include "key_value_printer.h"
#include <library/cpp/messagebus/monitoring/mon_proto.pb.h>
-#include <util/stream/format.h>
-#include <util/stream/output.h>
-#include <util/system/yassert.h>
-
+#include <util/stream/format.h>
+#include <util/stream/output.h>
+#include <util/system/yassert.h>
+
using namespace NBus;
using namespace NBus::NPrivate;
diff --git a/library/cpp/messagebus/remote_connection_status.h b/library/cpp/messagebus/remote_connection_status.h
index 5db10e51ea..e3c725df5f 100644
--- a/library/cpp/messagebus/remote_connection_status.h
+++ b/library/cpp/messagebus/remote_connection_status.h
@@ -1,16 +1,16 @@
#pragma once
#include "codegen.h"
-#include "duration_histogram.h"
-#include "message_counter.h"
+#include "duration_histogram.h"
+#include "message_counter.h"
#include "message_status_counter.h"
#include "queue_config.h"
#include "session_config.h"
#include <library/cpp/messagebus/actor/executor.h>
-
+
#include <library/cpp/deprecated/enum_codegen/enum_codegen.h>
-
+
namespace NBus {
class TConnectionStatusMonRecord;
}
diff --git a/library/cpp/messagebus/remote_server_connection.cpp b/library/cpp/messagebus/remote_server_connection.cpp
index 74be34ded9..a87ca51e42 100644
--- a/library/cpp/messagebus/remote_server_connection.cpp
+++ b/library/cpp/messagebus/remote_server_connection.cpp
@@ -1,9 +1,9 @@
#include "remote_server_connection.h"
-#include "mb_lwtrace.h"
+#include "mb_lwtrace.h"
#include "remote_server_session.h"
-#include <util/generic/cast.h>
+#include <util/generic/cast.h>
LWTRACE_USING(LWTRACE_MESSAGEBUS_PROVIDER)
diff --git a/library/cpp/messagebus/remote_server_connection.h b/library/cpp/messagebus/remote_server_connection.h
index 63d7f20646..c4f6dbf33d 100644
--- a/library/cpp/messagebus/remote_server_connection.h
+++ b/library/cpp/messagebus/remote_server_connection.h
@@ -1,7 +1,7 @@
#pragma once
-#include "session_impl.h"
-
+#include "session_impl.h"
+
#include <util/generic/object_counter.h>
namespace NBus {
diff --git a/library/cpp/messagebus/remote_server_session.cpp b/library/cpp/messagebus/remote_server_session.cpp
index 6abbf88a60..638e3b6f7b 100644
--- a/library/cpp/messagebus/remote_server_session.cpp
+++ b/library/cpp/messagebus/remote_server_session.cpp
@@ -1,15 +1,15 @@
-#include "remote_server_session.h"
-
-#include "remote_connection.h"
-#include "remote_server_connection.h"
+#include "remote_server_session.h"
+#include "remote_connection.h"
+#include "remote_server_connection.h"
+
#include <library/cpp/messagebus/actor/temp_tls_vector.h>
-
-#include <util/generic/cast.h>
+
+#include <util/generic/cast.h>
#include <util/stream/output.h>
#include <util/system/yassert.h>
-#include <typeinfo>
+#include <typeinfo>
using namespace NActor;
using namespace NBus;
diff --git a/library/cpp/messagebus/remote_server_session_semaphore.cpp b/library/cpp/messagebus/remote_server_session_semaphore.cpp
index 6094a3586e..99f1db1715 100644
--- a/library/cpp/messagebus/remote_server_session_semaphore.cpp
+++ b/library/cpp/messagebus/remote_server_session_semaphore.cpp
@@ -1,6 +1,6 @@
-#include "remote_server_session_semaphore.h"
-
-#include <util/stream/output.h>
+#include "remote_server_session_semaphore.h"
+
+#include <util/stream/output.h>
#include <util/system/yassert.h>
using namespace NBus;
diff --git a/library/cpp/messagebus/remote_server_session_semaphore.h b/library/cpp/messagebus/remote_server_session_semaphore.h
index de714fd342..8673c10ef5 100644
--- a/library/cpp/messagebus/remote_server_session_semaphore.h
+++ b/library/cpp/messagebus/remote_server_session_semaphore.h
@@ -1,7 +1,7 @@
#pragma once
-#include "cc_semaphore.h"
-
+#include "cc_semaphore.h"
+
#include <util/generic/noncopyable.h>
namespace NBus {
diff --git a/library/cpp/messagebus/scheduler/scheduler.h b/library/cpp/messagebus/scheduler/scheduler.h
index afcc0de55d..c01d8f0b33 100644
--- a/library/cpp/messagebus/scheduler/scheduler.h
+++ b/library/cpp/messagebus/scheduler/scheduler.h
@@ -1,13 +1,13 @@
#pragma once
#include <library/cpp/threading/future/legacy_future.h>
-
-#include <util/datetime/base.h>
-#include <util/generic/object_counter.h>
+
+#include <util/datetime/base.h>
+#include <util/generic/object_counter.h>
#include <util/generic/ptr.h>
#include <util/generic/vector.h>
#include <util/system/atomic.h>
-#include <util/system/condvar.h>
+#include <util/system/condvar.h>
#include <util/system/mutex.h>
#include <util/system/thread.h>
diff --git a/library/cpp/messagebus/scheduler_actor.h b/library/cpp/messagebus/scheduler_actor.h
index d0c23c94c4..0fe005c82e 100644
--- a/library/cpp/messagebus/scheduler_actor.h
+++ b/library/cpp/messagebus/scheduler_actor.h
@@ -6,7 +6,7 @@
#include <library/cpp/messagebus/actor/what_thread_does_guard.h>
#include <library/cpp/messagebus/scheduler/scheduler.h>
-#include <util/system/mutex.h>
+#include <util/system/mutex.h>
namespace NBus {
namespace NPrivate {
diff --git a/library/cpp/messagebus/scheduler_actor_ut.cpp b/library/cpp/messagebus/scheduler_actor_ut.cpp
index e81ffd3186..3136011e9c 100644
--- a/library/cpp/messagebus/scheduler_actor_ut.cpp
+++ b/library/cpp/messagebus/scheduler_actor_ut.cpp
@@ -1,6 +1,6 @@
#include <library/cpp/testing/unittest/registar.h>
-#include "scheduler_actor.h"
+#include "scheduler_actor.h"
#include "misc/test_sync.h"
using namespace NBus;
diff --git a/library/cpp/messagebus/session.cpp b/library/cpp/messagebus/session.cpp
index 46a7ece6a8..ff96320435 100644
--- a/library/cpp/messagebus/session.cpp
+++ b/library/cpp/messagebus/session.cpp
@@ -1,5 +1,5 @@
-#include "ybus.h"
-
+#include "ybus.h"
+
#include <util/generic/cast.h>
using namespace NBus;
diff --git a/library/cpp/messagebus/session.h b/library/cpp/messagebus/session.h
index fb12ab7c22..f5a75615c1 100644
--- a/library/cpp/messagebus/session.h
+++ b/library/cpp/messagebus/session.h
@@ -1,19 +1,19 @@
#pragma once
-#include "connection.h"
+#include "connection.h"
#include "defs.h"
-#include "handler.h"
+#include "handler.h"
#include "message.h"
#include "netaddr.h"
-#include "network.h"
+#include "network.h"
#include "session_config.h"
-#include "misc/weak_ptr.h"
+#include "misc/weak_ptr.h"
#include <library/cpp/messagebus/monitoring/mon_proto.pb.h>
-#include <util/generic/array_ref.h>
-#include <util/generic/ptr.h>
-
+#include <util/generic/array_ref.h>
+#include <util/generic/ptr.h>
+
namespace NBus {
template <typename TBusSessionSubclass>
class TBusSessionPtr;
diff --git a/library/cpp/messagebus/session_impl.cpp b/library/cpp/messagebus/session_impl.cpp
index ddf9f360c4..29fa554630 100644
--- a/library/cpp/messagebus/session_impl.cpp
+++ b/library/cpp/messagebus/session_impl.cpp
@@ -1,15 +1,15 @@
-#include "session_impl.h"
+#include "session_impl.h"
-#include "acceptor.h"
+#include "acceptor.h"
#include "network.h"
-#include "remote_client_connection.h"
+#include "remote_client_connection.h"
#include "remote_client_session.h"
#include "remote_server_connection.h"
-#include "remote_server_session.h"
-#include "misc/weak_ptr.h"
-
-#include <util/generic/cast.h>
+#include "remote_server_session.h"
+#include "misc/weak_ptr.h"
+#include <util/generic/cast.h>
+
using namespace NActor;
using namespace NBus;
using namespace NBus::NPrivate;
diff --git a/library/cpp/messagebus/session_impl.h b/library/cpp/messagebus/session_impl.h
index 90ef246ff8..3dcfedace6 100644
--- a/library/cpp/messagebus/session_impl.h
+++ b/library/cpp/messagebus/session_impl.h
@@ -1,24 +1,24 @@
#pragma once
-#include "acceptor_status.h"
-#include "async_result.h"
-#include "event_loop.h"
+#include "acceptor_status.h"
+#include "async_result.h"
+#include "event_loop.h"
#include "netaddr.h"
-#include "remote_connection.h"
+#include "remote_connection.h"
#include "remote_connection_status.h"
#include "session_job_count.h"
#include "shutdown_state.h"
-#include "ybus.h"
+#include "ybus.h"
#include <library/cpp/messagebus/actor/actor.h>
#include <library/cpp/messagebus/actor/queue_in_actor.h>
#include <library/cpp/messagebus/monitoring/mon_proto.pb.h>
#include <library/cpp/threading/future/legacy_future.h>
-
-#include <util/generic/array_ref.h>
-#include <util/generic/string.h>
-
+
+#include <util/generic/array_ref.h>
+#include <util/generic/string.h>
+
namespace NBus {
namespace NPrivate {
typedef TIntrusivePtr<TRemoteClientConnection> TRemoteClientConnectionPtr;
diff --git a/library/cpp/messagebus/session_job_count.cpp b/library/cpp/messagebus/session_job_count.cpp
index 33322b1910..1068dd7a15 100644
--- a/library/cpp/messagebus/session_job_count.cpp
+++ b/library/cpp/messagebus/session_job_count.cpp
@@ -1,5 +1,5 @@
-#include "session_job_count.h"
-
+#include "session_job_count.h"
+
#include <util/system/yassert.h>
using namespace NBus;
diff --git a/library/cpp/messagebus/session_job_count.h b/library/cpp/messagebus/session_job_count.h
index 23aca618b1..ef28c30cef 100644
--- a/library/cpp/messagebus/session_job_count.h
+++ b/library/cpp/messagebus/session_job_count.h
@@ -1,7 +1,7 @@
#pragma once
#include <util/system/atomic.h>
-#include <util/system/condvar.h>
+#include <util/system/condvar.h>
#include <util/system/mutex.h>
namespace NBus {
diff --git a/library/cpp/messagebus/shutdown_state.cpp b/library/cpp/messagebus/shutdown_state.cpp
index a4e2bfa8b2..b4b2a19dce 100644
--- a/library/cpp/messagebus/shutdown_state.cpp
+++ b/library/cpp/messagebus/shutdown_state.cpp
@@ -1,5 +1,5 @@
-#include "shutdown_state.h"
-
+#include "shutdown_state.h"
+
#include <util/system/yassert.h>
void TAtomicShutdownState::ShutdownCommand() {
diff --git a/library/cpp/messagebus/shutdown_state.h b/library/cpp/messagebus/shutdown_state.h
index 86bd7110ae..10104c1d9a 100644
--- a/library/cpp/messagebus/shutdown_state.h
+++ b/library/cpp/messagebus/shutdown_state.h
@@ -1,7 +1,7 @@
#pragma once
-#include "misc/atomic_box.h"
-
+#include "misc/atomic_box.h"
+
#include <util/system/event.h>
enum EShutdownState {
diff --git a/library/cpp/messagebus/socket_addr.cpp b/library/cpp/messagebus/socket_addr.cpp
index c1b3a28fbe..b82fa24ae3 100644
--- a/library/cpp/messagebus/socket_addr.cpp
+++ b/library/cpp/messagebus/socket_addr.cpp
@@ -1,10 +1,10 @@
-#include "socket_addr.h"
+#include "socket_addr.h"
#include "netaddr.h"
-#include <util/network/address.h>
-#include <util/network/init.h>
-#include <util/system/yassert.h>
+#include <util/network/address.h>
+#include <util/network/init.h>
+#include <util/system/yassert.h>
using namespace NAddr;
diff --git a/library/cpp/messagebus/socket_addr.h b/library/cpp/messagebus/socket_addr.h
index 959eafe689..98b157c3d1 100644
--- a/library/cpp/messagebus/socket_addr.h
+++ b/library/cpp/messagebus/socket_addr.h
@@ -1,13 +1,13 @@
#pragma once
-#include "hash.h"
+#include "hash.h"
#include <util/generic/hash.h>
-#include <util/generic/utility.h>
+#include <util/generic/utility.h>
#include <util/network/address.h>
-#include <util/network/init.h>
+#include <util/network/init.h>
-#include <string.h>
+#include <string.h>
namespace NBus {
class TNetAddr;
diff --git a/library/cpp/messagebus/socket_addr_ut.cpp b/library/cpp/messagebus/socket_addr_ut.cpp
index 783bb62a86..606b33fa2b 100644
--- a/library/cpp/messagebus/socket_addr_ut.cpp
+++ b/library/cpp/messagebus/socket_addr_ut.cpp
@@ -1,10 +1,10 @@
#include <library/cpp/testing/unittest/registar.h>
-#include "netaddr.h"
+#include "netaddr.h"
#include "socket_addr.h"
-#include <util/string/cast.h>
-
+#include <util/string/cast.h>
+
using namespace NBus;
using namespace NBus::NPrivate;
diff --git a/library/cpp/messagebus/storage.cpp b/library/cpp/messagebus/storage.cpp
index efefc87340..1b856c7d61 100644
--- a/library/cpp/messagebus/storage.cpp
+++ b/library/cpp/messagebus/storage.cpp
@@ -1,5 +1,5 @@
-#include "storage.h"
-
+#include "storage.h"
+
#include <typeinfo>
namespace NBus {
diff --git a/library/cpp/messagebus/storage.h b/library/cpp/messagebus/storage.h
index 7d168844ed..8fc2362ee6 100644
--- a/library/cpp/messagebus/storage.h
+++ b/library/cpp/messagebus/storage.h
@@ -1,12 +1,12 @@
#pragma once
-#include "message_ptr_and_header.h"
-#include "moved.h"
-#include "ybus.h"
-
-#include <contrib/libs/sparsehash/src/sparsehash/dense_hash_map>
-
-#include <util/generic/deque.h>
+#include "message_ptr_and_header.h"
+#include "moved.h"
+#include "ybus.h"
+
+#include <contrib/libs/sparsehash/src/sparsehash/dense_hash_map>
+
+#include <util/generic/deque.h>
#include <util/generic/noncopyable.h>
#include <util/generic/utility.h>
diff --git a/library/cpp/messagebus/synchandler.cpp b/library/cpp/messagebus/synchandler.cpp
index 8e891d66b3..c965259740 100644
--- a/library/cpp/messagebus/synchandler.cpp
+++ b/library/cpp/messagebus/synchandler.cpp
@@ -1,6 +1,6 @@
#include "remote_client_session.h"
#include "remote_connection.h"
-#include "ybus.h"
+#include "ybus.h"
using namespace NBus;
using namespace NBus::NPrivate;
diff --git a/library/cpp/messagebus/test/example/client/client.cpp b/library/cpp/messagebus/test/example/client/client.cpp
index 89b5f2c9be..05bafa9a82 100644
--- a/library/cpp/messagebus/test/example/client/client.cpp
+++ b/library/cpp/messagebus/test/example/client/client.cpp
@@ -1,5 +1,5 @@
#include <library/cpp/messagebus/test/example/common/proto.h>
-
+
#include <util/random/random.h>
using namespace NBus;
diff --git a/library/cpp/messagebus/test/example/common/proto.h b/library/cpp/messagebus/test/example/common/proto.h
index a151aac468..9a9a730312 100644
--- a/library/cpp/messagebus/test/example/common/proto.h
+++ b/library/cpp/messagebus/test/example/common/proto.h
@@ -4,7 +4,7 @@
#include <library/cpp/messagebus/ybus.h>
#include <library/cpp/messagebus/protobuf/ybusbuf.h>
-
+
namespace NCalculator {
typedef ::NBus::TBusBufferMessage<TRequestSumRecord, 1> TRequestSum;
typedef ::NBus::TBusBufferMessage<TRequestMulRecord, 2> TRequestMul;
diff --git a/library/cpp/messagebus/test/helper/example.cpp b/library/cpp/messagebus/test/helper/example.cpp
index 7c6d704042..f3c956bf83 100644
--- a/library/cpp/messagebus/test/helper/example.cpp
+++ b/library/cpp/messagebus/test/helper/example.cpp
@@ -1,7 +1,7 @@
#include <library/cpp/testing/unittest/registar.h>
-#include "example.h"
-
+#include "example.h"
+
#include <util/generic/cast.h>
using namespace NBus;
diff --git a/library/cpp/messagebus/test/helper/example.h b/library/cpp/messagebus/test/helper/example.h
index 26b7475308..1566b3c539 100644
--- a/library/cpp/messagebus/test/helper/example.h
+++ b/library/cpp/messagebus/test/helper/example.h
@@ -7,9 +7,9 @@
#include <library/cpp/messagebus/ybus.h>
#include <library/cpp/messagebus/misc/test_sync.h>
-
-#include <util/system/event.h>
-
+
+#include <util/system/event.h>
+
namespace NBus {
namespace NTest {
class TExampleRequest: public TBusMessage {
diff --git a/library/cpp/messagebus/test/helper/example_module.h b/library/cpp/messagebus/test/helper/example_module.h
index a0b295f613..03d2f92cb4 100644
--- a/library/cpp/messagebus/test/helper/example_module.h
+++ b/library/cpp/messagebus/test/helper/example_module.h
@@ -3,7 +3,7 @@
#include "example.h"
#include <library/cpp/messagebus/oldmodule/module.h>
-
+
namespace NBus {
namespace NTest {
struct TExampleModule: public TBusModule {
diff --git a/library/cpp/messagebus/test/helper/fixed_port.cpp b/library/cpp/messagebus/test/helper/fixed_port.cpp
index 258da0d1a5..95d8039bbd 100644
--- a/library/cpp/messagebus/test/helper/fixed_port.cpp
+++ b/library/cpp/messagebus/test/helper/fixed_port.cpp
@@ -1,8 +1,8 @@
-#include "fixed_port.h"
-
+#include "fixed_port.h"
+
#include <util/system/env.h>
-#include <stdlib.h>
+#include <stdlib.h>
bool NBus::NTest::IsFixedPortTestAllowed() {
// TODO: report skipped tests to test
diff --git a/library/cpp/messagebus/test/helper/hanging_server.cpp b/library/cpp/messagebus/test/helper/hanging_server.cpp
index a35514b00d..673489bf61 100644
--- a/library/cpp/messagebus/test/helper/hanging_server.cpp
+++ b/library/cpp/messagebus/test/helper/hanging_server.cpp
@@ -1,5 +1,5 @@
-#include "hanging_server.h"
-
+#include "hanging_server.h"
+
#include <util/system/yassert.h>
using namespace NBus;
diff --git a/library/cpp/messagebus/test/helper/hanging_server.h b/library/cpp/messagebus/test/helper/hanging_server.h
index cc9fb274d8..59f5753f5a 100644
--- a/library/cpp/messagebus/test/helper/hanging_server.h
+++ b/library/cpp/messagebus/test/helper/hanging_server.h
@@ -1,7 +1,7 @@
#pragma once
#include <library/cpp/messagebus/network.h>
-
+
#include <util/network/sock.h>
class THangingServer {
diff --git a/library/cpp/messagebus/test/helper/message_handler_error.cpp b/library/cpp/messagebus/test/helper/message_handler_error.cpp
index c09811ec67..ce0c0c5c74 100644
--- a/library/cpp/messagebus/test/helper/message_handler_error.cpp
+++ b/library/cpp/messagebus/test/helper/message_handler_error.cpp
@@ -1,5 +1,5 @@
-#include "message_handler_error.h"
-
+#include "message_handler_error.h"
+
#include <util/system/yassert.h>
using namespace NBus;
diff --git a/library/cpp/messagebus/test/helper/object_count_check.h b/library/cpp/messagebus/test/helper/object_count_check.h
index 1c4756e58c..cd54d9547b 100644
--- a/library/cpp/messagebus/test/helper/object_count_check.h
+++ b/library/cpp/messagebus/test/helper/object_count_check.h
@@ -12,10 +12,10 @@
#include <util/generic/object_counter.h>
#include <util/system/type_name.h>
-#include <util/stream/output.h>
-
-#include <typeinfo>
+#include <util/stream/output.h>
+#include <typeinfo>
+
struct TObjectCountCheck {
bool Enabled;
diff --git a/library/cpp/messagebus/test/perftest/perftest.cpp b/library/cpp/messagebus/test/perftest/perftest.cpp
index 8489319278..b66725049a 100644
--- a/library/cpp/messagebus/test/perftest/perftest.cpp
+++ b/library/cpp/messagebus/test/perftest/perftest.cpp
@@ -8,7 +8,7 @@
#include <library/cpp/messagebus/oldmodule/module.h>
#include <library/cpp/messagebus/protobuf/ybusbuf.h>
#include <library/cpp/messagebus/www/www.h>
-
+
#include <library/cpp/deprecated/threadable/threadable.h>
#include <library/cpp/execprofile/profile.h>
#include <library/cpp/getopt/opt.h>
diff --git a/library/cpp/messagebus/test/perftest/simple_proto.cpp b/library/cpp/messagebus/test/perftest/simple_proto.cpp
index 19d6c15b9d..601aa50a79 100644
--- a/library/cpp/messagebus/test/perftest/simple_proto.cpp
+++ b/library/cpp/messagebus/test/perftest/simple_proto.cpp
@@ -1,8 +1,8 @@
-#include "simple_proto.h"
+#include "simple_proto.h"
#include <util/generic/cast.h>
-#include <typeinfo>
+#include <typeinfo>
using namespace NBus;
diff --git a/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp b/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp
index 3fdd175d73..058e164559 100644
--- a/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp
+++ b/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp
@@ -2,7 +2,7 @@
#include <library/cpp/messagebus/test_utils.h>
#include <library/cpp/messagebus/ybus.h>
-
+
class TLocatorRegisterUniqTest: public TTestBase {
UNIT_TEST_SUITE(TLocatorRegisterUniqTest);
UNIT_TEST(TestRegister);
diff --git a/library/cpp/messagebus/test/ut/module_client_one_way_ut.cpp b/library/cpp/messagebus/test/ut/module_client_one_way_ut.cpp
index 4083cf3b7b..848bc332f8 100644
--- a/library/cpp/messagebus/test/ut/module_client_one_way_ut.cpp
+++ b/library/cpp/messagebus/test/ut/module_client_one_way_ut.cpp
@@ -5,7 +5,7 @@
#include <library/cpp/messagebus/misc/test_sync.h>
#include <library/cpp/messagebus/oldmodule/module.h>
-
+
using namespace NBus;
using namespace NBus::NTest;
diff --git a/library/cpp/messagebus/test/ut/module_client_ut.cpp b/library/cpp/messagebus/test/ut/module_client_ut.cpp
index ebfe185cc6..cf3c7befc7 100644
--- a/library/cpp/messagebus/test/ut/module_client_ut.cpp
+++ b/library/cpp/messagebus/test/ut/module_client_ut.cpp
@@ -1,6 +1,6 @@
#include <library/cpp/testing/unittest/registar.h>
-#include "count_down_latch.h"
+#include "count_down_latch.h"
#include "moduletest.h"
#include <library/cpp/messagebus/test/helper/example.h>
@@ -10,10 +10,10 @@
#include <library/cpp/messagebus/misc/test_sync.h>
#include <library/cpp/messagebus/oldmodule/module.h>
-
-#include <util/generic/cast.h>
-#include <util/system/event.h>
-
+
+#include <util/generic/cast.h>
+#include <util/system/event.h>
+
using namespace NBus;
using namespace NBus::NTest;
diff --git a/library/cpp/messagebus/test/ut/module_server_ut.cpp b/library/cpp/messagebus/test/ut/module_server_ut.cpp
index 88fe1dd9b6..009bd7d489 100644
--- a/library/cpp/messagebus/test/ut/module_server_ut.cpp
+++ b/library/cpp/messagebus/test/ut/module_server_ut.cpp
@@ -1,17 +1,17 @@
#include <library/cpp/testing/unittest/registar.h>
-#include "count_down_latch.h"
+#include "count_down_latch.h"
#include "moduletest.h"
#include <library/cpp/messagebus/test/helper/example.h>
#include <library/cpp/messagebus/test/helper/example_module.h>
#include <library/cpp/messagebus/test/helper/object_count_check.h>
#include <library/cpp/messagebus/test/helper/wait_for.h>
-
+
#include <library/cpp/messagebus/oldmodule/module.h>
-
-#include <util/generic/cast.h>
-
+
+#include <util/generic/cast.h>
+
using namespace NBus;
using namespace NBus::NTest;
diff --git a/library/cpp/messagebus/use_after_free_checker.cpp b/library/cpp/messagebus/use_after_free_checker.cpp
index 4904e7c614..aecf1ac447 100644
--- a/library/cpp/messagebus/use_after_free_checker.cpp
+++ b/library/cpp/messagebus/use_after_free_checker.cpp
@@ -1,5 +1,5 @@
-#include "use_after_free_checker.h"
-
+#include "use_after_free_checker.h"
+
#include <util/system/yassert.h>
namespace {
diff --git a/library/cpp/messagebus/use_after_free_checker.h b/library/cpp/messagebus/use_after_free_checker.h
index 590b076156..92856e00f8 100644
--- a/library/cpp/messagebus/use_after_free_checker.h
+++ b/library/cpp/messagebus/use_after_free_checker.h
@@ -1,7 +1,7 @@
#pragma once
#include <util/system/platform.h>
-#include <util/system/types.h>
+#include <util/system/types.h>
class TUseAfterFreeChecker {
private:
diff --git a/library/cpp/messagebus/use_count_checker.cpp b/library/cpp/messagebus/use_count_checker.cpp
index c6243ea21f..acc35a5a02 100644
--- a/library/cpp/messagebus/use_count_checker.cpp
+++ b/library/cpp/messagebus/use_count_checker.cpp
@@ -1,6 +1,6 @@
-#include "use_count_checker.h"
-
-#include <util/generic/utility.h>
+#include "use_count_checker.h"
+
+#include <util/generic/utility.h>
#include <util/system/yassert.h>
TUseCountChecker::TUseCountChecker() {
diff --git a/library/cpp/messagebus/vector_swaps.h b/library/cpp/messagebus/vector_swaps.h
index b920bcf03e..f6eb6b7801 100644
--- a/library/cpp/messagebus/vector_swaps.h
+++ b/library/cpp/messagebus/vector_swaps.h
@@ -2,11 +2,11 @@
#include <util/generic/array_ref.h>
#include <util/generic/noncopyable.h>
-#include <util/generic/utility.h>
+#include <util/generic/utility.h>
#include <util/system/yassert.h>
-#include <stdlib.h>
-
+#include <stdlib.h>
+
template <typename T, class A = std::allocator<T>>
class TVectorSwaps : TNonCopyable {
private:
diff --git a/library/cpp/messagebus/www/html_output.h b/library/cpp/messagebus/www/html_output.h
index 27e77adefa..6dbd24687f 100644
--- a/library/cpp/messagebus/www/html_output.h
+++ b/library/cpp/messagebus/www/html_output.h
@@ -1,8 +1,8 @@
#pragma once
-#include "concat_strings.h"
-
-#include <util/generic/string.h>
+#include "concat_strings.h"
+
+#include <util/generic/string.h>
#include <util/stream/output.h>
#include <library/cpp/html/pcdata/pcdata.h>
#include <util/system/tls.h>
diff --git a/library/cpp/messagebus/www/www.cpp b/library/cpp/messagebus/www/www.cpp
index 62ec241d85..85d5e13cd8 100644
--- a/library/cpp/messagebus/www/www.cpp
+++ b/library/cpp/messagebus/www/www.cpp
@@ -1,11 +1,11 @@
-#include "www.h"
+#include "www.h"
-#include "concat_strings.h"
-#include "html_output.h"
+#include "concat_strings.h"
+#include "html_output.h"
#include <library/cpp/messagebus/remote_connection_status.h>
#include <library/cpp/monlib/deprecated/json/writer.h>
-
+
#include <library/cpp/archive/yarchive.h>
#include <library/cpp/http/fetch/httpfsm.h>
#include <library/cpp/http/fetch/httpheader.h>
@@ -13,11 +13,11 @@
#include <library/cpp/json/writer/json.h>
#include <library/cpp/uri/http_url.h>
-#include <util/string/cast.h>
-#include <util/string/printf.h>
-#include <util/system/mutex.h>
+#include <util/string/cast.h>
+#include <util/string/printf.h>
+#include <util/system/mutex.h>
-#include <utility>
+#include <utility>
using namespace NBus;
using namespace NBus::NPrivate;
diff --git a/library/cpp/messagebus/www/www.h b/library/cpp/messagebus/www/www.h
index 6cd652b477..ee1f629447 100644
--- a/library/cpp/messagebus/www/www.h
+++ b/library/cpp/messagebus/www/www.h
@@ -2,8 +2,8 @@
#include <library/cpp/messagebus/ybus.h>
#include <library/cpp/messagebus/oldmodule/module.h>
-
-#include <util/generic/ptr.h>
+
+#include <util/generic/ptr.h>
#include <util/generic/string.h>
#include <library/cpp/cgiparam/cgiparam.h>
diff --git a/library/cpp/messagebus/ybus.h b/library/cpp/messagebus/ybus.h
index de21ad8521..c2fe735f26 100644
--- a/library/cpp/messagebus/ybus.h
+++ b/library/cpp/messagebus/ybus.h
@@ -8,30 +8,30 @@
#include "handler.h"
#include "handler_impl.h"
#include "local_flags.h"
-#include "locator.h"
+#include "locator.h"
#include "message.h"
-#include "message_status.h"
-#include "network.h"
-#include "queue_config.h"
-#include "remote_connection_status.h"
+#include "message_status.h"
+#include "network.h"
+#include "queue_config.h"
+#include "remote_connection_status.h"
#include "session.h"
-#include "session_config.h"
-#include "socket_addr.h"
+#include "session_config.h"
+#include "socket_addr.h"
#include <library/cpp/messagebus/actor/executor.h>
#include <library/cpp/messagebus/scheduler/scheduler.h>
-
+
#include <library/cpp/codecs/codecs.h>
-
-#include <util/generic/array_ref.h>
+
+#include <util/generic/array_ref.h>
#include <util/generic/buffer.h>
#include <util/generic/noncopyable.h>
-#include <util/generic/ptr.h>
+#include <util/generic/ptr.h>
#include <util/stream/input.h>
#include <util/system/atomic.h>
#include <util/system/condvar.h>
#include <util/system/type_name.h>
-#include <util/system/event.h>
+#include <util/system/event.h>
#include <util/system/mutex.h>
namespace NBus {
diff --git a/library/cpp/threading/future/core/future-inl.h b/library/cpp/threading/future/core/future-inl.h
index 5fd4296a93..7f44059a01 100644
--- a/library/cpp/threading/future/core/future-inl.h
+++ b/library/cpp/threading/future/core/future-inl.h
@@ -167,20 +167,20 @@ namespace NThreading {
}
void SetException(std::exception_ptr e) {
- bool success = TrySetException(std::move(e));
- if (Y_UNLIKELY(!success)) {
- ythrow TFutureException() << "value already set";
- }
- }
-
- bool TrySetException(std::exception_ptr e) {
+ bool success = TrySetException(std::move(e));
+ if (Y_UNLIKELY(!success)) {
+ ythrow TFutureException() << "value already set";
+ }
+ }
+
+ bool TrySetException(std::exception_ptr e) {
TSystemEvent* readyEvent;
TCallbackList<T> callbacks;
with_lock (StateLock) {
int state = AtomicGet(State);
if (Y_UNLIKELY(state != NotReady)) {
- return false;
+ return false;
}
Exception = std::move(e);
@@ -201,8 +201,8 @@ namespace NThreading {
callback(temp);
}
}
-
- return true;
+
+ return true;
}
template <typename F>
@@ -353,20 +353,20 @@ namespace NThreading {
}
void SetException(std::exception_ptr e) {
- bool success = TrySetException(std::move(e));
- if (Y_UNLIKELY(!success)) {
- ythrow TFutureException() << "value already set";
- }
- }
-
- bool TrySetException(std::exception_ptr e) {
+ bool success = TrySetException(std::move(e));
+ if (Y_UNLIKELY(!success)) {
+ ythrow TFutureException() << "value already set";
+ }
+ }
+
+ bool TrySetException(std::exception_ptr e) {
TSystemEvent* readyEvent = nullptr;
TCallbackList<void> callbacks;
with_lock (StateLock) {
int state = AtomicGet(State);
if (Y_UNLIKELY(state != NotReady)) {
- return false;
+ return false;
}
Exception = std::move(e);
@@ -387,8 +387,8 @@ namespace NThreading {
callback(temp);
}
}
-
- return true;
+
+ return true;
}
template <typename F>
@@ -834,12 +834,12 @@ namespace NThreading {
}
template <typename T>
- inline bool TPromise<T>::TrySetException(std::exception_ptr e) {
- EnsureInitialized();
- return State->TrySetException(std::move(e));
- }
-
- template <typename T>
+ inline bool TPromise<T>::TrySetException(std::exception_ptr e) {
+ EnsureInitialized();
+ return State->TrySetException(std::move(e));
+ }
+
+ template <typename T>
inline TFuture<T> TPromise<T>::GetFuture() const {
EnsureInitialized();
return TFuture<T>(State);
@@ -912,11 +912,11 @@ namespace NThreading {
State->SetException(std::move(e));
}
- inline bool TPromise<void>::TrySetException(std::exception_ptr e) {
- EnsureInitialized();
- return State->TrySetException(std::move(e));
- }
-
+ inline bool TPromise<void>::TrySetException(std::exception_ptr e) {
+ EnsureInitialized();
+ return State->TrySetException(std::move(e));
+ }
+
inline TFuture<void> TPromise<void>::GetFuture() const {
EnsureInitialized();
return TFuture<void>(State);
diff --git a/library/cpp/threading/future/core/future.h b/library/cpp/threading/future/core/future.h
index 2e82bb953e..a4a1012352 100644
--- a/library/cpp/threading/future/core/future.h
+++ b/library/cpp/threading/future/core/future.h
@@ -216,7 +216,7 @@ namespace NThreading {
bool HasException() const;
void SetException(const TString& e);
void SetException(std::exception_ptr e);
- bool TrySetException(std::exception_ptr e);
+ bool TrySetException(std::exception_ptr e);
TFuture<T> GetFuture() const;
operator TFuture<T>() const;
@@ -256,7 +256,7 @@ namespace NThreading {
bool HasException() const;
void SetException(const TString& e);
void SetException(std::exception_ptr e);
- bool TrySetException(std::exception_ptr e);
+ bool TrySetException(std::exception_ptr e);
TFuture<void> GetFuture() const;
operator TFuture<void>() const;
diff --git a/library/cpp/threading/future/future_ut.cpp b/library/cpp/threading/future/future_ut.cpp
index 05950a568d..63fb4604be 100644
--- a/library/cpp/threading/future/future_ut.cpp
+++ b/library/cpp/threading/future/future_ut.cpp
@@ -507,18 +507,18 @@ namespace {
UNIT_ASSERT(!promise.TrySetValue(42));
}
- Y_UNIT_TEST(HandlingRepetitiveSetException) {
- TPromise<int> promise = NewPromise<int>();
- promise.SetException("test");
- UNIT_CHECK_GENERATED_EXCEPTION(promise.SetException("test"), TFutureException);
- }
-
- Y_UNIT_TEST(HandlingRepetitiveTrySetException) {
- TPromise<int> promise = NewPromise<int>();
- UNIT_ASSERT(promise.TrySetException(std::make_exception_ptr("test")));
- UNIT_ASSERT(!promise.TrySetException(std::make_exception_ptr("test")));
- }
-
+ Y_UNIT_TEST(HandlingRepetitiveSetException) {
+ TPromise<int> promise = NewPromise<int>();
+ promise.SetException("test");
+ UNIT_CHECK_GENERATED_EXCEPTION(promise.SetException("test"), TFutureException);
+ }
+
+ Y_UNIT_TEST(HandlingRepetitiveTrySetException) {
+ TPromise<int> promise = NewPromise<int>();
+ UNIT_ASSERT(promise.TrySetException(std::make_exception_ptr("test")));
+ UNIT_ASSERT(!promise.TrySetException(std::make_exception_ptr("test")));
+ }
+
Y_UNIT_TEST(ShouldAllowToMakeFutureWithException)
{
auto future1 = MakeErrorFuture<void>(std::make_exception_ptr(TFutureException()));
diff --git a/library/cpp/ya.make b/library/cpp/ya.make
index 8c1193b007..6a7bd206bd 100644
--- a/library/cpp/ya.make
+++ b/library/cpp/ya.make
@@ -1,6 +1,6 @@
-OWNER(g:cpp-contrib)
-
-RECURSE(
+OWNER(g:cpp-contrib)
+
+RECURSE(
accurate_accumulate
accurate_accumulate/benchmark
accurate_accumulate/benchmark/metrics
@@ -417,8 +417,8 @@ RECURSE(
yson_pull
yson_pull/ut
yt
- zipatch
-)
+ zipatch
+)
IF (OS_LINUX)
RECURSE(
@@ -437,7 +437,7 @@ IF (OS_WINDOWS)
)
ELSE()
RECURSE(
- fuse
+ fuse
sse/ut
tf
xdelta3
diff --git a/library/python/runtime_py3/main/get_py_main.cpp b/library/python/runtime_py3/main/get_py_main.cpp
index 67c400d4f4..38e0b3a32d 100644
--- a/library/python/runtime_py3/main/get_py_main.cpp
+++ b/library/python/runtime_py3/main/get_py_main.cpp
@@ -1,8 +1,8 @@
-#include <library/cpp/resource/resource.h>
-
-#include <stdlib.h>
-
-extern "C" char* GetPyMain() {
- TString res = NResource::Find("PY_MAIN");
- return strdup(res.c_str());
-}
+#include <library/cpp/resource/resource.h>
+
+#include <stdlib.h>
+
+extern "C" char* GetPyMain() {
+ TString res = NResource::Find("PY_MAIN");
+ return strdup(res.c_str());
+}
diff --git a/library/python/runtime_py3/main/main.c b/library/python/runtime_py3/main/main.c
index 3159800615..70983343c9 100644
--- a/library/python/runtime_py3/main/main.c
+++ b/library/python/runtime_py3/main/main.c
@@ -6,7 +6,7 @@
#include <locale.h>
void Py_InitArgcArgv(int argc, wchar_t **argv);
-char* GetPyMain();
+char* GetPyMain();
static const char* env_entry_point = "Y_PYTHON_ENTRY_POINT";
static const char* env_bytes_warning = "Y_PYTHON_BYTES_WARNING";
@@ -135,26 +135,26 @@ static int pymain(int argc, char** argv) {
}
const char* entry_point = getenv(env_entry_point);
- if (entry_point) {
- entry_point_copy = strdup(entry_point);
- if (!entry_point_copy) {
- fprintf(stderr, "out of memory\n");
- goto error;
- }
- } else {
- entry_point_copy = GetPyMain();
- }
-
- if (entry_point_copy == NULL) {
- fprintf(stderr, "No entry point, did you forget PY_MAIN?\n");
- goto error;
- }
-
- if (entry_point_copy && !strcmp(entry_point_copy, ":main")) {
+ if (entry_point) {
+ entry_point_copy = strdup(entry_point);
+ if (!entry_point_copy) {
+ fprintf(stderr, "out of memory\n");
+ goto error;
+ }
+ } else {
+ entry_point_copy = GetPyMain();
+ }
+
+ if (entry_point_copy == NULL) {
+ fprintf(stderr, "No entry point, did you forget PY_MAIN?\n");
+ goto error;
+ }
+
+ if (entry_point_copy && !strcmp(entry_point_copy, ":main")) {
unsetenv(env_entry_point);
- sts = Py_Main(argc, argv_copy);
- free(entry_point_copy);
- return sts;
+ sts = Py_Main(argc, argv_copy);
+ free(entry_point_copy);
+ return sts;
}
Py_InitArgcArgv(argc, argv_copy);
diff --git a/library/python/runtime_py3/main/ya.make b/library/python/runtime_py3/main/ya.make
index f308a93b28..ff0dd1d27f 100644
--- a/library/python/runtime_py3/main/ya.make
+++ b/library/python/runtime_py3/main/ya.make
@@ -7,7 +7,7 @@ OWNER(
PEERDIR(
contrib/tools/python3/src
- library/cpp/resource
+ library/cpp/resource
)
ADDINCL(
@@ -20,7 +20,7 @@ CFLAGS(
SRCS(
main.c
- get_py_main.cpp
+ get_py_main.cpp
)
END()
diff --git a/library/python/symbols/ya.make b/library/python/symbols/ya.make
index 340a710c48..83fb11be9d 100644
--- a/library/python/symbols/ya.make
+++ b/library/python/symbols/ya.make
@@ -5,7 +5,7 @@ RECURSE(
crypto
libc
- libmagic
+ libmagic
python
uuid
win_unicode_console
diff --git a/tools/fix_elf/patch.h b/tools/fix_elf/patch.h
index c3dcd24224..3cab456836 100644
--- a/tools/fix_elf/patch.h
+++ b/tools/fix_elf/patch.h
@@ -1,6 +1,6 @@
#pragma once
-#include "elf.h"
+#include "elf.h"
#include <util/generic/string.h>
#include <util/stream/file.h>
diff --git a/util/folder/path.cpp b/util/folder/path.cpp
index bfe0c67d68..256940d96d 100644
--- a/util/folder/path.cpp
+++ b/util/folder/path.cpp
@@ -387,39 +387,39 @@ void TFsPath::MkDirs(const int mode) const {
}
void TFsPath::ForceDelete() const {
- if (!IsDefined()) {
- return;
- }
-
- TFileStat stat(GetPath().c_str(), true);
- if (stat.IsNull()) {
- const int err = LastSystemError();
-#ifdef _win_
- if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) {
-#else
- if (err == ENOENT) {
-#endif
- return;
- } else {
- ythrow TIoException() << "failed to stat " << Path_;
- }
- }
-
- ClearLastSystemError();
- if (stat.IsDir()) {
+ if (!IsDefined()) {
+ return;
+ }
+
+ TFileStat stat(GetPath().c_str(), true);
+ if (stat.IsNull()) {
+ const int err = LastSystemError();
+#ifdef _win_
+ if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) {
+#else
+ if (err == ENOENT) {
+#endif
+ return;
+ } else {
+ ythrow TIoException() << "failed to stat " << Path_;
+ }
+ }
+
+ ClearLastSystemError();
+ if (stat.IsDir()) {
TVector<TFsPath> children;
List(children);
for (auto& i : children) {
i.ForceDelete();
}
- ::rmdir(this->c_str());
- } else {
- ::unlink(this->c_str());
- }
-
- if (LastSystemError()) {
- ythrow TIoException() << "failed to delete " << Path_;
- }
+ ::rmdir(this->c_str());
+ } else {
+ ::unlink(this->c_str());
+ }
+
+ if (LastSystemError()) {
+ ythrow TIoException() << "failed to delete " << Path_;
+ }
}
void TFsPath::CopyTo(const TString& newPath, bool force) const {
diff --git a/util/folder/path_ut.cpp b/util/folder/path_ut.cpp
index e6a3451016..8067cade1a 100644
--- a/util/folder/path_ut.cpp
+++ b/util/folder/path_ut.cpp
@@ -5,7 +5,7 @@
#include <library/cpp/testing/unittest/registar.h>
-#include <util/generic/scope.h>
+#include <util/generic/scope.h>
#include <util/system/platform.h>
#include <util/system/yassert.h>
#include <util/stream/output.h>
@@ -14,10 +14,10 @@
#include <algorithm>
-#ifdef _win_
- #include <aclapi.h>
-#endif
-
+#ifdef _win_
+ #include <aclapi.h>
+#endif
+
namespace {
/// empty directory for test that needs filesystem
/// recreates directory in constructor and removes directory in destructor
@@ -79,8 +79,8 @@ Y_UNIT_TEST_SUITE(TFsPathTests) {
Y_UNIT_TEST(MkDirFreak) {
TFsPath path;
- UNIT_ASSERT_EXCEPTION(path.MkDir(), TIoException);
- UNIT_ASSERT_EXCEPTION(path.MkDirs(), TIoException);
+ UNIT_ASSERT_EXCEPTION(path.MkDir(), TIoException);
+ UNIT_ASSERT_EXCEPTION(path.MkDirs(), TIoException);
path = ".";
path.MkDir();
path.MkDirs();
@@ -169,10 +169,10 @@ Y_UNIT_TEST_SUITE(TFsPathTests) {
}
Y_UNIT_TEST(TestRenameFail) {
- UNIT_ASSERT_EXCEPTION(TFsPath("sfsfsfsdfsfsdfdf").RenameTo("sdfsdf"), TIoException);
+ UNIT_ASSERT_EXCEPTION(TFsPath("sfsfsfsdfsfsdfdf").RenameTo("sdfsdf"), TIoException);
}
-#ifndef _win_
+#ifndef _win_
Y_UNIT_TEST(TestRealPath) {
UNIT_ASSERT(TFsPath(".").RealPath().IsDirectory());
@@ -188,7 +188,7 @@ Y_UNIT_TEST_SUITE(TFsPathTests) {
UNIT_ASSERT(NFs::SymLink(target2.RealPath(), link.GetPath()));
UNIT_ASSERT_VALUES_EQUAL(link.RealPath(), target2.RealPath()); // must not cache old value
}
-#endif
+#endif
Y_UNIT_TEST(TestSlashesAndBasename) {
TFsPath p("/db/BASE/primus121-025-1380131338//");
@@ -341,8 +341,8 @@ Y_UNIT_TEST_SUITE(TFsPathTests) {
UNIT_ASSERT_VALUES_EQUAL(TFsPath(".").RelativePath(TFsPath(".")), TFsPath());
UNIT_ASSERT_VALUES_EQUAL(TFsPath("/a/c").RelativePath(TFsPath("/a/b/../c")), TFsPath());
UNIT_ASSERT_VALUES_EQUAL(TFsPath("a/.././b").RelativePath(TFsPath("b/c")), TFsPath(".."));
-
- UNIT_ASSERT_EXCEPTION(TFsPath("a/b/c").RelativePath(TFsPath("d/e")), TIoException);
+
+ UNIT_ASSERT_EXCEPTION(TFsPath("a/b/c").RelativePath(TFsPath("d/e")), TIoException);
}
Y_UNIT_TEST(TestUndefined) {
@@ -526,287 +526,287 @@ Y_UNIT_TEST_SUITE(TFsPathTests) {
UNIT_ASSERT(NFs::Exists(originDir));
}
#endif
-
- Y_UNIT_TEST(TestForceDeleteNonexisting) {
- TTempDir tempDir;
- TFsPath nonexisting = TFsPath(tempDir()).Child("nonexisting");
- nonexisting.ForceDelete();
- }
-
- // Here we want to test that all possible errors during TFsPath::ForceDelete
- // are properly handled. To do so we have to trigger fs operation errors in
- // three points:
- // 1. stat/GetFileInformationByHandle
- // 2. opendir
- // 3. unlink/rmdir
- //
- // On unix systems we can achieve this by simply setting access rights on
- // entry being deleted and its parent. But on windows it is more complicated.
- // Current Chmod implementation on windows is not enough as it sets only
- // FILE_ATTRIBUTE_READONLY throught SetFileAttributes call. But doing so does
- // not affect directory access rights on older versions of Windows and Wine
- // that we use to run autocheck tests.
- //
- // To get required access rights we use DACL in SetSecurityInfo. This is wrapped
- // in RAII class that drops requested permissions on file/dir and grantss them
- // back in destructor.
- //
- // Another obstacle is FILE_LIST_DIRECTORY permission when running on Wine.
- // Dropping this permission is necessary to provoke error
- // in GetFileInformationByHandle. Wine allows dropping this permission, but I
- // have not found a way to grant it back. So tests crash during cleanup sequence.
- // To make it possible to run this tests natively we detect Wine with special
- // registry key and skip these tests only there.
-
-#ifdef _win_
- struct TLocalFree {
- static void Destroy(void* ptr) {
- LocalFree((HLOCAL)ptr);
- }
- };
-
- bool IsWine() {
- HKEY subKey = nullptr;
- LONG result = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Wine", 0, KEY_READ, &subKey);
- if (result == ERROR_SUCCESS) {
- return true;
- }
- result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Wine", 0, KEY_READ, &subKey);
- if (result == ERROR_SUCCESS) {
- return true;
- }
-
- HMODULE hntdll = GetModuleHandle("ntdll.dll");
- if (!hntdll) {
- return false;
- }
-
- auto func = GetProcAddress(hntdll, "wine_get_version");
- return func != nullptr;
- }
-
- class TWinFileDenyAccessScope {
- public:
- TWinFileDenyAccessScope(const TFsPath& name, DWORD permissions)
- : Name_(name)
- , Perms_(permissions)
- {
- DWORD res = 0;
- PACL oldAcl = nullptr;
- PSECURITY_DESCRIPTOR sd = nullptr;
-
- res = GetNamedSecurityInfoA((LPSTR)name.c_str(),
- SE_FILE_OBJECT,
- DACL_SECURITY_INFORMATION,
- nullptr,
- nullptr,
- &oldAcl,
- nullptr,
- &sd);
- SdHolder_.Reset(sd);
- if (res != ERROR_SUCCESS) {
- ythrow TSystemError(res) << "error in GetNamedSecurityInfoA";
- }
-
- Acl_ = SetAcl(oldAcl, DENY_ACCESS);
- }
-
- ~TWinFileDenyAccessScope() {
- try {
- const TFsPath parent = Name_.Parent();
- Chmod(parent.c_str(), MODE0777);
- Chmod(Name_.c_str(), MODE0777);
- SetAcl((PACL)Acl_.Get(), GRANT_ACCESS);
- } catch (const yexception& ex) {
- Cerr << "~TWinFileDenyAccessScope failed: " << ex.AsStrBuf() << Endl;
- }
- }
-
- THolder<void, TLocalFree> SetAcl(PACL oldAcl, ACCESS_MODE accessMode) {
- DWORD res = 0;
- EXPLICIT_ACCESS ea;
- PACL newAcl = nullptr;
- THolder<void, TLocalFree> newAclHolder;
-
- memset(&ea, 0, sizeof(EXPLICIT_ACCESS));
- ea.grfAccessPermissions = Perms_;
- ea.grfAccessMode = accessMode;
- ea.grfInheritance = NO_INHERITANCE;
- ea.Trustee.TrusteeForm = TRUSTEE_IS_NAME;
- ea.Trustee.ptstrName = (LPSTR) "CURRENT_USER";
-
- res = SetEntriesInAcl(1, &ea, oldAcl, &newAcl);
- newAclHolder.Reset(newAcl);
- if (res != ERROR_SUCCESS) {
- ythrow TSystemError(res) << "error in SetEntriesInAcl";
- }
-
- res = SetNamedSecurityInfoA((LPSTR)Name_.c_str(),
- SE_FILE_OBJECT,
- DACL_SECURITY_INFORMATION,
- nullptr,
- nullptr,
- newAcl,
- nullptr);
- if (res != ERROR_SUCCESS) {
- ythrow TSystemError(res) << "error in SetNamedSecurityInfoA";
- }
-
- return std::move(newAclHolder);
- }
-
- private:
- const TFsPath Name_;
- const DWORD Perms_;
- THolder<void, TLocalFree> SdHolder_;
- THolder<void, TLocalFree> Acl_;
- };
-#endif
-
- Y_UNIT_TEST(TestForceDeleteErrorUnlink) {
- TTempDir tempDir;
-
- const TFsPath testDir = TFsPath(tempDir()).Child("dir");
- MakePathIfNotExist(testDir.c_str());
-
- const TFsPath testFile = testDir.Child("file");
- {
- TFixedBufferFileOutput out(testFile);
- out << "data111!!!";
- }
-
-#ifdef _win_
- Chmod(testFile.c_str(), S_IRUSR);
- Y_DEFER {
- Chmod(testFile.c_str(), MODE0777);
- };
-#else
- Chmod(testDir.c_str(), S_IRUSR | S_IXUSR);
- Y_DEFER {
- Chmod(testDir.c_str(), MODE0777);
- };
-#endif
-
- UNIT_ASSERT_EXCEPTION_CONTAINS(testFile.ForceDelete(), TIoException, "failed to delete");
- }
-
- Y_UNIT_TEST(TestForceDeleteErrorRmdir) {
- TTempDir tempDir;
-
- const TFsPath testDir = TFsPath(tempDir()).Child("dir");
- const TFsPath testSubdir = testDir.Child("file");
- MakePathIfNotExist(testSubdir.c_str());
-
-#ifdef _win_
- Chmod(testSubdir.c_str(), 0);
- Y_DEFER {
- Chmod(testSubdir.c_str(), MODE0777);
- };
- TWinFileDenyAccessScope dirAcl(testDir, FILE_WRITE_DATA);
-#else
- Chmod(testDir.c_str(), S_IRUSR | S_IXUSR);
- Y_DEFER {
- Chmod(testDir.c_str(), MODE0777);
- };
-#endif
-
- UNIT_ASSERT_EXCEPTION_CONTAINS(testSubdir.ForceDelete(), TIoException, "failed to delete");
- }
-
- Y_UNIT_TEST(TestForceDeleteErrorStatDir) {
- TTempDir tempDir;
-
- const TFsPath testDir = TFsPath(tempDir()).Child("dir");
- const TFsPath testSubdir = testDir.Child("file");
- MakePathIfNotExist(testSubdir.c_str());
-
-#ifdef _win_
- if (IsWine()) {
- // FILE_LIST_DIRECTORY seem to be irreversible on wine
- return;
- }
- TWinFileDenyAccessScope subdirAcl(testSubdir, FILE_READ_ATTRIBUTES);
- TWinFileDenyAccessScope dirAcl(testDir, FILE_LIST_DIRECTORY);
-#else
- Chmod(testDir.c_str(), 0);
- Y_DEFER {
- Chmod(testDir.c_str(), MODE0777);
- };
-#endif
-
- UNIT_ASSERT_EXCEPTION_CONTAINS(testSubdir.ForceDelete(), TIoException, "failed to stat");
- }
-
- Y_UNIT_TEST(TestForceDeleteErrorStatFile) {
- TTempDir tempDir;
-
- const TFsPath testDir = TFsPath(tempDir()).Child("dir");
- MakePathIfNotExist(testDir.c_str());
-
- const TFsPath testFile = testDir.Child("file");
- {
- TFixedBufferFileOutput out(testFile);
- out << "data111!!!";
- }
-
-#ifdef _win_
- if (IsWine()) {
- // FILE_LIST_DIRECTORY seem to be irreversible on wine
- return;
- }
- TWinFileDenyAccessScope fileAcl(testFile, FILE_READ_ATTRIBUTES);
- TWinFileDenyAccessScope dirAcl(testDir, FILE_LIST_DIRECTORY);
-#else
- Chmod(testDir.c_str(), 0);
- Y_DEFER {
- Chmod(testDir.c_str(), MODE0777);
- };
-#endif
-
- UNIT_ASSERT_EXCEPTION_CONTAINS(testFile.ForceDelete(), TIoException, "failed to stat");
- }
-
- Y_UNIT_TEST(TestForceDeleteErrorListDir) {
- TTempDir tempDir;
-
- const TFsPath testDir = TFsPath(tempDir()).Child("dir");
- const TFsPath testSubdir = testDir.Child("file");
- MakePathIfNotExist(testSubdir.c_str());
-
-#ifdef _win_
- if (IsWine()) {
- // FILE_LIST_DIRECTORY seem to be irreversible on wine
- return;
- }
- TWinFileDenyAccessScope subdirAcl(testSubdir, FILE_LIST_DIRECTORY);
-#else
- Chmod(testSubdir.c_str(), 0);
- Y_DEFER {
- Chmod(testSubdir.c_str(), MODE0777);
- };
-#endif
-
- UNIT_ASSERT_EXCEPTION_CONTAINS(testSubdir.ForceDelete(), TIoException, "failed to opendir");
- }
-
-#ifdef _unix_
- Y_UNIT_TEST(TestForceDeleteErrorSymlink) {
- TTempDir tempDir;
-
- const TFsPath testDir = TFsPath(tempDir()).Child("dir");
- MakePathIfNotExist(testDir.c_str());
-
- const TFsPath testSymlink = testDir.Child("symlink");
- NFs::SymLink("something", testSymlink);
-
- Chmod(testSymlink.c_str(), S_IRUSR);
- Chmod(testDir.c_str(), S_IRUSR | S_IXUSR);
- Y_DEFER {
- Chmod(testDir.c_str(), MODE0777);
- Chmod(testSymlink.c_str(), MODE0777);
- };
-
- UNIT_ASSERT_EXCEPTION_CONTAINS(testSymlink.ForceDelete(), TIoException, "failed to delete");
- }
-#endif
+
+ Y_UNIT_TEST(TestForceDeleteNonexisting) {
+ TTempDir tempDir;
+ TFsPath nonexisting = TFsPath(tempDir()).Child("nonexisting");
+ nonexisting.ForceDelete();
+ }
+
+ // Here we want to test that all possible errors during TFsPath::ForceDelete
+ // are properly handled. To do so we have to trigger fs operation errors in
+ // three points:
+ // 1. stat/GetFileInformationByHandle
+ // 2. opendir
+ // 3. unlink/rmdir
+ //
+ // On unix systems we can achieve this by simply setting access rights on
+ // entry being deleted and its parent. But on windows it is more complicated.
+ // Current Chmod implementation on windows is not enough as it sets only
+ // FILE_ATTRIBUTE_READONLY throught SetFileAttributes call. But doing so does
+ // not affect directory access rights on older versions of Windows and Wine
+ // that we use to run autocheck tests.
+ //
+ // To get required access rights we use DACL in SetSecurityInfo. This is wrapped
+ // in RAII class that drops requested permissions on file/dir and grantss them
+ // back in destructor.
+ //
+ // Another obstacle is FILE_LIST_DIRECTORY permission when running on Wine.
+ // Dropping this permission is necessary to provoke error
+ // in GetFileInformationByHandle. Wine allows dropping this permission, but I
+ // have not found a way to grant it back. So tests crash during cleanup sequence.
+ // To make it possible to run this tests natively we detect Wine with special
+ // registry key and skip these tests only there.
+
+#ifdef _win_
+ struct TLocalFree {
+ static void Destroy(void* ptr) {
+ LocalFree((HLOCAL)ptr);
+ }
+ };
+
+ bool IsWine() {
+ HKEY subKey = nullptr;
+ LONG result = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Wine", 0, KEY_READ, &subKey);
+ if (result == ERROR_SUCCESS) {
+ return true;
+ }
+ result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Wine", 0, KEY_READ, &subKey);
+ if (result == ERROR_SUCCESS) {
+ return true;
+ }
+
+ HMODULE hntdll = GetModuleHandle("ntdll.dll");
+ if (!hntdll) {
+ return false;
+ }
+
+ auto func = GetProcAddress(hntdll, "wine_get_version");
+ return func != nullptr;
+ }
+
+ class TWinFileDenyAccessScope {
+ public:
+ TWinFileDenyAccessScope(const TFsPath& name, DWORD permissions)
+ : Name_(name)
+ , Perms_(permissions)
+ {
+ DWORD res = 0;
+ PACL oldAcl = nullptr;
+ PSECURITY_DESCRIPTOR sd = nullptr;
+
+ res = GetNamedSecurityInfoA((LPSTR)name.c_str(),
+ SE_FILE_OBJECT,
+ DACL_SECURITY_INFORMATION,
+ nullptr,
+ nullptr,
+ &oldAcl,
+ nullptr,
+ &sd);
+ SdHolder_.Reset(sd);
+ if (res != ERROR_SUCCESS) {
+ ythrow TSystemError(res) << "error in GetNamedSecurityInfoA";
+ }
+
+ Acl_ = SetAcl(oldAcl, DENY_ACCESS);
+ }
+
+ ~TWinFileDenyAccessScope() {
+ try {
+ const TFsPath parent = Name_.Parent();
+ Chmod(parent.c_str(), MODE0777);
+ Chmod(Name_.c_str(), MODE0777);
+ SetAcl((PACL)Acl_.Get(), GRANT_ACCESS);
+ } catch (const yexception& ex) {
+ Cerr << "~TWinFileDenyAccessScope failed: " << ex.AsStrBuf() << Endl;
+ }
+ }
+
+ THolder<void, TLocalFree> SetAcl(PACL oldAcl, ACCESS_MODE accessMode) {
+ DWORD res = 0;
+ EXPLICIT_ACCESS ea;
+ PACL newAcl = nullptr;
+ THolder<void, TLocalFree> newAclHolder;
+
+ memset(&ea, 0, sizeof(EXPLICIT_ACCESS));
+ ea.grfAccessPermissions = Perms_;
+ ea.grfAccessMode = accessMode;
+ ea.grfInheritance = NO_INHERITANCE;
+ ea.Trustee.TrusteeForm = TRUSTEE_IS_NAME;
+ ea.Trustee.ptstrName = (LPSTR) "CURRENT_USER";
+
+ res = SetEntriesInAcl(1, &ea, oldAcl, &newAcl);
+ newAclHolder.Reset(newAcl);
+ if (res != ERROR_SUCCESS) {
+ ythrow TSystemError(res) << "error in SetEntriesInAcl";
+ }
+
+ res = SetNamedSecurityInfoA((LPSTR)Name_.c_str(),
+ SE_FILE_OBJECT,
+ DACL_SECURITY_INFORMATION,
+ nullptr,
+ nullptr,
+ newAcl,
+ nullptr);
+ if (res != ERROR_SUCCESS) {
+ ythrow TSystemError(res) << "error in SetNamedSecurityInfoA";
+ }
+
+ return std::move(newAclHolder);
+ }
+
+ private:
+ const TFsPath Name_;
+ const DWORD Perms_;
+ THolder<void, TLocalFree> SdHolder_;
+ THolder<void, TLocalFree> Acl_;
+ };
+#endif
+
+ Y_UNIT_TEST(TestForceDeleteErrorUnlink) {
+ TTempDir tempDir;
+
+ const TFsPath testDir = TFsPath(tempDir()).Child("dir");
+ MakePathIfNotExist(testDir.c_str());
+
+ const TFsPath testFile = testDir.Child("file");
+ {
+ TFixedBufferFileOutput out(testFile);
+ out << "data111!!!";
+ }
+
+#ifdef _win_
+ Chmod(testFile.c_str(), S_IRUSR);
+ Y_DEFER {
+ Chmod(testFile.c_str(), MODE0777);
+ };
+#else
+ Chmod(testDir.c_str(), S_IRUSR | S_IXUSR);
+ Y_DEFER {
+ Chmod(testDir.c_str(), MODE0777);
+ };
+#endif
+
+ UNIT_ASSERT_EXCEPTION_CONTAINS(testFile.ForceDelete(), TIoException, "failed to delete");
+ }
+
+ Y_UNIT_TEST(TestForceDeleteErrorRmdir) {
+ TTempDir tempDir;
+
+ const TFsPath testDir = TFsPath(tempDir()).Child("dir");
+ const TFsPath testSubdir = testDir.Child("file");
+ MakePathIfNotExist(testSubdir.c_str());
+
+#ifdef _win_
+ Chmod(testSubdir.c_str(), 0);
+ Y_DEFER {
+ Chmod(testSubdir.c_str(), MODE0777);
+ };
+ TWinFileDenyAccessScope dirAcl(testDir, FILE_WRITE_DATA);
+#else
+ Chmod(testDir.c_str(), S_IRUSR | S_IXUSR);
+ Y_DEFER {
+ Chmod(testDir.c_str(), MODE0777);
+ };
+#endif
+
+ UNIT_ASSERT_EXCEPTION_CONTAINS(testSubdir.ForceDelete(), TIoException, "failed to delete");
+ }
+
+ Y_UNIT_TEST(TestForceDeleteErrorStatDir) {
+ TTempDir tempDir;
+
+ const TFsPath testDir = TFsPath(tempDir()).Child("dir");
+ const TFsPath testSubdir = testDir.Child("file");
+ MakePathIfNotExist(testSubdir.c_str());
+
+#ifdef _win_
+ if (IsWine()) {
+ // FILE_LIST_DIRECTORY seem to be irreversible on wine
+ return;
+ }
+ TWinFileDenyAccessScope subdirAcl(testSubdir, FILE_READ_ATTRIBUTES);
+ TWinFileDenyAccessScope dirAcl(testDir, FILE_LIST_DIRECTORY);
+#else
+ Chmod(testDir.c_str(), 0);
+ Y_DEFER {
+ Chmod(testDir.c_str(), MODE0777);
+ };
+#endif
+
+ UNIT_ASSERT_EXCEPTION_CONTAINS(testSubdir.ForceDelete(), TIoException, "failed to stat");
+ }
+
+ Y_UNIT_TEST(TestForceDeleteErrorStatFile) {
+ TTempDir tempDir;
+
+ const TFsPath testDir = TFsPath(tempDir()).Child("dir");
+ MakePathIfNotExist(testDir.c_str());
+
+ const TFsPath testFile = testDir.Child("file");
+ {
+ TFixedBufferFileOutput out(testFile);
+ out << "data111!!!";
+ }
+
+#ifdef _win_
+ if (IsWine()) {
+ // FILE_LIST_DIRECTORY seem to be irreversible on wine
+ return;
+ }
+ TWinFileDenyAccessScope fileAcl(testFile, FILE_READ_ATTRIBUTES);
+ TWinFileDenyAccessScope dirAcl(testDir, FILE_LIST_DIRECTORY);
+#else
+ Chmod(testDir.c_str(), 0);
+ Y_DEFER {
+ Chmod(testDir.c_str(), MODE0777);
+ };
+#endif
+
+ UNIT_ASSERT_EXCEPTION_CONTAINS(testFile.ForceDelete(), TIoException, "failed to stat");
+ }
+
+ Y_UNIT_TEST(TestForceDeleteErrorListDir) {
+ TTempDir tempDir;
+
+ const TFsPath testDir = TFsPath(tempDir()).Child("dir");
+ const TFsPath testSubdir = testDir.Child("file");
+ MakePathIfNotExist(testSubdir.c_str());
+
+#ifdef _win_
+ if (IsWine()) {
+ // FILE_LIST_DIRECTORY seem to be irreversible on wine
+ return;
+ }
+ TWinFileDenyAccessScope subdirAcl(testSubdir, FILE_LIST_DIRECTORY);
+#else
+ Chmod(testSubdir.c_str(), 0);
+ Y_DEFER {
+ Chmod(testSubdir.c_str(), MODE0777);
+ };
+#endif
+
+ UNIT_ASSERT_EXCEPTION_CONTAINS(testSubdir.ForceDelete(), TIoException, "failed to opendir");
+ }
+
+#ifdef _unix_
+ Y_UNIT_TEST(TestForceDeleteErrorSymlink) {
+ TTempDir tempDir;
+
+ const TFsPath testDir = TFsPath(tempDir()).Child("dir");
+ MakePathIfNotExist(testDir.c_str());
+
+ const TFsPath testSymlink = testDir.Child("symlink");
+ NFs::SymLink("something", testSymlink);
+
+ Chmod(testSymlink.c_str(), S_IRUSR);
+ Chmod(testDir.c_str(), S_IRUSR | S_IXUSR);
+ Y_DEFER {
+ Chmod(testDir.c_str(), MODE0777);
+ Chmod(testSymlink.c_str(), MODE0777);
+ };
+
+ UNIT_ASSERT_EXCEPTION_CONTAINS(testSymlink.ForceDelete(), TIoException, "failed to delete");
+ }
+#endif
}
diff --git a/util/system/fstat.cpp b/util/system/fstat.cpp
index 81e98cbc6b..bd2af46fce 100644
--- a/util/system/fstat.cpp
+++ b/util/system/fstat.cpp
@@ -87,9 +87,9 @@ static bool GetStatByName(TSystemFStat& fs, const char* fileName, bool nofollow)
TFileHandle h = NFsPrivate::CreateFileWithUtf8Name(fileName, FILE_READ_ATTRIBUTES | FILE_READ_EA, FILE_SHARE_READ | FILE_SHARE_WRITE,
OPEN_EXISTING,
(nofollow ? FILE_FLAG_OPEN_REPARSE_POINT : 0) | FILE_FLAG_BACKUP_SEMANTICS, true);
- if (!h.IsOpen()) {
- return false;
- }
+ if (!h.IsOpen()) {
+ return false;
+ }
return GetStatByHandle(fs, h);
#else
return !(nofollow ? lstat : stat)(fileName, &fs);