Skip to content

Commit b2c3614

Browse files
author
Ivan Zhakov
committed
Use svn_hash_gets() instead of apr_hash_get(APR_HASH_KEY_STRING).
* subversion/libsvn_fs_fs/stats.c * subversion/tests/libsvn_client/client-test.c * subversion/tests/libsvn_repos/repos-test.c * subversion/tests/libsvn_subr/stream-test.c * subversion/tests/libsvn_subr/translate-test.c * subversion/tests/libsvn_wc/conflict-data-test.c (): Include svn_hash.h. (add_change, test_elide_mergeinfo_catalog, patch_collection_func, test_patch, rmlocks_change_prop, prop_validation_commit_with_revprop, test_stream_seek_translated, substitute_and_verify, test_serialize_prop_conflict): Use svn_hash_gets() instead of apr_hash_get(APR_HASH_KEY_STRING). git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1933244 13f79535-47bb-0310-9956-ffa450edef68
1 parent a17d1a7 commit b2c3614

6 files changed

Lines changed: 36 additions & 55 deletions

File tree

subversion/libsvn_fs_fs/stats.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include "svn_dirent_uri.h"
2424
#include "svn_fs.h"
25+
#include "svn_hash.h"
2526
#include "svn_pools.h"
2627
#include "svn_sorts.h"
2728

@@ -338,15 +339,14 @@ add_change(svn_fs_fs__stats_t *stats,
338339
extension = "(none)";
339340

340341
/* get / auto-insert entry for this extension */
341-
info = apr_hash_get(stats->by_extension, extension, APR_HASH_KEY_STRING);
342+
info = svn_hash_gets(stats->by_extension, extension);
342343
if (info == NULL)
343344
{
344345
apr_pool_t *pool = apr_hash_pool_get(stats->by_extension);
345346
info = apr_pcalloc(pool, sizeof(*info));
346347
info->extension = apr_pstrdup(pool, extension);
347348

348-
apr_hash_set(stats->by_extension, info->extension,
349-
APR_HASH_KEY_STRING, info);
349+
svn_hash_sets(stats->by_extension, info->extension, info);
350350
}
351351

352352
/* update per-extension histogram */

subversion/tests/libsvn_client/client-test.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,16 @@ test_elide_mergeinfo_catalog(apr_pool_t *pool)
123123

124124
SVN_ERR(svn_mergeinfo_parse(&mergeinfo, item->unparsed_mergeinfo,
125125
iterpool));
126-
apr_hash_set(mergeinfo_catalog, item->path, APR_HASH_KEY_STRING,
127-
mergeinfo);
126+
svn_hash_sets(mergeinfo_catalog, item->path, mergeinfo);
128127
}
129128

130129
SVN_ERR(svn_client__elide_mergeinfo_catalog(mergeinfo_catalog,
131130
iterpool));
132131

