Messages in this thread | | | Subject | Re: [PATCH/RFC] s390: Hypervisor File System | From | Pekka Enberg <> | Date | Tue, 25 Apr 2006 09:27:10 +0300 |
| |
On Mon, 2006-04-24 at 19:17 +0200, Michael Holzheu wrote: > What about something like that: > > /** > * strrtrim - Remove trailing characters specified in @reject > * @s: The string to be searched > * @reject: The string of letters to avoid > */ > static inline void strrtrim(char *s, const char *reject)
Better to make it out-of-line to save kernel text.
> { > char *p; > const char *r; > > for (p = s + strlen(s) - 1; s <= p; p--) { > for (r = reject; (*r != '\0') && (*p != *r); r++) > /* nothing */; > if (*r == '\0') > break; > } > *(p + 1) = '\0'; > } > > Regards > Michael >
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |