Skip to content

Commit

Permalink
Use explicit signed char types for 'level' variable.
Browse files Browse the repository at this point in the history
The char type is not standardised as either signed or unsigned, and depends
on the architecture. In particular, on PowerPC-based Linux systems, char is
by default unsigned.

Where it matters, make sure that char has its signedness explicited in the
code.
  • Loading branch information
Flameeyes authored and jgarber committed Mar 1, 2010
1 parent f4918b5 commit e71fb12
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ext/redcloth_scan/redcloth.h
Expand Up @@ -129,7 +129,7 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
case ')': \
{ /*needed to keep inside chars scoped for less memory usage*/\
char *temp_p = p - 1; \
char level = -1; \
signed char level = -1; \
while (temp_p > reg) { \
switch(*(temp_p - 1)) { \
case '(': ++level; break; \
Expand Down
2 changes: 1 addition & 1 deletion ext/redcloth_scan/redcloth_inline.c.rl
Expand Up @@ -56,7 +56,7 @@ red_parse_title(VALUE self, VALUE regs, VALUE ref)
if ( txt != Qnil ) {
char *p = RSTRING_PTR(txt) + RSTRING_LEN(txt);
if (*(p - 1) == ')') {
char level = -1;
signed char level = -1;
p--;
while (p > RSTRING_PTR(txt) && level < 0) {
switch(*(p - 1)) {
Expand Down

0 comments on commit e71fb12

Please sign in to comment.