133132
for (item = elide_testcases[i]; item->path; item++)
134133
{
135-
apr_hash_t *mergeinfo = apr_hash_get(mergeinfo_catalog, item->path,
136-
APR_HASH_KEY_STRING);
134+
apr_hash_t *mergeinfo = svn_hash_gets(mergeinfo_catalog, item->path);
135+
137136
if (item->remains && !mergeinfo)
138137
return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
139138
"Elision for test case #%d incorrectly "
@@ -315,16 +314,14 @@ patch_collection_func(void *baton,
315314
struct patch_collection_baton *pcb = baton;
316315

317316
if (patch_abspath)
318-
apr_hash_set(pcb->patched_tempfiles,
319-
apr_pstrdup(pcb->state_pool, canon_path_from_patchfile),
320-
APR_HASH_KEY_STRING,
321-
apr_pstrdup(pcb->state_pool, patch_abspath));
317+
svn_hash_sets(pcb->patched_tempfiles,
318+
apr_pstrdup(pcb->state_pool, canon_path_from_patchfile),
319+
apr_pstrdup(pcb->state_pool, patch_abspath));
322320

323321
if (reject_abspath)
324-
apr_hash_set(pcb->reject_tempfiles,
325-
apr_pstrdup(pcb->state_pool, canon_path_from_patchfile),
326-
APR_HASH_KEY_STRING,
327-
apr_pstrdup(pcb->state_pool, reject_abspath));
322+
svn_hash_sets(pcb->reject_tempfiles,
323+
apr_pstrdup(pcb->state_pool, canon_path_from_patchfile),
324+
apr_pstrdup(pcb->state_pool, reject_abspath));
328325

329326
if (filtered)
330327
*filtered = FALSE;
@@ -421,14 +418,12 @@ test_patch(const svn_test_opts_t *opts,
421418

422419
SVN_TEST_ASSERT(apr_hash_count(pcb.patched_tempfiles) == 1);
423420
key = "A/D/gamma";
424-
patched_tempfile_path = apr_hash_get(pcb.patched_tempfiles, key,
425-
APR_HASH_KEY_STRING);
421+
patched_tempfile_path = svn_hash_gets(pcb.patched_tempfiles, key);
426422
SVN_ERR(check_patch_result(patched_tempfile_path, expected_gamma, "\n",
427423
EXPECTED_GAMMA_LINES, pool));
428424
SVN_TEST_ASSERT(apr_hash_count(pcb.reject_tempfiles) == 1);
429425
key = "A/D/gamma";
430-
reject_tempfile_path = apr_hash_get(pcb.reject_tempfiles, key,
431-
APR_HASH_KEY_STRING);
426+
reject_tempfile_path = svn_hash_gets(pcb.reject_tempfiles, key);
432427
SVN_ERR(check_patch_result(reject_tempfile_path, expected_gamma_reject,
433428
APR_EOL_STR, EXPECTED_GAMMA_REJECT_LINES, pool));
434429

subversion/tests/libsvn_repos/repos-test.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -950,15 +950,13 @@ rmlocks_change_prop(void *file_baton,
950950
"Value for lock-token property not NULL");
951951

952952
/* We only want it removed once. */
953-
if (apr_hash_get(fb->main_baton->removed, fb->path,
954-
APR_HASH_KEY_STRING) != NULL)
953+
if (svn_hash_gets(fb->main_baton->removed, fb->path) != NULL)
955954
return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
956955
"Lock token for '%s' already removed",
957956
fb->path);
958957

959958
/* Mark as removed. */
960-
apr_hash_set(fb->main_baton->removed, fb->path, APR_HASH_KEY_STRING,
961-
(void *)1);
959+
svn_hash_sets(fb->main_baton->removed, fb->path, (void *)1);
962960
}
963961

964962
return SVN_NO_ERROR;
@@ -3317,15 +3315,13 @@ prop_validation_commit_with_revprop(const char *filename,
33173315
/* Set usual author and log props, if not set already */
33183316
if (strcmp(prop_key, SVN_PROP_REVISION_AUTHOR) != 0)
33193317
{
3320-
apr_hash_set(revprop_table, SVN_PROP_REVISION_AUTHOR,
3321-
APR_HASH_KEY_STRING,
3322-
svn_string_create("plato", pool));
3318+
svn_hash_sets(revprop_table, SVN_PROP_REVISION_AUTHOR,
3319+
svn_string_create("plato", pool));
33233320
}
33243321
else if (strcmp(prop_key, SVN_PROP_REVISION_LOG) != 0)
33253322
{
3326-
apr_hash_set(revprop_table, SVN_PROP_REVISION_LOG,
3327-
APR_HASH_KEY_STRING,
3328-
svn_string_create("revision log", pool));
3323+
svn_hash_sets(revprop_table, SVN_PROP_REVISION_LOG,
3324+
svn_string_create("revision log", pool));
33293325
}
33303326

33313327
/* Make an arbitrary change and commit using above values... */

subversion/tests/libsvn_subr/stream-test.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "svn_io.h"
2727
#include "svn_subst.h"
2828
#include "svn_base64.h"
29+
#include "svn_hash.h"
2930
#include <apr_general.h>
3031

3132
#include "private/svn_io_private.h"
@@ -375,7 +376,7 @@ test_stream_seek_translated(apr_pool_t *pool)
375376

376377
keywords = apr_hash_make(pool);
377378
keyword_val = svn_string_create("my keyword was expanded", pool);
378-
apr_hash_set(keywords, "MyKeyword", APR_HASH_KEY_STRING, keyword_val);
379+
svn_hash_sets(keywords, "MyKeyword", keyword_val);
379380
stringbuf = svn_stringbuf_create("One$MyKeyword$Two", pool);
380381
stream = svn_stream_from_stringbuf(stringbuf, pool);
381382
translated_stream = svn_subst_stream_translated(stream, APR_EOL_STR,

subversion/tests/libsvn_subr/translate-test.c

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
#include "../svn_test.h"
4242

43+
#include "svn_hash.h"
4344
#include "svn_pools.h"
4445
#include "svn_subst.h"
4546

@@ -303,36 +304,27 @@ substitute_and_verify(const char *test_name,
303304
if (rev)
304305
{
305306
val = svn_string_create(rev, pool);
306-
apr_hash_set(keywords, SVN_KEYWORD_REVISION_LONG,
307-
APR_HASH_KEY_STRING, val);
308-
apr_hash_set(keywords, SVN_KEYWORD_REVISION_MEDIUM,
309-
APR_HASH_KEY_STRING, val);
310-
apr_hash_set(keywords, SVN_KEYWORD_REVISION_SHORT,
311-
APR_HASH_KEY_STRING, val);
307+
svn_hash_sets(keywords, SVN_KEYWORD_REVISION_LONG, val);
308+
svn_hash_sets(keywords, SVN_KEYWORD_REVISION_MEDIUM, val);
309+
svn_hash_sets(keywords, SVN_KEYWORD_REVISION_SHORT, val);
312310
}
313311
if (date)
314312
{
315313
val = svn_string_create(date, pool);
316-
apr_hash_set(keywords, SVN_KEYWORD_DATE_LONG,
317-
APR_HASH_KEY_STRING, val);
318-
apr_hash_set(keywords, SVN_KEYWORD_DATE_SHORT,
319-
APR_HASH_KEY_STRING, val);
314+
svn_hash_sets(keywords, SVN_KEYWORD_DATE_LONG, val);
315+
svn_hash_sets(keywords, SVN_KEYWORD_DATE_SHORT, val);
320316
}
321317
if (author)
322318
{
323319
val = svn_string_create(author, pool);
324-
apr_hash_set(keywords, SVN_KEYWORD_AUTHOR_LONG,
325-
APR_HASH_KEY_STRING, val);
326-
apr_hash_set(keywords, SVN_KEYWORD_AUTHOR_SHORT,
327-
APR_HASH_KEY_STRING, val);
320+
svn_hash_sets(keywords, SVN_KEYWORD_AUTHOR_LONG, val);
321+
svn_hash_sets(keywords, SVN_KEYWORD_AUTHOR_SHORT, val);
328322
}
329323
if (url)
330324
{
331325
val = svn_string_create(url, pool);
332-
apr_hash_set(keywords, SVN_KEYWORD_URL_LONG,
333-
APR_HASH_KEY_STRING, val);
334-
apr_hash_set(keywords, SVN_KEYWORD_URL_SHORT,
335-
APR_HASH_KEY_STRING, val);
326+
svn_hash_sets(keywords, SVN_KEYWORD_URL_LONG, val);
327+
svn_hash_sets(keywords, SVN_KEYWORD_URL_SHORT, val);
336328
}
337329

338330
err = svn_subst_copy_and_translate4(src_fname, dst_fname, dst_eol, repair,

subversion/tests/libsvn_wc/conflict-data-test.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -394,16 +394,13 @@ test_serialize_prop_conflict(const svn_test_opts_t *opts,
394394
apr_hash_t *conflicts = apr_hash_make(pool);
395395
const char *marker_abspath;
396396

397-
apr_hash_set(mine, "prop", APR_HASH_KEY_STRING,
398-
svn_string_create("Mine", pool));
397+
svn_hash_sets(mine, "prop", svn_string_create("Mine", pool));
399398

400-
apr_hash_set(their_old, "prop", APR_HASH_KEY_STRING,
401-
svn_string_create("Their-Old", pool));
399+
svn_hash_sets(their_old, "prop", svn_string_create("Their-Old", pool));
402400

403-
apr_hash_set(theirs, "prop", APR_HASH_KEY_STRING,
404-
svn_string_create("Theirs", pool));
401+
svn_hash_sets(theirs, "prop", svn_string_create("Theirs", pool));
405402

406-
apr_hash_set(conflicts, "prop", APR_HASH_KEY_STRING, "");
403+
svn_hash_sets(conflicts, "prop", "");
407404

408405
SVN_ERR(svn_io_open_unique_file3(NULL, &marker_abspath, sbox.wc_abspath,
409406
svn_io_file_del_on_pool_cleanup, pool,

0 commit comments

Comments
 (0)