Skip to content

Commit

Permalink
Use compatibility macros
Browse files Browse the repository at this point in the history
To ensure compatibility with at least R13B04
  • Loading branch information
fdmanana committed Mar 29, 2011
1 parent a2aff62 commit 05ce33c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions c_src/encode.c
Expand Up @@ -153,16 +153,16 @@ final_encode(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
}
done:
if (ctx.error == NOMEM) {
enif_release_binary(&ctx.bin);
enif_release_binary_compat(env, &ctx.bin);
return no_mem_error(env);
} else if (ctx.error == BADARG) {
enif_release_binary(&ctx.bin);
enif_release_binary_compat(env, &ctx.bin);
return enif_make_badarg(env);
}

// Resize the binary to our exact final size
if(!enif_realloc_binary(&(ctx.bin), ctx.fill_offset)) {
enif_release_binary(&ctx.bin);
if(!enif_realloc_binary_compat(env, &(ctx.bin), ctx.fill_offset)) {
enif_release_binary_compat(env, &ctx.bin);
return no_mem_error(env);
}
// make the binary term which transfers ownership
Expand Down

0 comments on commit 05ce33c

Please sign in to comment.