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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]