Current-Users archive

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

change signature of shquotev(3) ?



Currently, shquotev() is declared as ...

 size_t shquotev(int argc, char * const *argv, char *buf, size_t bufsize);

(that's from the man mage).

That makes it impossible to (easily) do

	const char **argv[N];

which is needed (to avoid gcc bitching) if one needs to do

	argv[1] = "string";

All that shquotev() does with the argv array, is pass it, entry
by entry, to shquote() which is declared as ...

     size_t shquote(const char *arg, char *buf, size_t bufsize);

So, I'd like to change the signature of shquotev() to be ,,

 size_t shquotev(int argc, const char*const*argv, char *buf, size_t bufsize);

(the dropped spaces are just to keep the line fitting in 80 col wide e-mail
without wrapping, that is not part of the requested change.)

In case it is not obvious, the change is one added "const".

As best I can tell shquotev() is not used anywhere in tree (shquote() looks
to be used only in pkg_install, makemandb, and shquotev(), and neither of
these functions seems to exist on linux, so it isn't likely that external
software are big users of it (and in any case, adding a "const" as suggested
should not require any changes anywhere else - a non-const param can always
be given where a const arg is expected, it is the other way that doesn't work).

All that would change is the declaration of the function, nothing needs
to alter in its implementation, mixing a .o compiled with the old
prototype with one compiled with the (proposed) changed one will work
just fine - I doubt that even a minor bump in the libc shlib version is
needed for this change, if we make it.

Does anyone have any objections, or know of any reasons why this
change shouldn't happen?

kre



Home | Main Index | Thread Index | Old Index