Permalink
Browse files

Fix tiny compiler warning about const casting

	trace_instrumentor/../trace_defs.h: In function ‘int trace_strcmp(const char*, const char*)’:
	trace_instrumentor/../trace_defs.h:61:32: warning: cast from type ‘const char*’ to type ‘unsigned char*’ casts away qualifiers [-Wcast-qual]
	trace_instrumentor/../trace_defs.h:62:32: warning: cast from type ‘const char*’ to type ‘unsigned char*’ casts away qualifiers [-Wcast-qual]
  • Loading branch information...
1 parent 0f2f9f5 commit e46afbaa3a16b659e417c6b7115a1b80cd762a92 @mo mo committed Apr 12, 2012
Showing with 2 additions and 3 deletions.
  1. +2 −3 trace_defs.h
View
@@ -48,7 +48,6 @@ TRACE_SEVERITY_DEF
static inline int trace_strcmp(const char *s1, const char *s2)
{
- unsigned char uc1, uc2;
/* Move s1 and s2 to the first differing characters
in each string, or the ends of the strings if they
are identical. */
@@ -58,8 +57,8 @@ static inline int trace_strcmp(const char *s1, const char *s2)
}
/* Compare the characters as unsigned char and
return the difference. */
- uc1 = (*(unsigned char *) s1);
- uc2 = (*(unsigned char *) s2);
+ const unsigned char uc1 = (*(const unsigned char *) s1);
+ const unsigned char uc2 = (*(const unsigned char *) s2);
return ((uc1 < uc2) ? -1 : (uc1 > uc2));
}

0 comments on commit e46afba

Please sign in to comment.