Checkout
Stefan Sperling
committed
on 03 Oct 10
Ensure the correct type of NULL pointer is passed as a sentinel to the
variadic function apr_pstrcat().

Starting with version 4, gcc has be… Show more
Ensure the correct type of NULL pointer is passed as a sentinel to the

variadic function apr_pstrcat().

Starting with version 4, gcc has been printing irritating warnings about

"missing sentinels in function call" for virtually every call to apr_pstrcat().

There is an issue about this in the APR bug tracker:

https://issues.apache.org/bugzilla/show_bug.cgi?id=47191

The fix proposed there is to include stddef.h in apr.h, in order to make

sure that NULL is defined as a pointer type, such as (void *)0.

Unfortunately, this doesn't work for all systems, since some (e.g. OpenBSD)

define NULL as 0L, rather than (void *)0.

So in spite of regrets about churn, I whipped up a sed script that changed

all places triggering the warning to use (char *)NULL instead of NULL as

sentinel, and adjusted the result to fix overlong lines and other minor

formatting issues. This fixes all current instances of the warning for me,

making it much easier to spot important warnings.  No functional change.

* subversion/mod_authz_svn/mod_authz_svn.c

 (get_access_conf, req_check_access, req_check_access): Use (char *)NULL

  as sentinel for apr_pstrcat(), instead of NULL.

* subversion/libsvn_fs_base/lock.c

 (svn_fs_base__generate_lock_token): Same.

* subversion/libsvn_fs_base/bdb/locks-table.c

 (svn_fs_bdb__locks_get): Same.

* subversion/libsvn_ra_local/ra_plugin.c

 (svn_ra_local__reparent): Same.

* subversion/libsvn_ra_svn/cyrus_auth.c

 (try_auth, svn_ra_svn__get_addresses, svn_ra_svn__do_cyrus_auth): Same.

* subversion/libsvn_ra_svn/client.c

 (ra_svn_get_locks): Same.

* subversion/mod_dav_svn/mirror.c

 (static void proxy_request_fixup, dav_svn__proxy_request_fixup,

  dav_svn__location_header_filter): Same.

* subversion/mod_dav_svn/reports/update.c

 (malformed_element_error): Same.

* subversion/mod_dav_svn/reports/replay.c

 (malformed_element_error): Same.

* subversion/mod_dav_svn/mod_dav_svn.c

 (dav_svn__get_special_uri): Same.

* subversion/mod_dav_svn/lock.c

 (svn_lock_to_dav_lock, unescape_xml): Same.

* subversion/mod_dav_svn/repos.c

 (create_private_resource, get_parentpath_resource, get_resource,

  deliver, do_walk, dav_svn__create_working_resource): Same.

* subversion/mod_dav_svn/version.c

 (get_option): Same.

* subversion/libsvn_ra_neon/get_locks.c

 (svn_ra_neon__get_locks): Same.

* subversion/libsvn_ra_neon/session.c

 (svn_ra_neon__open): Same.

* subversion/libsvn_ra_neon/lock.c

 (do_lock): Same.

* subversion/libsvn_ra_neon/props.c

 (end_element, svn_ra_neon__get_props, svn_ra_neon__get_one_prop,

  append_setprop): Same.

* subversion/libsvn_ra_neon/fetch.c

 (add_props, filter_props, end_element): Same.

* subversion/libsvn_ra_serf/getlocks.c

 (svn_ra_serf__get_locks): Same.

* subversion/libsvn_ra_serf/locks.c

 (svn_ra_serf__unlock): Same.

* subversion/libsvn_ra_serf/update.c

 (link_path): Same.

* subversion/libsvn_ra_serf/serf.c

 (svn_ra_serf__open): Same.

* subversion/libsvn_ra_serf/property.c

 (set_bare_props, svn_ra_serf__set_baton_props,

  svn_ra_serf__set_baton_props): Same.

* subversion/libsvn_ra_serf/commit.c

 (proppatch_walker, setup_proppatch_headers,

  setup_put_headers, setup_delete_headers): Same.

* subversion/libsvn_fs_fs/caching.c

 (svn_fs_fs__initialize_caches): Same.

* subversion/libsvn_fs_fs/lock.c

 (svn_fs_fs__generate_lock_token): Same.

* subversion/libsvn_fs_fs/fs_fs.c

 (path_txn_dir, path_txn_proto_rev, path_txn_proto_rev_lock,

  path_txn_node_props, create_txn_dir, get_new_txn_node_id,

  svn_fs_fs__reserve_copy_id, svn_fs_fs__set_uuid): Same.

* subversion/svn/notify.c

 (notify): Same.

* subversion/svn/conflict-callbacks.c

 (svn_cl__conflict_handler): Same.

* subversion/libsvn_subr/auth.c

 (svn_auth_first_credentials): Same.

* subversion/libsvn_subr/checksum.c

 (svn_checksum_serialize): Same.

* subversion/libsvn_subr/cache-memcache.c

 (build_key): Same.

* subversion/libsvn_subr/log.c

 (log_depth): Same.

* subversion/libsvn_subr/utf.c

 (get_xlate_key, invalid_utf8): Same.

* subversion/libsvn_subr/opt.c

 (svn_opt_format_option, svn_opt__args_to_target_array): Same.

* subversion/libsvn_subr/dirent_uri.c

 (svn_uri_get_file_url_from_dirent): Same.

* subversion/libsvn_subr/sqlite.c

 (internal_open): Same.

* subversion/tests/libsvn_ra_local/ra-local-test.c

 (check_split_url): Same.

* subversion/tests/libsvn_repos/repos-test.c

 (print_chrevs): Same.

* subversion/tests/libsvn_subr/translate-test.c

 (substitute_and_verify): Same.

* subversion/tests/libsvn_subr/config-test.c

 (test_text_retrieval, test_boolean_retrieval, test_has_section): Same.

* subversion/tests/libsvn_subr/dirent_uri-test.c

 (test_dirent_get_absolute): Same.

* subversion/tests/libsvn_subr/target-test.c

 (condense_targets_tests_helper): Same.

* subversion/libsvn_wc/adm_files.c

 (simple_extend): Same.

* subversion/libsvn_wc/update_editor.c

 (create_tree_conflict): Same.

* subversion/libsvn_wc/old-and-busted.c

 (svn_wc__serialize_file_external): Same.

* subversion/libsvn_wc/upgrade.c

 (migrate_node_props): Same.

* subversion/libsvn_wc/wc_db.c

 (construct_like_arg, wclock_obtain_cb): Same.

* subversion/libsvn_client/util.c

 (svn_client__path_relative_to_root): Same.

* subversion/libsvn_client/info.c

 (push_dir_info): Same.

* subversion/libsvn_client/mergeinfo.c

 (svn_client__mergeinfo_from_segments): Same.

* subversion/libsvn_client/cmdline.c

 (resolve_repos_relative_url, svn_client_args_to_target_array,

 (svn_client_args_to_target_array): Same.

* subversion/libsvn_client/externals.c

 (resolve_relative_external_url): Same.

* subversion/libsvn_client/patch.c

 (copy_lines_to_target): Same.

* subversion/libsvn_repos/hooks.c

 (check_hook_cmd): Same.

* subversion/libsvn_repos/rev_hunt.c

 (svn_repos_trace_node_locations, svn_repos_node_location_segments): Same.

* subversion/libsvn_repos/authz.c

 (authz_get_path_access, authz_get_tree_access,

  authz_get_global_access): Same.

* subversion/libsvn_repos/reporter.c

 (add_file_smartly): Same.

Show less