Skip to content

Commit

Permalink
CHANGE: RL_Register_Handle from extension returns word's symbol id
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Jun 11, 2021
1 parent 65b6f22 commit 9c58928
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/a-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ RL_API REBSER* RL_Decode_UTF_String(REBYTE *src, REBCNT len, REBINT utf, REBFLG
** Stores handle's specification (required data size and optional free callback.
**
** Returns:
** table index for the word (whether found or new)
** symbol id of the word (whether found or new)
** or NOT_FOUND if handle with give ID is already registered.
** Arguments:
** name - handle's name as a c-string (length is being detected)
Expand All @@ -1139,11 +1139,14 @@ RL_API REBSER* RL_Decode_UTF_String(REBYTE *src, REBCNT len, REBINT utf, REBFLG
{
REBCNT sym;
REBCNT len;
REBCNT idx;

// Convert C-string to Rebol word
len = strlen(cs_cast(name));
sym = Scan_Word(name, len);
if (!sym) return NOT_FOUND; //TODO: use different value if word is invalid?
return Register_Handle(sym, size, (REB_HANDLE_FREE_FUNC)free_func);
idx = Register_Handle(sym, size, (REB_HANDLE_FREE_FUNC)free_func);
return (idx == NOT_FOUND) ? NOT_FOUND : sym;
}

RL_API REBHOB* RL_Make_Handle_Context(REBCNT sym)
Expand Down

0 comments on commit 9c58928

Please sign in to comment.