You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by dk...@apache.org on 2018/11/29 21:28:31 UTC
[avro] branch master updated: AVRO-1528. C: Applied patch for enum
bounds.
This is an automated email from the ASF dual-hosted git repository.
dkulp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/master by this push:
new 54fc3f5 AVRO-1528. C: Applied patch for enum bounds.
54fc3f5 is described below
commit 54fc3f53807f7cfa535100d826e19e66aa5cad8e
Author: Ben Walsh <be...@byhiras.com>
AuthorDate: Tue Jan 13 16:10:24 2015 +0000
AVRO-1528. C: Applied patch for enum bounds.
---
lang/c/src/avro/schema.h | 1 +
lang/c/src/schema.c | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/lang/c/src/avro/schema.h b/lang/c/src/avro/schema.h
index 41dd8ea..31d5281 100644
--- a/lang/c/src/avro/schema.h
+++ b/lang/c/src/avro/schema.h
@@ -61,6 +61,7 @@ int avro_schema_enum_get_by_name(const avro_schema_t enump,
const char *symbol_name);
int avro_schema_enum_symbol_append(const avro_schema_t
enump, const char *symbol);
+int avro_schema_enum_number_of_symbols(const avro_schema_t enump);
avro_schema_t avro_schema_fixed(const char *name, const int64_t len);
avro_schema_t avro_schema_fixed_ns(const char *name, const char *space,
diff --git a/lang/c/src/schema.c b/lang/c/src/schema.c
index 7a82c2e..4e1b6bd 100644
--- a/lang/c/src/schema.c
+++ b/lang/c/src/schema.c
@@ -575,6 +575,16 @@ avro_schema_enum_symbol_append(const avro_schema_t enum_schema,
}
int
+avro_schema_enum_number_of_symbols(const avro_schema_t enum_schema)
+{
+ check_param(EINVAL, is_avro_schema(enum_schema), "enum schema");
+ check_param(EINVAL, is_avro_enum(enum_schema), "enum schema");
+
+ struct avro_enum_schema_t *enump = avro_schema_to_enum(enum_schema);
+ return enump->symbols->num_entries;
+}
+
+int
avro_schema_record_field_append(const avro_schema_t record_schema,
const char *field_name,
const avro_schema_t field_schema)