Skip to content

Commit 7e92390

Browse files
Copilotwysaid
andcommitted
Remove unused utility functions ccap_free_string, ccap_strdup, and ccap_strnlen
Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com>
1 parent 1009427 commit 7e92390

2 files changed

Lines changed: 0 additions & 56 deletions

File tree

include/ccap_utils_c.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -79,29 +79,6 @@ CCAP_EXPORT bool ccap_save_rgb_data_as_bmp(const char* filename, const unsigned
7979
uint32_t width, uint32_t line_offset, uint32_t height,
8080
bool is_bgr, bool has_alpha, bool is_top_to_bottom);
8181

82-
/* ========== Memory Utilities ========== */
83-
84-
/**
85-
* @brief Free string allocated by ccap C functions
86-
* @param str String to free (can be NULL)
87-
*/
88-
CCAP_EXPORT void ccap_free_string(char* str);
89-
90-
/**
91-
* @brief Duplicate a string (similar to strdup)
92-
* @param str Source string
93-
* @return Duplicated string (caller must free with ccap_free_string), or NULL on failure
94-
*/
95-
CCAP_EXPORT char* ccap_strdup(const char* str);
96-
97-
/**
98-
* @brief Get the length of a string safely
99-
* @param str String to measure (can be NULL)
100-
* @param max_len Maximum length to check
101-
* @return String length, or 0 if str is NULL
102-
*/
103-
CCAP_EXPORT size_t ccap_strnlen(const char* str, size_t max_len);
104-
10582
/* ========== Logging Utilities ========== */
10683

10784
/**

src/ccap_utils_c.cpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -105,39 +105,6 @@ bool ccap_save_rgb_data_as_bmp(const char* filename, const unsigned char* data,
105105
is_bgr, has_alpha, is_top_to_bottom);
106106
}
107107

108-
/* ========== Memory Utilities ========== */
109-
110-
void ccap_free_string(char* str) {
111-
if (str) {
112-
std::free(str);
113-
}
114-
}
115-
116-
char* ccap_strdup(const char* str) {
117-
if (!str) {
118-
return nullptr;
119-
}
120-
121-
size_t len = std::strlen(str);
122-
char* result = static_cast<char*>(std::malloc(len + 1));
123-
if (result) {
124-
std::memcpy(result, str, len + 1);
125-
}
126-
return result;
127-
}
128-
129-
size_t ccap_strnlen(const char* str, size_t max_len) {
130-
if (!str) {
131-
return 0;
132-
}
133-
134-
size_t len = 0;
135-
while (len < max_len && str[len] != '\0') {
136-
len++;
137-
}
138-
return len;
139-
}
140-
141108
/* ========== Logging Utilities ========== */
142109

143110
void ccap_set_log_level(CcapLogLevel level) {

0 commit comments

Comments
 (0)