From f8cc0672ba642c84cce53266d5b8b2fca638cb7e Mon Sep 17 00:00:00 2001 From: Marrub Date: Tue, 18 Oct 2016 13:44:22 -0400 Subject: [PATCH] stdlib: Add Lth_strdup_str --- lithos_c/inc/Lth_stdlib.h | 1 + lithos_c/src/stdlib.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lithos_c/inc/Lth_stdlib.h b/lithos_c/inc/Lth_stdlib.h index eb8edc5..7cbf702 100644 --- a/lithos_c/inc/Lth_stdlib.h +++ b/lithos_c/inc/Lth_stdlib.h @@ -19,6 +19,7 @@ // char *Lth_strdup(char const *s); +__str Lth_strdup_str(char const *s); void Lth_PrintString(char const *s); #endif//lithos3__Lth_stdlib_h diff --git a/lithos_c/src/stdlib.c b/lithos_c/src/stdlib.c index 742b69e..1f16103 100644 --- a/lithos_c/src/stdlib.c +++ b/lithos_c/src/stdlib.c @@ -35,6 +35,20 @@ char *Lth_strdup(char const *s) return ret; } +// +// Lth_strdup_str +// +// Duplicates a string into a new string entity. +// +__str Lth_strdup_str(char const *s) +{ + Lth_assert(s != NULL); + size_t len = strlen(s); + ACS_BeginPrint(); + Lth_PrintString(s); + return ACS_EndStrParam(); +} + // // Lth_PrintString //