Added aksl_atof

This commit is contained in:
2026-05-25 21:29:46 -04:00
parent def4175d0a
commit 485b241595
2 changed files with 10 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ akerr_ErrorContext AKERR_NOIGNORE *aksl_sprintf(int *count, char *restrict str,
akerr_ErrorContext AKERR_NOIGNORE *aksl_atoi(const char *nptr, int *dest); akerr_ErrorContext AKERR_NOIGNORE *aksl_atoi(const char *nptr, int *dest);
akerr_ErrorContext AKERR_NOIGNORE *aksl_atol(const char *nptr, long *dest); akerr_ErrorContext AKERR_NOIGNORE *aksl_atol(const char *nptr, long *dest);
akerr_ErrorContext AKERR_NOIGNORE *aksl_atoll(const char *nptr, long long *dest); akerr_ErrorContext AKERR_NOIGNORE *aksl_atoll(const char *nptr, long long *dest);
akerr_ErrorContext AKERR_NOIGNORE *aksl_atof(const char *nptr, double *dest);
akerr_ErrorContext AKERR_NOIGNORE *aksl_realpath(const char *restrict path, char *restrict resolved_path); akerr_ErrorContext AKERR_NOIGNORE *aksl_realpath(const char *restrict path, char *restrict resolved_path);

View File

@@ -156,6 +156,15 @@ akerr_ErrorContext AKERR_NOIGNORE *aksl_atoll(const char *nptr, long long *dest)
SUCCEED_RETURN(e); SUCCEED_RETURN(e);
} }
akerr_ErrorContext AKERR_NOIGNORE *aksl_atof(const char *nptr, double *dest)
{
PREPARE_ERROR(e);
FAIL_ZERO_RETURN(e, nptr, AKERR_NULLPOINTER, "nptr=%p, dest=%p", (void *)nptr, (void *)dest);
FAIL_ZERO_RETURN(e, dest, AKERR_NULLPOINTER, "nptr=%p, dest=%p", (void *)nptr, (void *)dest);
*dest = atof(nptr);
SUCCEED_RETURN(e);
}
akerr_ErrorContext AKERR_NOIGNORE *aksl_realpath(const char *restrict path, char *restrict resolved_path) akerr_ErrorContext AKERR_NOIGNORE *aksl_realpath(const char *restrict path, char *restrict resolved_path)
{ {
char *result = NULL; char *result = NULL;