Re: String functions with end pointers?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Paul D. Smith" <psmith@xxxxxxx> writes:

> Are there any such functions in GLIB or similar?  Do people know of
> similar functions in other OS's etc.?  If not, and I wanted to think
> about creating some, what kind of naming convention would be
> appropriate?  I thought of strp*() but I don't know.

I don't know of any such functions, though they sound like nice ones
to have.

I wouldn't use strp*, since that prefix is already used for strpbrk
and strptime, not to mention glibc strpcpy.  Nor strl*, since it's
used for OpenBSD strlcpy and strlcat
<http://en.wikipedia.org/wiki/Strlcpy>.  Nor stre*, since it's used
for Plan 9 strecpy
<http://plan9.bell-labs.com/sources/plan9/sys/src/libc/port/strecpy.c>.

In fact, come to think of it, I wouldn't use str* at all, since the
functions you're talking about work on arbitrary memory buffers
that can contain internal NULs.

How about "meme*", for "memory with end pointer"?  (I think the "e" in
Plan 9 "strecpy" also means "end pointer".)  E.g.,

char *memechr(const char *str, const char *endp, int c);

And while you're at it, why not fix the type of the last arg, since
you're not assuming K&R compatibility any more?

char *memechr(const char *str, const char *endp, char c);


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux