details: http://hg.nginx.org/njs/rev/641b3189d658 branches: changeset: 490:641b3189d658 user: Igor Sysoev <i...@sysoev.ru> date: Tue Apr 03 17:55:56 2018 +0300 description: Exact values for default switch case expressions.
diffstat: njs/njs_lexer.c | 3 ++- njs/njs_string.c | 6 ++++-- njs/njs_string.h | 3 ++- njs/njs_vm.c | 20 +++++++++++--------- 4 files changed, 19 insertions(+), 13 deletions(-) diffs (111 lines): diff -r 39374a5d6cda -r 641b3189d658 njs/njs_lexer.c --- a/njs/njs_lexer.c Tue Apr 03 17:55:23 2018 +0300 +++ b/njs/njs_lexer.c Tue Apr 03 17:55:56 2018 +0300 @@ -427,7 +427,8 @@ njs_lexer_next_token(njs_lexer_t *lexer) lexer->text.length = lexer->start - lexer->text.start; return token; - default: /* NJS_TOKEN_ILLEGAL */ + case NJS_TOKEN_ILLEGAL: + default: lexer->start--; return token; } diff -r 39374a5d6cda -r 641b3189d658 njs/njs_string.c --- a/njs/njs_string.c Tue Apr 03 17:55:23 2018 +0300 +++ b/njs/njs_string.c Tue Apr 03 17:55:56 2018 +0300 @@ -2137,7 +2137,8 @@ njs_string_prototype_search(njs_vm_t *vm goto done; - default: /* NJS_VOID */ + case NJS_VOID: + default: goto done; } @@ -2452,7 +2453,8 @@ njs_string_prototype_split(njs_vm_t *vm, goto done; - default: /* NJS_VOID */ + case NJS_VOID: + default: break; } } diff -r 39374a5d6cda -r 641b3189d658 njs/njs_string.h --- a/njs/njs_string.h Tue Apr 03 17:55:23 2018 +0300 +++ b/njs/njs_string.h Tue Apr 03 17:55:56 2018 +0300 @@ -112,7 +112,8 @@ njs_string_length(njs_utf8_t utf8, u_cha case NJS_STRING_ASCII: return size; - default: /* NJS_STRING_UTF8 */ + case NJS_STRING_UTF8: + default: length = nxt_utf8_length(start, size); return (length >= 0) ? length : 0; diff -r 39374a5d6cda -r 641b3189d658 njs/njs_vm.c --- a/njs/njs_vm.c Tue Apr 03 17:55:23 2018 +0300 +++ b/njs/njs_vm.c Tue Apr 03 17:55:56 2018 +0300 @@ -649,9 +649,9 @@ njs_vmcode_property_get(njs_vm_t *vm, nj return sizeof(njs_vmcode_prop_get_t); + case NJS_TRAP_PROPERTY: + case NXT_ERROR: default: - /* NJS_TRAP_PROPERTY */ - /* NXT_ERROR */ return ret; } @@ -760,9 +760,9 @@ njs_vmcode_property_set(njs_vm_t *vm, nj return sizeof(njs_vmcode_prop_set_t); + case NJS_TRAP_PROPERTY: + case NXT_ERROR: default: - /* NJS_TRAP_PROPERTY */ - /* NXT_ERROR */ return ret; } @@ -844,9 +844,9 @@ njs_vmcode_property_in(njs_vm_t *vm, njs break; + case NJS_TRAP_PROPERTY: + case NXT_ERROR: default: - /* NJS_TRAP_PROPERTY */ - /* NXT_ERROR */ return ret; } @@ -946,9 +946,9 @@ njs_vmcode_property_delete(njs_vm_t *vm, break; + case NJS_TRAP_PROPERTY: + case NXT_ERROR: default: - /* NJS_TRAP_PROPERTY */ - /* NXT_ERROR */ return ret; } @@ -1059,7 +1059,9 @@ njs_property_query(njs_vm_t *vm, njs_pro obj = NULL; break; - default: /* NJS_VOID, NJS_NULL. */ + case NJS_VOID: + case NJS_NULL: + default: if (nxt_fast_path(njs_is_primitive(property))) { ret = njs_primitive_value_to_string(vm, &pq->value, property); _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel