summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-10-29 13:41:01 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-10-29 15:26:28 -0400
commitb79b1228de615c860df841670c9a882ca748f63a (patch)
treeb6446867781253108803de31819d00a190934182 /common
parent81009a08d43a6b5e60afb681c4ed07b413967179 (diff)
downloadsssd-b79b1228de615c860df841670c9a882ca748f63a.tar.gz
sssd-b79b1228de615c860df841670c9a882ca748f63a.tar.xz
sssd-b79b1228de615c860df841670c9a882ca748f63a.zip
Clean up warnings in dhash tests
Diffstat (limited to 'common')
-rw-r--r--common/dhash/dhash_example.c12
-rw-r--r--common/dhash/dhash_test.c6
2 files changed, 9 insertions, 9 deletions
diff --git a/common/dhash/dhash_example.c b/common/dhash/dhash_example.c
index af46ca889..b7de62356 100644
--- a/common/dhash/dhash_example.c
+++ b/common/dhash/dhash_example.c
@@ -25,7 +25,7 @@ bool visit_callback(hash_entry_t *entry, void *user_data)
return true;
}
-struct my_data_t *new_data(int foo, char *bar)
+struct my_data_t *new_data(int foo, const char *bar)
{
struct my_data_t *my_data = malloc(sizeof(struct my_data_t));
my_data->foo = foo;
@@ -52,7 +52,7 @@ int main(int argc, char **argv)
/* Enter a key named "My Data" and specify it's value as a pointer to my_data */
key.type = HASH_KEY_STRING;
- key.str = "My Data";
+ key.str = strdup("My Data");
value.type = HASH_VALUE_PTR;
value.ptr = my_data;
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
/* Lookup the key named "My Data" */
key.type = HASH_KEY_STRING;
- key.str = "My Data";
+ key.str = strdup("My Data");
if ((error = hash_lookup(table, &key, &value)) != HASH_SUCCESS) {
fprintf(stderr, "cannot find key \"%s\" (%s)\n", key.str, hash_error_string(error));
}
@@ -91,9 +91,9 @@ int main(int argc, char **argv)
n_entries = 0;
iter = new_hash_iter_context(table);
while ((entry = iter->next(iter)) != NULL) {
- struct my_data_t *my_data = (struct my_data_t *) entry->value.ptr;
+ struct my_data_t *data = (struct my_data_t *) entry->value.ptr;
- printf("%s = [foo=%d bar=%s]\n", entry->key.str, my_data->foo, my_data->bar);
+ printf("%s = [foo=%d bar=%s]\n", entry->key.str, data->foo, data->bar);
n_entries++;
}
free(iter);
@@ -102,7 +102,7 @@ int main(int argc, char **argv)
/* Remove the entry, deletion callback will be invoked */
key.type = HASH_KEY_STRING;
- key.str = "My Data";
+ key.str = strdup("My Data");
if ((error = hash_delete(table, &key)) != HASH_SUCCESS) {
fprintf(stderr, "cannot delete from table (%s)\n", hash_error_string(error));
}
diff --git a/common/dhash/dhash_test.c b/common/dhash/dhash_test.c
index 8509964f6..450a1ab55 100644
--- a/common/dhash/dhash_test.c
+++ b/common/dhash/dhash_test.c
@@ -285,7 +285,7 @@ int main(int argc, char **argv)
/* Get an array of keys in the table, print them out */
{
- unsigned long i, count;
+ unsigned long count;
hash_key_t *keys;
if (verbose) printf("\nhash_keys:\n");
@@ -309,7 +309,7 @@ int main(int argc, char **argv)
/* Get an array of values in the table, print them out */
{
- unsigned long i, count;
+ unsigned long count;
hash_value_t *values;
if (verbose) printf("\nhash_values:\n");
@@ -329,7 +329,7 @@ int main(int argc, char **argv)
/* Get an array of items in the table, print them out */
{
- unsigned long i, count;
+ unsigned long count;
hash_entry_t *entries;
if (verbose) printf("\nhash_entries:\n");