pnoltes commented on code in PR #545:
URL: https://github.com/apache/celix/pull/545#discussion_r1186681809
##########
libs/utils/src/celix_convert_utils.c:
##########
@@ -114,7 +114,7 @@ celix_version_t* celix_utils_convertStringToVersion(const
char* val, const celix
if (firstDot != NULL && lastDot != NULL && firstDot != lastDot) {
char buf[64];
char* valCopy = celix_utils_writeOrCreateString(buf, sizeof(buf),
"%s", val);
- char *trimmed = utils_stringTrim(valCopy);
+ char *trimmed = celix_utils_trimInPlace(valCopy);
Review Comment:
nice, I think this also fixes an bug. Because in the old situation the
trimmed copy got freed in `celix_utils_freeStringIfNotEqual`, but if
`celix_utils_writeOrCreateString` used a allocation this would leak.
##########
libs/utils/include/celix_utils.h:
##########
@@ -105,6 +105,14 @@ CELIX_UTILS_EXPORT bool
celix_utils_containsWhitespace(const char* s);
* Caller is owner of the returned string.
*/
CELIX_UTILS_EXPORT char* celix_utils_trim(const char* string);
+/**
+ * @brief Trims the provided string in place.
+ *
+ * The trim will remove eny leading and trailing whitespaces (' ', '\t', etc
based on `isspace`)/
Review Comment:
nitpick: typo "any" instead of "eny"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]