Whitespace gardening in jerry-libc (#2082)
Also includes the addition and styling of some doc comments (but those are whitespace too). JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -46,7 +46,7 @@ extern void _fini (void);
|
||||
/**
|
||||
* No-op default _init.
|
||||
*/
|
||||
void __attr_weak___
|
||||
void __attr_weak___
|
||||
_init (void)
|
||||
{
|
||||
} /* _init */
|
||||
@@ -54,7 +54,7 @@ _init (void)
|
||||
/**
|
||||
* No-op default _fini.
|
||||
*/
|
||||
void __attr_weak___
|
||||
void __attr_weak___
|
||||
_fini (void)
|
||||
{
|
||||
} /* _fini */
|
||||
|
||||
@@ -120,6 +120,9 @@ libc_printf_justified_string_output (FILE *stream, /**< stream pointer */
|
||||
|
||||
/**
|
||||
* printf helper function that converts unsigned integer to string
|
||||
*
|
||||
* @return start of the string representation (within the output string buffer
|
||||
* but not necessarily at its start)
|
||||
*/
|
||||
static char *
|
||||
libc_printf_uint_to_string (uintmax_t value, /**< integer value */
|
||||
@@ -717,9 +720,9 @@ vfprintf (FILE *stream, /**< stream pointer */
|
||||
* @return number of characters printed
|
||||
*/
|
||||
int
|
||||
fprintf (FILE *stream, /**< stream pointer */
|
||||
fprintf (FILE *stream, /**< stream pointer */
|
||||
const char *format, /**< format string */
|
||||
...) /**< parameters' values */
|
||||
...) /**< parameters' values */
|
||||
{
|
||||
va_list args;
|
||||
|
||||
@@ -739,7 +742,7 @@ fprintf (FILE *stream, /**< stream pointer */
|
||||
*/
|
||||
int
|
||||
printf (const char *format, /**< format string */
|
||||
...) /**< parameters' values */
|
||||
...) /**< parameters' values */
|
||||
{
|
||||
va_list args;
|
||||
|
||||
@@ -751,4 +754,3 @@ printf (const char *format, /**< format string */
|
||||
|
||||
return ret;
|
||||
} /* printf */
|
||||
|
||||
|
||||
+39
-15
@@ -57,8 +57,8 @@ CALL_PRAGMA (GCC optimize ("-fno-tree-loop-distribute-patterns"))
|
||||
* @return @a s
|
||||
*/
|
||||
void * __attr_used___
|
||||
memset (void *s, /**< area to set values in */
|
||||
int c, /**< value to set */
|
||||
memset (void *s, /**< area to set values in */
|
||||
int c, /**< value to set */
|
||||
size_t n) /**< area size */
|
||||
{
|
||||
uint8_t *area_p = (uint8_t *) s;
|
||||
@@ -97,6 +97,8 @@ memcmp (const void *s1, /**< first area */
|
||||
|
||||
/**
|
||||
* memcpy
|
||||
*
|
||||
* @return the dest pointer's value
|
||||
*/
|
||||
void * __attr_used___
|
||||
memcpy (void *s1, /**< destination */
|
||||
@@ -174,10 +176,15 @@ CALL_PRAGMA (GCC pop_options)
|
||||
CALL_PRAGMA (GCC diagnostic pop)
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
/** Compare two strings. return an integer less than, equal to, or greater than zero
|
||||
if s1 is found, respectively, to be less than, to match, or be greater than s2. */
|
||||
/**
|
||||
* Compare two strings.
|
||||
*
|
||||
* @return an integer less than, equal to, or greater than zero if s1 is found, respectively,
|
||||
* to be less than, to match, or be greater than s2.
|
||||
*/
|
||||
int
|
||||
strcmp (const char *s1, const char *s2)
|
||||
strcmp (const char *s1, /**< first string */
|
||||
const char *s2) /**< second string */
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
@@ -192,11 +199,16 @@ strcmp (const char *s1, const char *s2)
|
||||
}
|
||||
} /* strcmp */
|
||||
|
||||
/** Compare two strings. return an integer less than, equal to, or greater than zero
|
||||
if the first n character of s1 is found, respectively, to be less than, to match,
|
||||
or be greater than the first n character of s2. */
|
||||
/**
|
||||
* Compare two strings.
|
||||
*
|
||||
* @return an integer less than, equal to, or greater than zero if the first n character of s1 is found, respectively,
|
||||
* to be less than, to match, or be greater than the first n character of s2.
|
||||
*/
|
||||
int
|
||||
strncmp (const char *s1, const char *s2, size_t n)
|
||||
strncmp (const char *s1, /**< first string */
|
||||
const char *s2, /**< second string */
|
||||
size_t n) /**< maximum number of characters to compare */
|
||||
{
|
||||
while (n--)
|
||||
{
|
||||
@@ -213,11 +225,19 @@ strncmp (const char *s1, const char *s2, size_t n)
|
||||
return 0;
|
||||
} /* strncmp */
|
||||
|
||||
/** Copy a string. At most n bytes of src are copied. Warning: If there is no
|
||||
null byte among the first n bytes of src, the string placed in dest will not be null-terminated.
|
||||
@return a pointer to the destination string dest. */
|
||||
/**
|
||||
* Copy a string. At most n bytes of src are copied.
|
||||
*
|
||||
* Note:
|
||||
* If there is no null byte among the first n bytes of src, the string
|
||||
* placed in dest will not be null-terminated.
|
||||
*
|
||||
* @return a pointer to the destination string dest.
|
||||
*/
|
||||
char * __attr_used___
|
||||
strncpy (char *dest, const char *src, size_t n)
|
||||
strncpy (char *dest, /**< destination string */
|
||||
const char *src, /**< source string */
|
||||
size_t n) /**< maximum number of characters to copy */
|
||||
{
|
||||
while (n--)
|
||||
{
|
||||
@@ -233,9 +253,13 @@ strncpy (char *dest, const char *src, size_t n)
|
||||
return dest;
|
||||
} /* strncpy */
|
||||
|
||||
/** Calculate the length of a string. */
|
||||
/**
|
||||
* Calculate the length of a string.
|
||||
*
|
||||
* @return the length.
|
||||
*/
|
||||
size_t
|
||||
strlen (const char *s)
|
||||
strlen (const char *s) /**< string */
|
||||
{
|
||||
size_t i = 0;
|
||||
while (s[i])
|
||||
|
||||
@@ -88,9 +88,12 @@ abort (void)
|
||||
|
||||
/**
|
||||
* Send a signal to the current process.
|
||||
*
|
||||
* @return 0 - upon successful completion,
|
||||
* non-zero value - otherwise.
|
||||
*/
|
||||
int __attr_used___
|
||||
raise (int sig)
|
||||
raise (int sig) /**< signal number */
|
||||
{
|
||||
return (int) syscall_2 (SYSCALL_NO (kill), syscall_0 (SYSCALL_NO (getpid)), sig);
|
||||
} /* raise */
|
||||
@@ -99,7 +102,7 @@ raise (int sig)
|
||||
* fopen
|
||||
*
|
||||
* @return FILE pointer - upon successful completion,
|
||||
* NULL - otherwise
|
||||
* NULL - otherwise.
|
||||
*/
|
||||
FILE *
|
||||
fopen (const char *path, /**< file path */
|
||||
@@ -274,46 +277,3 @@ gettimeofday (void *tp, /**< struct timeval */
|
||||
{
|
||||
return (int) syscall_2 (SYSCALL_NO (gettimeofday), (long int) tp, (long int) tzp);
|
||||
} /* gettimeofday */
|
||||
|
||||
/* FIXME */
|
||||
#if 0
|
||||
/**
|
||||
* Setup new memory limits
|
||||
*/
|
||||
void
|
||||
jrt_set_mem_limits (size_t data_size, /**< limit for data + bss + brk heap */
|
||||
size_t stack_size) /**< limit for stack */
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned long long rlim_cur;
|
||||
unsigned long long rlim_max;
|
||||
} data_limit = { data_size, data_size };
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned long long rlim_cur;
|
||||
unsigned long long rlim_max;
|
||||
} stack_limit = { stack_size, stack_size };
|
||||
|
||||
long int ret;
|
||||
|
||||
#if defined (__TARGET_HOST_x64)
|
||||
ret = syscall_2 (SYSCALL_NO (setrlimit), RLIMIT_DATA, (intptr_t) &data_limit);
|
||||
assert (ret == 0);
|
||||
|
||||
ret = syscall_2 (SYSCALL_NO (setrlimit), RLIMIT_STACK, (intptr_t) &stack_limit);
|
||||
assert (ret == 0);
|
||||
#elif defined (__TARGET_HOST_ARMv7)
|
||||
ret = syscall_3 (SYSCALL_NO (prlimit64), 0, RLIMIT_DATA, (intptr_t) &data_limit);
|
||||
assert (ret == 0);
|
||||
|
||||
ret = syscall_3 (SYSCALL_NO (prlimit64), 0, RLIMIT_STACK, (intptr_t) &stack_limit);
|
||||
assert (ret == 0);
|
||||
#elif defined (__TARGET_HOST_x86)
|
||||
# error "__TARGET_HOST_x86 case is not implemented"
|
||||
#else /* !__TARGET_HOST_x64 && !__TARGET_HOST_ARMv7 && !__TARGET_HOST_x86 */
|
||||
# error "!__TARGET_HOST_x64 && !__TARGET_HOST_ARMv7 && !__TARGET_HOST_x86"
|
||||
#endif /* __TARGET_HOST_x64 */
|
||||
} /* jrt_set_mem_limits */
|
||||
#endif /* 0 */
|
||||
|
||||
Reference in New Issue
Block a user