[PATCH 2/2] rework menu so that it can support multiline titles

Aleksey Kuleshov rndfax at yandex.ru
Thu Aug 18 03:48:32 PDT 2016


>>  > We have the strim() function for this purpose.
>>
>>   * strim - Removes leading and trailing whitespace from @s.
>>
>>  And mine does only:
>>  >> + /* Remove trailing whitespaces */
>
> You can use strim for both cases:
>
>         str = strim(str);
>
> removes both leading and trailing whitespaces, but without reassigning
> str to the return value of strim() you only remove trailing whitespaces.

Well, this is rather hack than normal using.
Because this way of using has nothing to do with the description:

 * strim - Removes leading and trailing whitespace from @s.
 * @s: The string to be stripped.
 * Returns a pointer to the first non-whitespace character in @s.

Here is the patch which removes this misunderstanding:

diff --git a/lib/string.c b/lib/string.c
index a3e9fd8..1d491c9 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -641,7 +641,7 @@ char *skip_spaces(const char *str)
 }

 /**
- * strim - Removes leading and trailing whitespace from @s.
+ * strim - Removes trailing whitespace from @s.
  * @s: The string to be stripped.
  *
  * Note that the first trailing whitespace is replaced with a %NUL-terminator



More information about the barebox mailing list