From: Justin Seyster Date: Thu, 21 Oct 2010 18:34:08 +0000 (-0400) Subject: Added aop_t_cstring() convenience function. X-Git-Tag: release-v1.0~22 X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=336eb27341d5f7226bc2d62c14cc920737e4d834;p=interaspect.git Added aop_t_cstring() convenience function. --- diff --git a/src/aop-type.c b/src/aop-type.c index 4920ddb..3444f9c 100644 --- a/src/aop-type.c +++ b/src/aop-type.c @@ -527,6 +527,17 @@ aop_t_float128 () return &_aop_t_float128; } +/** + * A convenience function for getting a (char *) type. + * This is the same as passing aop_t_signed8() to aop_t_pointer_to(). + * \return A type that will match the type (char *). + */ +const struct aop_type * +aop_t_cstring () +{ + return aop_t_pointer_to (aop_t_signed8 ()); +} + /** * Return a type that will match a struct type. Note that this will * not match pointers to the specified struct type. diff --git a/src/aop.h b/src/aop.h index 84e4fe5..75b640f 100644 --- a/src/aop.h +++ b/src/aop.h @@ -200,6 +200,7 @@ extern const struct aop_type *aop_t_unsigned128 (); extern const struct aop_type *aop_t_float32 (); extern const struct aop_type *aop_t_float64 (); extern const struct aop_type *aop_t_float128 (); +extern const struct aop_type *aop_t_cstring (); extern const struct aop_type *aop_t_struct (const char *tag); extern const struct aop_type *aop_t_struct_ptr (const char *tag); extern const struct aop_type *aop_t_union (const char *tag); diff --git a/test/plugin-return.c b/test/plugin-return.c index fce9adf..d63b800 100644 --- a/test/plugin-return.c +++ b/test/plugin-return.c @@ -11,12 +11,7 @@ static void plugin_join_on_float_exit(struct aop_joinpoint *jp, void *data) static void plugin_join_on_string_exit(struct aop_joinpoint *jp, void *data) { - const struct aop_type *char_star; - struct aop_dynval *retval; - - char_star = aop_t_pointer_to(aop_t_signed8()); - - retval = aop_capture_exit_return_value_by_type(jp, char_star); + struct aop_dynval *retval = aop_capture_exit_return_value_by_type(jp, aop_t_cstring ()); if (retval != NULL) aop_insert_advice(jp, "_string_advice", AOP_INSERT_BEFORE, AOP_DYNVAL(retval), AOP_TERM_ARG); }