Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Add replacements for all standard functions that take null-terminated strings #9

Description

@automainint

Example

#define KIT_MAKE_ZT(string_, max_size_)                    \
  assert((string_).size < max_size_);                      \
  char buf_##string_[max_size_ + 1];                       \
  memcpy(buf_##string_, (string_).values, (string_).size); \
  buf_##string_[(string_).size] = '\0';

FILE *kit_fopen(kit_str_t name, kit_str_t format) {
  KIT_MAKE_ZT(name, PATH_MAX);
  KIT_MAKE_ZT(format, 100);

  return fopen(buf_name, buf_format);
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions