Added aop_t_cstring() convenience function.
authorJustin Seyster <jseyster@cs.sunysb.edu>
Thu, 21 Oct 2010 18:34:08 +0000 (14:34 -0400)
committerJustin Seyster <jseyster@cs.sunysb.edu>
Thu, 21 Oct 2010 18:34:08 +0000 (14:34 -0400)
src/aop-type.c
src/aop.h
test/plugin-return.c

index 4920ddb684ce4027671a603422da5a132b103b8e..3444f9ceb2c1ab0a3f6c2fd2a6f5bdda4fb513e3 100644 (file)
@@ -527,6 +527,17 @@ aop_t_float128 ()
   return &_aop_t_float128;
 }
 
+/**
+ * A convenience function for getting a <code>(char *)</code> type.
+ * This is the same as passing aop_t_signed8() to aop_t_pointer_to().
+ * \return A type that will match the type <code>(char *)</code>.
+ */
+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 <i>pointers</i> to the specified struct type.
index 84e4fe52ec00a079cecef8aacab4280e2e066dab..75b640f5e10d62b231a6bd4b7b75ba7b3d4339a6 100644 (file)
--- 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);
index fce9adf0dc9f0af4af4c4b03ca3e074b642f7f68..d63b8002d045dac2c5e5d8cf5a9d5eaeb742fde4 100644 (file)
@@ -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);
 }