Skip to content

Commit 3f6d972

Browse files
phillipjohnstoneyalroz
authored andcommitted
Correct _putchar() usage to putchar_() to match new library style.
1 parent 36ad016 commit 3f6d972

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Whichever way you choose to use the library:
6666

6767
* You can have this library stand-in for the C standard library's `printf()` family of functions, e.g. provide `snprintf()` instead of `snprintf_()`, by setting an appropriate [preprocessor definition](#cmake-options-and-preprocessor-definitions) during compilation and use.
6868
* Speaking of the preprocessor definition [preprocessor definitions](#cmake-options-and-preprocessor-definitions) which affect the library's behavior - you have to be consistent in their choice when building and when using the library. (The easiest way to do that is just not to change any of them and accept the reasonable defaults.)
69-
* Two of the functions --- `printf_()` and `vprintf_()` --- will only be usable if you implement a `_putchar(char c)` function for them to use.
69+
* Two of the functions --- `printf_()` and `vprintf_()` --- will only be usable if you implement a `putchar_(char c)` function for them to use.
7070
* **Avoid `sprintf()` in favor of `snprintf()` for safety and security** - and that goes for the standard C library `sprintf()` as well:. `sprintf()` is unaware of the amount of memory allocated for the string it writes into, and will "happily" overflow your buffer; instead of calling it, pass your buffer size to `snprintf()` - and avoid overflow.
7171

7272
Finally, if you've started using the library in a publicly-available (FOSS or commercial) project, please consider emailing [@eyalroz](https://github.com/eyalroz), or open an [issue](https://github.com/eyalroz/printf/issues/), to announce this.
@@ -117,7 +117,7 @@ int snprintf_(char* buffer, size_t count, const char* format, ...);
117117
int vsnprintf_(char* buffer, size_t count, const char* format, va_list va);
118118
int vprintf_(const char* format, va_list va);
119119
```
120-
Note that `printf()` and `vprintf()` don't actually write anything on their own: In addition to their parameters, you must provide them with a lower-level `_putchar()` function which they can call for actual printing. This is part of this library's independence: It is isolated from dealing with console/serial output, files etc.
120+
Note that `printf()` and `vprintf()` don't actually write anything on their own: In addition to their parameters, you must provide them with a lower-level `putchar_()` function which they can call for actual printing. This is part of this library's independence: It is isolated from dealing with console/serial output, files etc.
121121

122122
Two additional functions are provided beyond those available in the standard library:
123123
```

src/printf/printf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ int vprintf_(const char* format, va_list va) ATTR_VPRINTF(1);
125125

126126
/**
127127
* printf/vprintf with output function
128-
* You may use this as dynamic alternative to printf() with its fixed _putchar() output
128+
* You may use this as dynamic alternative to printf() with its fixed putchar_() output
129129
* @param out An output function which takes one character and an argument pointer
130130
* @param arg An argument pointer for user data passed to output function
131131
* @param format A string that specifies the format of the output

0 commit comments

Comments
 (0)