Skip to content

Commit

Permalink
get rid of a member function pointer. helps gcc but not clang (clang …
Browse files Browse the repository at this point in the history
…must have seen through it)
  • Loading branch information
chadaustin committed Apr 18, 2017
1 parent a477f24 commit 44ec0df
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions include/sajson.h
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ namespace sajson {
p = skip_whitespace(p);
switch (p ? *p : 0) {
type next_type;
parse_result (parser::*structure_installer)(size_t* base);
size_t element;

case 0:
return error(p, "unexpected end of input");
Expand Down Expand Up @@ -720,26 +720,28 @@ namespace sajson {
}

case ']':
if (current_structure_type == TYPE_ARRAY) {
structure_installer = &parser::install_array;
goto pop;
} else {
if (SAJSON_UNLIKELY(current_structure_type != TYPE_ARRAY)) {
return error(p, "expected }");
}
if (had_comma) {
return error(p, "trailing commas not allowed");
}
++p;
element = *current_base;
result = install_array(current_base + 1);
goto pop;
case '}':
if (current_structure_type == TYPE_OBJECT) {
structure_installer = &parser::install_object;
goto pop;
} else {
if (SAJSON_UNLIKELY(current_structure_type != TYPE_OBJECT)) {
return error(p, "expected ]");
}
pop: {
if (had_comma) {
return error(p, "trailing commas not allowed");
}
++p;
size_t element = *current_base;
result = (this->*structure_installer)(current_base + 1);
element = *current_base;
result = install_object(current_base + 1);
goto pop;
pop: {
size_t parent = get_element_value(element);
if (parent == ROOT_MARKER) {
root_type = result.value_type;
Expand Down

0 comments on commit 44ec0df

Please sign in to comment.