strfcpy.h 524 B

1234567891011121314151617
  1. #pragma once
  2. /*
  3. * strfcpy is a faster version of strlcpy().
  4. * It returns void thus does not wastes time computing
  5. * (most likely, unneeded) strlen(str)
  6. *
  7. * Comparison with other copying functions:
  8. * strcpy() - buffer overflow ready
  9. * strncpy() - wastes time filling exactly n bytes with 0
  10. * strlcpy() - wastes time searching for the length of src
  11. * memcpy() - wastes time copying exactly n bytes even if the string is shorter
  12. */
  13. #include <stddef.h>
  14. void strfcpy(char* dst, const char* src, size_t n);