A custom implementation of the standard C <string.h> library with sprintf/sscanf support.
To avoid namespace collisions with standard libc, all functions use a c_ prefix (e.g., c_strlen, c_memcpy). The project was developed with a strict focus on memory safety, arbitrary precision math, and engineering best practices.
- Standard Functions: Full reimplementation of <string.h> without using standard library functions internally.
- Formatted I/O: Custom c_sprintf and c_sscanf supporting width, precision, length modifiers, and all standard specifiers.
- Extended API: Additional utilities for string manipulation (c_to_upper, c_to_lower, c_insert, c_trim).
This project is not just about writing code; it's about maintaining it at a production level:
- Testing: 100% function coverage using the Check framework.
- Memory Safety: Zero memory leaks guaranteed by Valgrind.
- Analysis: Static analysis via Cppcheck and dynamic coverage reports via Gcov/Lcov.
- Style: Strict formatting enforcement using Clang-format.
# Clone the repository
git clone https://github.com/HimeNSK/c_string_lib.git
cd c_string_lib
# Build the static library
make all
# Run unit tests
make testmake clean make test make clangn make clangi make gcov
.
├── Makefile
├── src
│ ├── c_string.h # Header file with function prototypes
│ ├── c_string.c # Standard string.h functions
│ ├── c_string_extra.c # Additional custom functions
│ ├── c_sprintf.c # sprintf implementation
│ └── c_sscanf.c # sscanf implementation
└── tests
├── test_string.c
├── test_extra.c
├── test_sprintf.c
└── test_sscanf.c
Кастомная реализация стандартной библиотеки C <string.h> с поддержкой sprintf/sscanf. Чтобы избежать конфликтов имен со стандартной библиотекой, все функции используют префикс c_ (например, c_strlen). Проект разработан с упором на безопасность памяти и инженерные практики.
- Стандартные функции: Полная реимплементация <string.h> без использования стандартных библиотек внутри.
- Форматированный вывод: Собственные c_sprintf и c_sscanf с поддержкой ширины, точности и модификаторов.
- Расширенный API: Дополнительные утилиты ( c_to_upper, c_to_lower, c_insert, c_trim ).
Проект поддерживается на уровне production-решений:
- Тестирование: 100% покрытие функций с использованием фреймворка Check.
- Память: Отсутствие утечек, проверяемое Valgrind.
- Анализ: Статический анализ Cppcheck и отчеты покрытия Gcov/Lcov.
- Стиль: Строгое форматирование кода через Clang-format.