[Ltrace-devel] [RFC 3/5] Add ARGTYPE_NONE

edgar.iglesias at gmail.com edgar.iglesias at gmail.com
Fri Oct 5 13:36:28 UTC 2012


From: "Edgar E. Iglesias" <edgar at axis.com>

Add a type to describe meta data that doesn't carry values.
These can be used to pad or fill out value dictionaries
to create specific order of arguments.

Signed-off-by: Edgar E. Iglesias <edgar at axis.com>
---
 read_config_file.c |    1 +
 type.c             |    7 +++++++
 type.h             |    1 +
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/read_config_file.c b/read_config_file.c
index 87e87e7..6b074ee 100644
--- a/read_config_file.c
+++ b/read_config_file.c
@@ -805,6 +805,7 @@ parse_nonpointer_type(char **str, struct param **extra_param, size_t param_num,
 
 	/* For some types that's all we need.  */
 	switch (type) {
+	case ARGTYPE_NONE:
 	case ARGTYPE_VOID:
 	case ARGTYPE_INT:
 	case ARGTYPE_UINT:
diff --git a/type.c b/type.c
index 3ce8563..dce8ccb 100644
--- a/type.c
+++ b/type.c
@@ -38,6 +38,7 @@ type_get_simple(enum arg_type type)
 	}
 
 	switch (type) {
+	HANDLE(ARGTYPE_NONE)
 	HANDLE(ARGTYPE_VOID)
 	HANDLE(ARGTYPE_INT)
 	HANDLE(ARGTYPE_UINT)
@@ -234,6 +235,7 @@ type_destroy(struct arg_type_info *info)
 		type_pointer_destroy(info);
 		break;
 
+	case ARGTYPE_NONE:
 	case ARGTYPE_VOID:
 	case ARGTYPE_INT:
 	case ARGTYPE_UINT:
@@ -350,6 +352,8 @@ type_sizeof(struct Process *proc, struct arg_type_info *type)
 
 	case ARGTYPE_VOID:
 		return 0;
+	case ARGTYPE_NONE:
+		return 0;
 	}
 
 	abort();
@@ -494,6 +498,7 @@ type_is_integral(enum arg_type type)
 	case ARGTYPE_USHORT:
 		return 1;
 
+	case ARGTYPE_NONE:
 	case ARGTYPE_VOID:
 	case ARGTYPE_FLOAT:
 	case ARGTYPE_DOUBLE:
@@ -524,6 +529,7 @@ type_is_signed(enum arg_type type)
 	case ARGTYPE_USHORT:
 		return 0;
 
+	case ARGTYPE_NONE:
 	case ARGTYPE_VOID:
 	case ARGTYPE_FLOAT:
 	case ARGTYPE_DOUBLE:
@@ -554,6 +560,7 @@ type_get_fp_equivalent(struct arg_type_info *info)
 	case ARGTYPE_UINT:
 	case ARGTYPE_ULONG:
 	case ARGTYPE_USHORT:
+	case ARGTYPE_NONE:
 	case ARGTYPE_VOID:
 	case ARGTYPE_ARRAY:
 	case ARGTYPE_POINTER:
diff --git a/type.h b/type.h
index e8dec71..0bb8b50 100644
--- a/type.h
+++ b/type.h
@@ -28,6 +28,7 @@
 
 enum arg_type {
 	ARGTYPE_VOID,
+	ARGTYPE_NONE,		/* No arg, used to hold meta data entries.  */
 	ARGTYPE_INT,
 	ARGTYPE_UINT,
 	ARGTYPE_LONG,
-- 
1.7.8.6




More information about the Ltrace-devel mailing list