diff options
Diffstat (limited to 'erts/emulator/beam/external.c')
-rw-r--r-- | erts/emulator/beam/external.c | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c index 8c4d9108d4..70d4535770 100644 --- a/erts/emulator/beam/external.c +++ b/erts/emulator/beam/external.c @@ -1524,7 +1524,8 @@ static byte* dec_atom(ErtsDistExternal *edep, byte* ep, Eterm* objp) { Uint len; - int n, is_latin1; + int n; + ErtsAtomEncoding char_enc; switch (*ep++) { case ATOM_CACHE_REF: @@ -1540,34 +1541,29 @@ dec_atom(ErtsDistExternal *edep, byte* ep, Eterm* objp) case ATOM_EXT: len = get_int16(ep), ep += 2; - is_latin1 = 1; + char_enc = ERTS_ATOM_ENC_LATIN1; goto dec_atom_common; case SMALL_ATOM_EXT: len = get_int8(ep); ep++; - is_latin1 = 1; + char_enc = ERTS_ATOM_ENC_LATIN1; goto dec_atom_common; case ATOM_UTF8_EXT: len = get_int16(ep), ep += 2; - is_latin1 = 0; + char_enc = ERTS_ATOM_ENC_UTF8; goto dec_atom_common; case SMALL_ATOM_UTF8_EXT: len = get_int8(ep), ep++; - is_latin1 = 0; + char_enc = ERTS_ATOM_ENC_UTF8; dec_atom_common: if (edep && (edep->flags & ERTS_DIST_EXT_BTT_SAFE)) { - if (!erts_atom_get((char*)ep, len, objp, is_latin1)) { + if (!erts_atom_get((char*)ep, len, objp, char_enc)) { goto error; } } else { - Eterm atom = erts_atom_put(ep, - len, - (is_latin1 - ? ERTS_ATOM_ENC_LATIN1 - : ERTS_ATOM_ENC_UTF8), - 0); + Eterm atom = erts_atom_put(ep, len, char_enc, 0); if (is_non_value(atom)) goto error; *objp = atom; @@ -2175,7 +2171,8 @@ static byte* dec_term(ErtsDistExternal *edep, Eterm** hpp, byte* ep, ErlOffHeap* off_heap, Eterm* objp) { Eterm* hp_saved = *hpp; - int n, is_latin1; + int n; + ErtsAtomEncoding char_enc; register Eterm* hp = *hpp; /* Please don't take the address of hp */ Eterm* next = objp; @@ -2261,34 +2258,29 @@ dec_term(ErtsDistExternal *edep, Eterm** hpp, byte* ep, ErlOffHeap* off_heap, Et case ATOM_EXT: n = get_int16(ep); ep += 2; - is_latin1 = 1; + char_enc = ERTS_ATOM_ENC_LATIN1; goto dec_term_atom_common; case SMALL_ATOM_EXT: n = get_int8(ep); ep++; - is_latin1 = 1; + char_enc = ERTS_ATOM_ENC_LATIN1; goto dec_term_atom_common; case ATOM_UTF8_EXT: n = get_int16(ep); ep += 2; - is_latin1 = 0; + char_enc = ERTS_ATOM_ENC_UTF8; goto dec_term_atom_common; case SMALL_ATOM_UTF8_EXT: n = get_int8(ep); ep++; - is_latin1 = 0; + char_enc = ERTS_ATOM_ENC_UTF8; dec_term_atom_common: if (edep && (edep->flags & ERTS_DIST_EXT_BTT_SAFE)) { - if (!erts_atom_get((char*)ep, n, objp, is_latin1)) { + if (!erts_atom_get((char*)ep, n, objp, char_enc)) { goto error; } } else { - Eterm atom = erts_atom_put(ep, - n, - (is_latin1 - ? ERTS_ATOM_ENC_LATIN1 - : ERTS_ATOM_ENC_UTF8), - 0); + Eterm atom = erts_atom_put(ep, n, char_enc, 0); if (is_non_value(atom)) goto error; *objp = atom; |