History

Subject: Re: [PATCH] strstrip incorrectly marked __must_check

Recently, We marked strstrip() as must_check. because it was frequently misused and it should be checked. However, we found one exception. scsi/ipr.c intentionally ignore return value of strstrip. Because it wishes to keep the whitespace at the beginning. Thus we need to keep with and without checked whitespace trim function. This patch adds a new strim() and changes ipr.c to use it. [akpm@linux-foundation.org: coding-style fixes] Suggested-by: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

KOSAKI Motohiro committed 16 years ago

Commit ca54cb81 parent 925ede03 files · +13 −6Browse files

Showing the changes to lib/string.c (1 of 3 files). Show all

Unified · Split

lib/string.c+3−3
@@ -352,14 +352,14 @@ char *skip_spaces(const char *str) · 351 unmodified lines
352EXPORT_SYMBOL(skip_spaces);352EXPORT_SYMBOL(skip_spaces);
353 353
354/**354/**
355 * strstrip - Removes leading and trailing whitespace from @s.355 * strim - Removes leading and trailing whitespace from @s.
356 * @s: The string to be stripped.356 * @s: The string to be stripped.
357 *357 *
358 * Note that the first trailing whitespace is replaced with a %NUL-terminator358 * Note that the first trailing whitespace is replaced with a %NUL-terminator
359 * in the given string @s. Returns a pointer to the first non-whitespace359 * in the given string @s. Returns a pointer to the first non-whitespace
360 * character in @s.360 * character in @s.
361 */361 */
362char *strstrip(char *s)362char *strim(char *s)
363{363{
364 size_t size;364 size_t size;
365 char *end;365 char *end;
@@ -376,7 +376,7 @@ char *strstrip(char *s) · 10 unmodified lines
376 376
377 return s;377 return s;
378}378}
379EXPORT_SYMBOL(strstrip);379EXPORT_SYMBOL(strim);
380 380
381#ifndef __HAVE_ARCH_STRLEN381#ifndef __HAVE_ARCH_STRLEN
382/**382/**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t