summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2012-12-19 16:24:43 +0900
committerAkira TAGOH <akira@tagoh.org>2012-12-19 16:25:14 +0900
commit37cb3080ab49ecbb279381e54295fa69ddb31dd9 (patch)
tree4fe05d6604731df728cf2e84c5ae2aeb592673b8
parent1a8956a617579dbecbe4c51cc689161707354809 (diff)
Define LT_ITER_INIT
-rw-r--r--liblangtag/lt-extlang-db.c2
-rw-r--r--liblangtag/lt-grandfathered-db.c2
-rw-r--r--liblangtag/lt-iter.h14
-rw-r--r--liblangtag/lt-lang-db.c2
-rw-r--r--liblangtag/lt-redundant-db.c2
-rw-r--r--liblangtag/lt-region-db.c2
-rw-r--r--liblangtag/lt-script-db.c2
-rw-r--r--liblangtag/lt-variant-db.c2
-rw-r--r--tests/extlang-db.c4
-rw-r--r--tests/grandfathered-db.c4
-rw-r--r--tests/lang-db.c4
-rw-r--r--tests/redundant-db.c4
-rw-r--r--tests/region-db.c4
-rw-r--r--tests/script-db.c4
-rw-r--r--tests/variant-db.c4
15 files changed, 35 insertions, 21 deletions
diff --git a/liblangtag/lt-extlang-db.c b/liblangtag/lt-extlang-db.c
index 5ebbeb5..a99592e 100644
--- a/liblangtag/lt-extlang-db.c
+++ b/liblangtag/lt-extlang-db.c
@@ -200,7 +200,7 @@ _lt_extlang_db_iter_init(lt_iter_tmpl_t *tmpl)
retval = malloc(sizeof (lt_extlang_db_iter_t));
if (retval) {
- retval->iter = lt_iter_init((lt_iter_tmpl_t *)extlangdb->extlang_entries);
+ retval->iter = LT_ITER_INIT (extlangdb->extlang_entries);
if (!retval->iter) {
free(retval);
retval = NULL;
diff --git a/liblangtag/lt-grandfathered-db.c b/liblangtag/lt-grandfathered-db.c
index 7dce941..704ec46 100644
--- a/liblangtag/lt-grandfathered-db.c
+++ b/liblangtag/lt-grandfathered-db.c
@@ -179,7 +179,7 @@ _lt_grandfathered_db_iter_init(lt_iter_tmpl_t *tmpl)
retval = malloc(sizeof (lt_grandfathered_db_iter_t));
if (retval) {
- retval->iter = lt_iter_init((lt_iter_tmpl_t *)db->grandfathered_entries);
+ retval->iter = LT_ITER_INIT (db->grandfathered_entries);
if (!retval->iter) {
free(retval);
retval = NULL;
diff --git a/liblangtag/lt-iter.h b/liblangtag/lt-iter.h
index b289dec..42b8d3d 100644
--- a/liblangtag/lt-iter.h
+++ b/liblangtag/lt-iter.h
@@ -21,7 +21,21 @@
LT_BEGIN_DECLS
+#define LT_ITER_INIT(_obj_) lt_iter_init((lt_iter_tmpl_t *)(_obj_))
+
+/**
+ * lt_iter_tmpl_t:
+ *
+ * All the fields in the <structname>lt_iter_tmpl_t</structname>
+ * structure are private to the #lt_iter_tmpl_t implementation.
+ */
typedef struct _lt_iter_tmpl_t lt_iter_tmpl_t;
+/**
+ * lt_iter_t:
+ *
+ * All the fields in the <structname>lt_iter_t</structname>
+ * structure are private to the #lt_iter_t implementation.
+ */
typedef struct _lt_iter_t lt_iter_t;
struct _lt_iter_t {
diff --git a/liblangtag/lt-lang-db.c b/liblangtag/lt-lang-db.c
index 56646bf..c08469e 100644
--- a/liblangtag/lt-lang-db.c
+++ b/liblangtag/lt-lang-db.c
@@ -213,7 +213,7 @@ _lt_lang_db_iter_init(lt_iter_tmpl_t *tmpl)
retval = malloc(sizeof (lt_lang_db_iter_t));
if (retval) {
- retval->iter = lt_iter_init((lt_iter_tmpl_t *)langdb->lang_entries);
+ retval->iter = LT_ITER_INIT (langdb->lang_entries);
if (!retval->iter) {
free(retval);
retval = NULL;
diff --git a/liblangtag/lt-redundant-db.c b/liblangtag/lt-redundant-db.c
index 63fc4be..cd120cc 100644
--- a/liblangtag/lt-redundant-db.c
+++ b/liblangtag/lt-redundant-db.c
@@ -181,7 +181,7 @@ _lt_redundant_db_iter_init(lt_iter_tmpl_t *tmpl)
retval = malloc(sizeof (lt_redundant_db_iter_t));
if (retval) {
- retval->iter = lt_iter_init((lt_iter_tmpl_t *)db->redundant_entries);
+ retval->iter = LT_ITER_INIT (db->redundant_entries);
if (!retval->iter) {
free(retval);
retval = NULL;
diff --git a/liblangtag/lt-region-db.c b/liblangtag/lt-region-db.c
index ddef311..617686b 100644
--- a/liblangtag/lt-region-db.c
+++ b/liblangtag/lt-region-db.c
@@ -181,7 +181,7 @@ _lt_region_db_iter_init(lt_iter_tmpl_t *tmpl)
retval = malloc(sizeof (lt_region_db_iter_t));
if (retval) {
- retval->iter = lt_iter_init((lt_iter_tmpl_t *)db->region_entries);
+ retval->iter = LT_ITER_INIT (db->region_entries);
if (!retval->iter) {
free(retval);
retval = NULL;
diff --git a/liblangtag/lt-script-db.c b/liblangtag/lt-script-db.c
index 511798d..831e9ec 100644
--- a/liblangtag/lt-script-db.c
+++ b/liblangtag/lt-script-db.c
@@ -168,7 +168,7 @@ _lt_script_db_iter_init(lt_iter_tmpl_t *tmpl)
retval = malloc(sizeof (lt_script_db_iter_t));
if (retval) {
- retval->iter = lt_iter_init((lt_iter_tmpl_t *)db->script_entries);
+ retval->iter = LT_ITER_INIT (db->script_entries);
if (!retval->iter) {
free(retval);
retval = NULL;
diff --git a/liblangtag/lt-variant-db.c b/liblangtag/lt-variant-db.c
index bf8702d..bb8ba92 100644
--- a/liblangtag/lt-variant-db.c
+++ b/liblangtag/lt-variant-db.c
@@ -191,7 +191,7 @@ _lt_variant_db_iter_init(lt_iter_tmpl_t *tmpl)
retval = malloc(sizeof (lt_variant_db_iter_t));
if (retval) {
- retval->iter = lt_iter_init((lt_iter_tmpl_t *)db->variant_entries);
+ retval->iter = LT_ITER_INIT (db->variant_entries);
if (!retval->iter) {
free(retval);
retval = NULL;
diff --git a/tests/extlang-db.c b/tests/extlang-db.c
index 29976ea..ba141da 100644
--- a/tests/extlang-db.c
+++ b/tests/extlang-db.c
@@ -35,7 +35,7 @@ main(int argc,
const char *key;
lt_iter_t *iter;
- iter = lt_iter_init((lt_iter_tmpl_t *)extlangdb);
+ iter = LT_ITER_INIT (extlangdb);
while (lt_iter_next(iter,
(lt_pointer_t *)&key,
NULL)) {
@@ -45,7 +45,7 @@ main(int argc,
} else if (lt_strcmp0(argv[1], "list_values") == 0) {
lt_iter_t *iter;
- iter = lt_iter_init((lt_iter_tmpl_t *)extlangdb);
+ iter = LT_ITER_INIT (extlangdb);
while (lt_iter_next(iter,
NULL,
(lt_pointer_t *)&extlang)) {
diff --git a/tests/grandfathered-db.c b/tests/grandfathered-db.c
index e99f101..b27a8f3 100644
--- a/tests/grandfathered-db.c
+++ b/tests/grandfathered-db.c
@@ -35,7 +35,7 @@ main(int argc,
const char *key;
lt_iter_t *iter;
- iter = lt_iter_init((lt_iter_tmpl_t *)grandfathereddb);
+ iter = LT_ITER_INIT (grandfathereddb);
while (lt_iter_next(iter,
(lt_pointer_t *)&key,
NULL)) {
@@ -45,7 +45,7 @@ main(int argc,
} else if (lt_strcmp0(argv[1], "list_values") == 0) {
lt_iter_t *iter;
- iter = lt_iter_init((lt_iter_tmpl_t *)grandfathereddb);
+ iter = LT_ITER_INIT (grandfathereddb);
while (lt_iter_next(iter,
NULL,
(lt_pointer_t *)&grandfathered)) {
diff --git a/tests/lang-db.c b/tests/lang-db.c
index 68bbd53..8974924 100644
--- a/tests/lang-db.c
+++ b/tests/lang-db.c
@@ -35,7 +35,7 @@ main(int argc,
const char *key;
lt_iter_t *iter;
- iter = lt_iter_init((lt_iter_tmpl_t *)langdb);
+ iter = LT_ITER_INIT (langdb);
while (lt_iter_next(iter,
(lt_pointer_t *)&key,
NULL)) {
@@ -45,7 +45,7 @@ main(int argc,
} else if (lt_strcmp0(argv[1], "list_values") == 0) {
lt_iter_t *iter;
- iter = lt_iter_init((lt_iter_tmpl_t *)langdb);
+ iter = LT_ITER_INIT (langdb);
while (lt_iter_next(iter,
NULL,
(lt_pointer_t *)&lang)) {
diff --git a/tests/redundant-db.c b/tests/redundant-db.c
index d8fd6f9..9cd0a5b 100644
--- a/tests/redundant-db.c
+++ b/tests/redundant-db.c
@@ -35,7 +35,7 @@ main(int argc,
const char *key;
lt_iter_t *iter;
- iter = lt_iter_init((lt_iter_tmpl_t *)redundantdb);
+ iter = LT_ITER_INIT (redundantdb);
while (lt_iter_next(iter,
(lt_pointer_t *)&key,
NULL)) {
@@ -45,7 +45,7 @@ main(int argc,
} else if (lt_strcmp0(argv[1], "list_values") == 0) {
lt_iter_t *iter;
- iter = lt_iter_init((lt_iter_tmpl_t *)redundantdb);
+ iter = LT_ITER_INIT (redundantdb);
while (lt_iter_next(iter,
NULL,
(lt_pointer_t *)&redundant)) {
diff --git a/tests/region-db.c b/tests/region-db.c
index d761ca6..329a3f9 100644
--- a/tests/region-db.c
+++ b/tests/region-db.c
@@ -35,7 +35,7 @@ main(int argc,
const char *key;
lt_iter_t *iter;
- iter = lt_iter_init((lt_iter_tmpl_t *)regiondb);
+ iter = LT_ITER_INIT (regiondb);
while (lt_iter_next(iter,
(lt_pointer_t *)&key,
NULL)) {
@@ -45,7 +45,7 @@ main(int argc,
} else if (lt_strcmp0(argv[1], "list_values") == 0) {
lt_iter_t *iter;
- iter = lt_iter_init((lt_iter_tmpl_t *)regiondb);
+ iter = LT_ITER_INIT (regiondb);
while (lt_iter_next(iter,
NULL,
(lt_pointer_t *)&region)) {
diff --git a/tests/script-db.c b/tests/script-db.c
index 5045dd6..ba38d9f 100644
--- a/tests/script-db.c
+++ b/tests/script-db.c
@@ -35,7 +35,7 @@ main(int argc,
const char *key;
lt_iter_t *iter;
- iter = lt_iter_init((lt_iter_tmpl_t *)scriptdb);
+ iter = LT_ITER_INIT (scriptdb);
while (lt_iter_next(iter,
(lt_pointer_t *)&key,
NULL)) {
@@ -45,7 +45,7 @@ main(int argc,
} else if (lt_strcmp0(argv[1], "list_values") == 0) {
lt_iter_t *iter;
- iter = lt_iter_init((lt_iter_tmpl_t *)scriptdb);
+ iter = LT_ITER_INIT (scriptdb);
while (lt_iter_next(iter,
NULL,
(lt_pointer_t *)&script)) {
diff --git a/tests/variant-db.c b/tests/variant-db.c
index bc6b3f4..549264f 100644
--- a/tests/variant-db.c
+++ b/tests/variant-db.c
@@ -35,7 +35,7 @@ main(int argc,
const char *key;
lt_iter_t *iter;
- iter = lt_iter_init((lt_iter_tmpl_t *)variantdb);
+ iter = LT_ITER_INIT (variantdb);
while (lt_iter_next(iter,
(lt_pointer_t *)&key,
NULL)) {
@@ -45,7 +45,7 @@ main(int argc,
} else if (lt_strcmp0(argv[1], "list_values") == 0) {
lt_iter_t *iter;
- iter = lt_iter_init((lt_iter_tmpl_t *)variantdb);
+ iter = LT_ITER_INIT (variantdb);
while (lt_iter_next(iter,
NULL,
(lt_pointer_t *)&variant)) {