Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions libc/src/stdio/asprintf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
#include "src/__support/macros/config.h"
#include "src/stdio/printf_core/vasprintf_internal.h"

namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, asprintf,
(char **__restrict buffer, const char *format, ...)) {
(char **__restrict buffer, const char *__restrict format,
...)) {
va_list vlist;
va_start(vlist, format);
internal::ArgList args(vlist); // This holder class allows for easier copying
Expand All @@ -25,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, asprintf,
return ret;
}

} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
2 changes: 1 addition & 1 deletion libc/src/stdio/asprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace LIBC_NAMESPACE {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this namespace might have gotten missed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could've sworn I added those, maybe I forgot to save the file or something. I'll just push it in a follow up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That made the bot unhappy it seems, I'll fix it.


int asprintf(char **__restrict s, const char *format, ...);
int asprintf(char **__restrict s, const char *__restrict format, ...);

} // namespace LIBC_NAMESPACE

Expand Down
6 changes: 3 additions & 3 deletions libc/src/stdio/printf_core/vasprintf_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "src/stdio/printf_core/writer.h"
#include <stdlib.h> // malloc, realloc, free

namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {
namespace printf_core {

LIBC_INLINE int resize_overflow_hook(cpp::string_view new_str, void *target) {
Expand All @@ -40,7 +40,7 @@ LIBC_INLINE int resize_overflow_hook(cpp::string_view new_str, void *target) {

constexpr size_t DEFAULT_BUFFER_SIZE = 200;

LIBC_INLINE int vasprintf_internal(char **ret, const char *format,
LIBC_INLINE int vasprintf_internal(char **ret, const char *__restrict format,
internal::ArgList args) {
char init_buff_on_stack[DEFAULT_BUFFER_SIZE];
printf_core::WriteBuffer wb(init_buff_on_stack, DEFAULT_BUFFER_SIZE,
Expand All @@ -64,4 +64,4 @@ LIBC_INLINE int vasprintf_internal(char **ret, const char *format,
return ret_val;
}
} // namespace printf_core
} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
7 changes: 4 additions & 3 deletions libc/src/stdio/vasprintf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
#include "src/__support/arg_list.h"
#include "src/stdio/printf_core/vasprintf_internal.h"

namespace LIBC_NAMESPACE {
namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, vasprintf,
(char **__restrict ret, const char *format, va_list vlist)) {
(char **__restrict ret, const char *__restrict format,
va_list vlist)) {
internal::ArgList args(vlist); // This holder class allows for easier copying
// and pointer semantics, as well as handling
// destruction automatically.
return printf_core::vasprintf_internal(ret, format, args);
}

} // namespace LIBC_NAMESPACE
} // namespace LIBC_NAMESPACE_DECL
3 changes: 2 additions & 1 deletion libc/src/stdio/vasprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

namespace LIBC_NAMESPACE {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this namespace


int vasprintf(char **__restrict s, const char *format, va_list vlist);
int vasprintf(char **__restrict s, const char *__restrict format,
va_list vlist);

} // namespace LIBC_NAMESPACE

Expand Down
Loading