[SATYR PATCH 3/3] Fix sr_stacktrace_parse for core type

Martin Milata mmilata at redhat.com
Thu Jun 27 16:35:54 UTC 2013


Changes the type of the second argument from const char** to const char*
- the pointer will not be modified now.

Signed-off-by: Martin Milata <mmilata at redhat.com>
---
 include/stacktrace.h      | 2 +-
 lib/generic_stacktrace.c  | 6 +++---
 lib/generic_stacktrace.h  | 6 +++---
 tests/java_stacktrace.at  | 2 +-
 tests/koops_stacktrace.at | 2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/stacktrace.h b/include/stacktrace.h
index d23b32a..13152a0 100644
--- a/include/stacktrace.h
+++ b/include/stacktrace.h
@@ -60,7 +60,7 @@ enum sr_bthash_flags
  * stacktrace type in the first parameter.
  */
 struct sr_stacktrace *
-sr_stacktrace_parse(enum sr_report_type type, const char **input, char **error_message);
+sr_stacktrace_parse(enum sr_report_type type, const char *input, char **error_message);
 
 /**
  * Returns short textual representation of given stacktrace. At most max_frames
diff --git a/lib/generic_stacktrace.c b/lib/generic_stacktrace.c
index de393e4..8d6678c 100644
--- a/lib/generic_stacktrace.c
+++ b/lib/generic_stacktrace.c
@@ -75,12 +75,12 @@ stacktrace_to_short_text(struct sr_stacktrace *stacktrace, int max_frames)
 
 /* Uses the dispatch table but should not be exposed to library users directly. */
 struct sr_stacktrace *
-stacktrace_parse_wrapper(enum sr_report_type type, const char **input, char **error_message)
+stacktrace_parse_wrapper(enum sr_report_type type, const char *input, char **error_message)
 {
     struct sr_location location;
     sr_location_init(&location);
 
-    struct sr_stacktrace *result = DISPATCH(dtable, type, parse_location)(input, &location);
+    struct sr_stacktrace *result = DISPATCH(dtable, type, parse_location)(&input, &location);
 
     if (!result)
     {
@@ -93,7 +93,7 @@ stacktrace_parse_wrapper(enum sr_report_type type, const char **input, char **er
 
 /* Wrappers of polymorphic functions. */
 struct sr_stacktrace *
-sr_stacktrace_parse(enum sr_report_type type, const char **input, char **error_message)
+sr_stacktrace_parse(enum sr_report_type type, const char *input, char **error_message)
 {
     return DISPATCH(dtable, type, parse)(input, error_message);
 }
diff --git a/lib/generic_stacktrace.h b/lib/generic_stacktrace.h
index f08bdfc..4112d70 100644
--- a/lib/generic_stacktrace.h
+++ b/lib/generic_stacktrace.h
@@ -24,7 +24,7 @@
 #include "thread.h"
 #include "strbuf.h"
 
-typedef struct sr_stacktrace* (*parse_fn_t)(const char **, char **);
+typedef struct sr_stacktrace* (*parse_fn_t)(const char *, char **);
 typedef struct sr_stacktrace* (*parse_location_fn_t)(const char **, struct sr_location *);
 typedef char* (*to_short_text_fn_t)(struct sr_stacktrace*, int);
 typedef char* (*to_json_fn_t)(struct sr_stacktrace *);
@@ -62,14 +62,14 @@ extern struct stacktrace_methods core_stacktrace_methods, python_stacktrace_meth
 
 #define DEFINE_PARSE_WRAPPER_FUNC(name, type)                        \
     static struct sr_stacktrace *                                    \
-    name(const char **input, char **error_message)                   \
+    name(const char *input, char **error_message)                    \
     {                                                                \
         return stacktrace_parse_wrapper(type, input, error_message); \
     }
 
 /* generic functions */
 struct sr_stacktrace *
-stacktrace_parse_wrapper(enum sr_report_type type, const char **input, char **error_message);
+stacktrace_parse_wrapper(enum sr_report_type type, const char *input, char **error_message);
 
 char *
 stacktrace_to_short_text(struct sr_stacktrace *stacktrace, int max_frames);
diff --git a/tests/java_stacktrace.at b/tests/java_stacktrace.at
index be55703..f625566 100644
--- a/tests/java_stacktrace.at
+++ b/tests/java_stacktrace.at
@@ -107,7 +107,7 @@ check(char *input,
     /* check sr_stacktrace_parse */
     char *error;
     input = old_input;
-    struct sr_stacktrace *stacktrace2 = sr_stacktrace_parse(SR_REPORT_JAVA, &input, &error);
+    struct sr_stacktrace *stacktrace2 = sr_stacktrace_parse(SR_REPORT_JAVA, input, &error);
     assert(stacktrace2);
     char *json1 = sr_stacktrace_to_json(stacktrace);
     char *json2 = sr_stacktrace_to_json(stacktrace2);
diff --git a/tests/koops_stacktrace.at b/tests/koops_stacktrace.at
index 291b004..0e33201 100644
--- a/tests/koops_stacktrace.at
+++ b/tests/koops_stacktrace.at
@@ -181,7 +181,7 @@ check(const char *path,
   /* test parsing via sr_stacktrace_parse */
   input = full_input;
   char *error;
-  struct sr_stacktrace *stacktrace2 = sr_stacktrace_parse(SR_REPORT_KERNELOOPS, &input, &error);
+  struct sr_stacktrace *stacktrace2 = sr_stacktrace_parse(SR_REPORT_KERNELOOPS, input, &error);
 
   assert(stacktrace2);
   reason = sr_stacktrace_get_reason(stacktrace);
-- 
1.7.11.7



More information about the Crash-catcher mailing list