Skip to content

fixed boot_snprintf, and nanoprintf linking bugs#589

Merged
adriweb merged 1 commit into
masterfrom
pr/fix_sprintf_linking
Apr 15, 2025
Merged

fixed boot_snprintf, and nanoprintf linking bugs#589
adriweb merged 1 commit into
masterfrom
pr/fix_sprintf_linking

Conversation

@ZERICO2005
Copy link
Copy Markdown
Contributor

boot_snprintf had a call to vnsprintf instead of boot_vnsprintf by mistake.

The user is unlikely to directly call vprintf or vfprintf, so they have been forced inlined into printf and fprintf. This saves space as code for vprintf and vfprintf won't need to be linked in most cases. I would've done this with vasprintf, and vsnprintf, but they are considerably larger

__attribute__((__always_inline__))
int _vprintf_c(const char *__restrict format, va_list vlist)
{
  return npf_vpprintf(npf_putc_std, NULL, format, vlist);
}

int _printf_c(char const *__restrict format, ...) {
  va_list va;
  va_start(va, format);
  int const rv = _vprintf_c(format, va);
  va_end(va);
  return rv;
}

@ZERICO2005 ZERICO2005 force-pushed the pr/fix_sprintf_linking branch from 1f1b827 to fcd61c8 Compare April 15, 2025 05:58
@adriweb adriweb merged commit fcd61c8 into master Apr 15, 2025
9 checks passed
@adriweb adriweb deleted the pr/fix_sprintf_linking branch April 15, 2025 07:22
@ZERICO2005 ZERICO2005 added the libc label Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants