Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/dso.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/dso.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/dso.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/dso.c Wed Feb 25 08:15:39 2015 @@ -28,6 +28,7 @@ #include "svn_private_config.h" #include "private/svn_mutex.h" +#include "private/svn_atomic.h" /* A mutex to protect our global pool and cache. */ static svn_mutex__t *dso_mutex = NULL; @@ -41,18 +42,18 @@ static apr_hash_t *dso_cache; /* Just an arbitrary location in memory... */ static int not_there_sentinel; +static volatile svn_atomic_t atomic_init_status = 0; + /* A specific value we store in the dso_cache to indicate that the library wasn't found. This keeps us from allocating extra memory from dso_pool when trying to find libraries we already know aren't there. */ #define NOT_THERE ((void *) ¬_there_sentinel) -svn_error_t * -svn_dso_initialize2(void) +static svn_error_t * +atomic_init_func(void *baton, + apr_pool_t *pool) { - if (dso_pool) - return SVN_NO_ERROR; - dso_pool = svn_pool_create(NULL); SVN_ERR(svn_mutex__init(&dso_mutex, TRUE, dso_pool)); @@ -61,6 +62,15 @@ svn_dso_initialize2(void) return SVN_NO_ERROR; } +svn_error_t * +svn_dso_initialize2(void) +{ + SVN_ERR(svn_atomic__init_once(&atomic_init_status, atomic_init_func, + NULL, NULL)); + + return SVN_NO_ERROR; +} + #if APR_HAS_DSO static svn_error_t * svn_dso_load_internal(apr_dso_handle_t **dso, const char *fname) @@ -107,8 +117,7 @@ svn_dso_load_internal(apr_dso_handle_t * svn_error_t * svn_dso_load(apr_dso_handle_t **dso, const char *fname) { - if (! dso_pool) - SVN_ERR(svn_dso_initialize2()); + SVN_ERR(svn_dso_initialize2()); SVN_MUTEX__WITH_LOCK(dso_mutex, svn_dso_load_internal(dso, fname));
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/fnv1a.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/fnv1a.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/fnv1a.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/fnv1a.c Wed Feb 25 08:15:39 2015 @@ -34,7 +34,7 @@ */ /* FNV-1 32 bit constants taken from - * http://www.isthe.com/chongo/tech/comp/fnv/ + * http://www.isthe.com/chongo/tech/comp/fnv/ */ #define FNV1_PRIME_32 0x01000193 #define FNV1_BASE_32 2166136261U @@ -47,7 +47,7 @@ fnv1a_32(apr_uint32_t hash, const void * { const unsigned char *data = input; const unsigned char *end = data + len; - + for (; data != end; ++data) { hash ^= *data; @@ -142,7 +142,7 @@ svn_fnv1a_32__context_create(apr_pool_t { svn_fnv1a_32__context_t *context = apr_palloc(pool, sizeof(*context)); context->hash = FNV1_BASE_32; - + return context; } @@ -203,7 +203,7 @@ svn_fnv1a_32x4__update(svn_fnv1a_32x4__c memcpy(context->buffer + context->buffered, data, to_copy); data = (const char *)data + to_copy; len -= to_copy; - + fnv1a_32x4(context->hashes, context->buffer, SCALING); context->buffered = 0; } Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/gpg_agent.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/gpg_agent.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/gpg_agent.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/gpg_agent.c Wed Feb 25 08:15:39 2015 @@ -209,7 +209,7 @@ find_running_gpg_agent(int *new_sd, apr_ /* This implements the method of finding the socket as described in * the gpg-agent man page under the --use-standard-socket option. - * The manage page misleadingly says the standard socket is + * The manage page misleadingly says the standard socket is * "named 'S.gpg-agent' located in the home directory." The standard * socket path is actually in the .gnupg directory in the home directory, * i.e. ~/.gnupg/S.gpg-agent */ @@ -219,7 +219,7 @@ find_running_gpg_agent(int *new_sd, apr_ apr_array_header_t *socket_details; /* For reference GPG_AGENT_INFO consists of 3 : separated fields. - * The path to the socket, the pid of the gpg-agent process and + * The path to the socket, the pid of the gpg-agent process and * finally the version of the protocol the agent talks. */ socket_details = svn_cstring_split(gpg_agent_info, ":", TRUE, pool); Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/hash.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/hash.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/hash.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/hash.c Wed Feb 25 08:15:39 2015 @@ -597,14 +597,14 @@ svn_hash__get_bool(apr_hash_t *hash, con /*** Optimized hash function ***/ -/* apr_hashfunc_t optimized for the key that we use in SVN: paths and +/* apr_hashfunc_t optimized for the key that we use in SVN: paths and * property names. Its primary goal is speed for keys of known length. - * + * * Since strings tend to spawn large value spaces (usually differ in many * bits with differences spanning a larger section of the key), we can be * quite sloppy extracting a hash value. The more keys there are in a * hash container, the more bits of the value returned by this function - * will be used. For a small number of string keys, choosing bits from any + * will be used. For a small number of string keys, choosing bits from any * any fix location close to the tail of those keys would usually be good * enough to prevent high collision rates. */ Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/io.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/io.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/io.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/io.c Wed Feb 25 08:15:39 2015 @@ -2387,7 +2387,7 @@ stringbuf_from_aprfile(svn_stringbuf_t * res_initial_len, &res->len, &eof, pool)); res->data[res->len] = 0; - + *result = res; return SVN_NO_ERROR; } Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/object_pool.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/object_pool.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/object_pool.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/object_pool.c Wed Feb 25 08:15:39 2015 @@ -85,7 +85,7 @@ struct svn_object_pool__t /* the root pool owning this structure */ apr_pool_t *pool; - + /* extractor and updater for the user object wrappers */ svn_object_pool__getter_t getter; svn_object_pool__setter_t setter; @@ -171,7 +171,7 @@ static void add_object_ref(object_ref_t *object_ref, apr_pool_t *pool) { - /* Update ref counter. + /* Update ref counter. Note that this is racy with object_ref_cleanup; see comment there. */ if (svn_atomic_inc(&object_ref->ref_count) == 0) svn_atomic_dec(&object_ref->object_pool->unused_count); @@ -275,7 +275,7 @@ insert(void **object, svn_atomic_inc(&object_pool->object_count); /* the new entry is *not* in use yet. - * add_object_ref will update counters again. + * add_object_ref will update counters again. */ svn_atomic_inc(&object_ref->object_pool->unused_count); } @@ -345,7 +345,7 @@ svn_object_pool__create(svn_object_pool_ */ apr_pool_cleanup_register(pool, result, object_pool_cleanup, apr_pool_cleanup_null); - + *object_pool = result; return SVN_NO_ERROR; } Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/packed_data.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/packed_data.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/packed_data.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/packed_data.c Wed Feb 25 08:15:39 2015 @@ -39,7 +39,7 @@ typedef struct packed_int_private_t { /* First sub-stream, if any. NULL otherwise. */ svn_packed__int_stream_t *first_substream; - + /* Last sub-stream, if any. NULL otherwise. */ svn_packed__int_stream_t *last_substream; @@ -66,7 +66,7 @@ typedef struct packed_int_private_t /* Deltify data before storing it in PACKED. */ svn_boolean_t diff; - + /* Numbers are likely to contain negative values with small absolutes. If TRUE, store the signed bit in LSB before encoding. */ svn_boolean_t is_signed; @@ -141,7 +141,7 @@ svn_packed__data_create_root(apr_pool_t { svn_packed__data_root_t *root = apr_pcalloc(pool, sizeof(*root)); root->pool = pool; - + return root; } @@ -160,7 +160,7 @@ svn_packed__create_int_stream(svn_packed private_data->is_signed = signed_ints; private_data->is_last = TRUE; private_data->pool = root->pool; - + stream->buffer_used = 0; stream->private_data = private_data; @@ -564,7 +564,7 @@ write_stream_data(svn_stream_t *stream, SVN_ERR(svn__compress(uncompressed, compressed, SVN_DELTA_COMPRESSION_LEVEL_DEFAULT)); - + SVN_ERR(write_stream_uint(stream, compressed->len)); SVN_ERR(svn_stream_write(stream, compressed->data, &compressed->len)); @@ -587,7 +587,7 @@ svn_packed__data_write(svn_stream_t *str = svn_stringbuf_create_ensure(1024, scratch_pool); svn_stringbuf_t *uncompressed = svn_stringbuf_create_ensure(1024, scratch_pool); - + /* write tree structure */ svn_stringbuf_t *tree_struct = svn_stringbuf_create_ensure(127, scratch_pool); @@ -613,7 +613,7 @@ svn_packed__data_write(svn_stream_t *str append_int_stream(int_stream, uncompressed); SVN_ERR(write_stream_data(stream, uncompressed, compressed)); } - + for (byte_stream = root->first_byte_stream; byte_stream; byte_stream = byte_stream->next) @@ -849,7 +849,7 @@ svn_packed__data_fill_buffer(svn_packed_ private_data->item_count -= end; } -apr_uint64_t +apr_uint64_t svn_packed__get_uint(svn_packed__int_stream_t *stream) { if (stream->buffer_used == 0) @@ -876,7 +876,7 @@ svn_packed__get_bytes(svn_packed__byte_s /* advance packed buffer */ stream->packed->data += count; - stream->packed->len -= count; + stream->packed->len -= count; stream->packed->blocksize -= count; *len = count; @@ -963,7 +963,7 @@ read_stream_data(svn_stream_t *stream, { apr_uint64_t len; apr_size_t compressed_len; - + SVN_ERR(read_stream_uint(stream, &len)); compressed_len = (apr_size_t)len; @@ -1033,11 +1033,11 @@ svn_packed__data_read(svn_packed__data_r { apr_uint64_t i; apr_uint64_t count; - + svn_packed__int_stream_t *int_stream; svn_packed__byte_stream_t *byte_stream; svn_packed__data_root_t *root = svn_packed__data_create_root(result_pool); - + svn_stringbuf_t *compressed = svn_stringbuf_create_ensure(1024, scratch_pool); svn_stringbuf_t *uncompressed @@ -1052,7 +1052,7 @@ svn_packed__data_read(svn_packed__data_r tree_struct = svn_stringbuf_create_ensure((apr_size_t)tree_struct_size, scratch_pool); tree_struct->len = (apr_size_t)tree_struct_size; - + SVN_ERR(svn_stream_read_full(stream, tree_struct->data, &tree_struct->len)); tree_struct->data[tree_struct->len] = '\0'; @@ -1066,7 +1066,7 @@ svn_packed__data_read(svn_packed__data_r count = read_packed_uint(tree_struct); for (i = 0; i < count; ++i) - read_byte_stream_structure(tree_struct, + read_byte_stream_structure(tree_struct, create_bytes_stream_body(root), root->first_int_stream); Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/prefix_string.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/prefix_string.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/prefix_string.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/prefix_string.c Wed Feb 25 08:15:39 2015 @@ -69,7 +69,7 @@ struct node_t * 0 for the root node. Only then will key.prefix be NULL. */ apr_uint32_t length; - /* Number of entries used in SUB_NODES. */ + /* Number of entries used in SUB_NODES. */ apr_uint32_t sub_node_count; /* The sub-nodes, ordered by first char. node_t and svn_prefix_string__t @@ -136,7 +136,7 @@ search_lower_bound(node_t **sub_nodes, /* Binary search for the lowest position at which to insert KEY. */ while (lower <= upper) { - int current = lower + (upper - lower) / 2; + int current = lower + (upper - lower) / 2; if ((unsigned char)sub_nodes[current]->key.data[0] < key) lower = current + 1; Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/sorts.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/sorts.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/sorts.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/sorts.c Wed Feb 25 08:15:39 2015 @@ -268,10 +268,10 @@ svn_sort__array_lookup(const apr_array_h /* Intend to insert at a position inside the array, i.e. not * at one of the boundaries. The predecessor must be smaller * and the current entry at IDX must be larger than KEY. */ - void *previous; + void *previous; *hint = idx; - previous = array->elts + (idx-1) * array->elt_size; + previous = array->elts + (idx-1) * array->elt_size; result = array->elts + idx * array->elt_size; if (compare_func(previous, key) && !compare_func(result, key)) return result; @@ -484,7 +484,7 @@ svn_priority_queue__create(apr_array_hea for (i = elements->nelts / 2; i >= 0; --i) heap_bubble_up(queue, i); - + return queue; } Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/sqlite.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/sqlite.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/sqlite.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/sqlite.c Wed Feb 25 08:15:39 2015 @@ -879,7 +879,7 @@ internal_open(svn_sqlite__db_t *db, cons /* Open the database. Note that a handle is returned, even when an error occurs (except for out-of-memory); thus, we can safely use it to extract an error message and construct an svn_error_t. SQLite always - requires sqlite3_close() after sqlite3_open_v2() while Subversion + requires sqlite3_close() after sqlite3_open_v2() while Subversion typically does not require close() after an open() that returns an error. So we must ensure we close the handle if this function, or the caller svn_sqlite__open, returns an error to the application. */ @@ -1171,7 +1171,8 @@ svn_sqlite__open(svn_sqlite__db_t **db, affects application(read: Subversion) performance/behavior. */ "PRAGMA foreign_keys=OFF;" /* SQLITE_DEFAULT_FOREIGN_KEYS*/ "PRAGMA locking_mode = NORMAL;" /* SQLITE_DEFAULT_LOCKING_MODE */ - ), + "PRAGMA journal_mode = TRUNCATE;" + ), *db); #if defined(SVN_DEBUG) @@ -1476,8 +1477,6 @@ struct function_wrapper_baton_t { svn_sqlite__func_t func; void *baton; - - apr_pool_t *scratch_pool; }; static void @@ -1487,22 +1486,12 @@ wrapped_func(sqlite3_context *context, { struct function_wrapper_baton_t *fwb = sqlite3_user_data(context); svn_sqlite__context_t sctx; - svn_sqlite__value_t **local_vals = - apr_palloc(fwb->scratch_pool, - sizeof(svn_sqlite__value_t *) * argc); svn_error_t *err; - int i; + void *void_values = values; sctx.context = context; - for (i = 0; i < argc; i++) - { - local_vals[i] = apr_palloc(fwb->scratch_pool, sizeof(*local_vals[i])); - local_vals[i]->value = values[i]; - } - - err = fwb->func(&sctx, argc, local_vals, fwb->scratch_pool); - svn_pool_clear(fwb->scratch_pool); + err = fwb->func(&sctx, argc, void_values, fwb->baton); if (err) { @@ -1514,6 +1503,7 @@ wrapped_func(sqlite3_context *context, } } + svn_error_t * svn_sqlite__create_scalar_function(svn_sqlite__db_t *db, const char *func_name, @@ -1526,7 +1516,6 @@ svn_sqlite__create_scalar_function(svn_s struct function_wrapper_baton_t *fwb = apr_pcalloc(db->state_pool, sizeof(*fwb)); - fwb->scratch_pool = svn_pool_create(db->state_pool); fwb->func = func; fwb->baton = baton; @@ -1544,13 +1533,15 @@ svn_sqlite__create_scalar_function(svn_s int svn_sqlite__value_type(svn_sqlite__value_t *val) { - return sqlite3_value_type(val->value); + void *v = val; + return sqlite3_value_type(v); } const char * svn_sqlite__value_text(svn_sqlite__value_t *val) { - return (const char *) sqlite3_value_text(val->value); + void *v = val; + return (const char *) sqlite3_value_text(v); } void Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/sqlite3wrapper.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/sqlite3wrapper.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/sqlite3wrapper.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/sqlite3wrapper.c Wed Feb 25 08:15:39 2015 @@ -24,7 +24,7 @@ /* Include sqlite3 inline, making all symbols private. */ #ifdef SVN_SQLITE_INLINE -# define SQLITE_OMIT_DEPRECATED +# define SQLITE_OMIT_DEPRECATED 1 # define SQLITE_API static # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) # pragma GCC diagnostic ignored "-Wunreachable-code" Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/subst.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/subst.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/subst.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/subst.c Wed Feb 25 08:15:39 2015 @@ -1150,7 +1150,7 @@ translate_chunk(svn_stream_t *dst, const char *start = p + len; const char *eol = svn_eol__find_eol_start((char *)start, end - start); - + /* EOL will be NULL if we did not find a line ending */ len += (eol ? eol : end) - start; } @@ -1972,7 +1972,7 @@ svn_subst_translate_string2(svn_string_t return SVN_NO_ERROR; } - if (encoding && !strcmp(encoding, "UTF-8")) + if (encoding && !strcmp(encoding, "UTF-8")) { val_utf8 = value->data; } Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/sysinfo.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/sysinfo.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/sysinfo.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/sysinfo.c Wed Feb 25 08:15:39 2015 @@ -449,7 +449,7 @@ systemd_release(apr_pool_t *pool) if (!strncmp(line->data, "PRETTY_NAME=", 12)) { svn_stringbuf_t *release_name; - + /* The value may or may not be enclosed by double quotes. We don't * attempt to strip them. */ release_name = svn_stringbuf_create(line->data + 12, pool); @@ -1032,7 +1032,7 @@ system_version_plist(svn_boolean_t *serv write_stream = svn_stream_create(&resource, pool); svn_stream_set_write(write_stream, write_to_cfmutabledata); err = svn_stream_copy3(read_stream, write_stream, NULL, NULL, pool); - if (err) + if (err) { svn_error_clear(err); return NULL; Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/types.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/types.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/types.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/types.c Wed Feb 25 08:15:39 2015 @@ -62,14 +62,14 @@ svn_revnum_parse(svn_revnum_t *rev, return svn_error_createf (SVN_ERR_REVNUM_PARSE_FAILURE, NULL, _("Revision number longer than 10 digits '%s'"), str); - + /* we support 32 bit revision numbers only. check for overflows */ if (*str > '2' || (apr_uint32_t)result > APR_INT32_MAX) return svn_error_createf (SVN_ERR_REVNUM_PARSE_FAILURE, NULL, _("Revision number too large '%s'"), str); } - + if (endptr) *endptr = end; Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf.c (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf.c Wed Feb 25 08:15:39 2015 @@ -257,7 +257,7 @@ xlate_alloc_handle(xlate_handle_node_t * later. APR_STRERR will be in the local encoding, not in UTF-8, though. */ svn_strerror(apr_err, apr_strerr, sizeof(apr_strerr)); - return svn_error_createf(SVN_ERR_PLUGIN_LOAD_FAILURE, + return svn_error_createf(SVN_ERR_PLUGIN_LOAD_FAILURE, svn_error_create(apr_err, NULL, apr_strerr), "%s%s", name, errstr); }
