enhanced hcl_inttostr() to keep results in the temporary buffer when ngc is negative.

changed the integer printing function to utilize this change in print.c
This commit is contained in:
2018-02-15 08:05:48 +00:00
parent 46a4bd1561
commit 2a0551df2d
6 changed files with 93 additions and 55 deletions

View File

@ -970,6 +970,15 @@ hcl_oop_t hcl_strtoint (
int radix
);
/**
* The hcl_inttostr() function converts an integer object to a string object
* printed in the given radix. If ngc is 0, it creates a normal string object
* managed by object memory manager. If ngc greater than 0, it creates a non-GC
* string object that should be destroyed with hcl_freengcobj() later. If ngc
* is less than 0, it returns hcl->_nil but keeps the result in the buffer
* pointed to by hcl->inttostr.xbuf.ptr with the length stored in
* hcl->inttostr.xbuf.len. If the function fails, it returns #HCL_NULL.
*/
hcl_oop_t hcl_inttostr (
hcl_t* hcl,
hcl_oop_t num,
@ -977,7 +986,6 @@ hcl_oop_t hcl_inttostr (
int ngc
);
/* ========================================================================= */
/* print.c */
/* ========================================================================= */