/* Just like strncpy but shift-case in transit and forces null termination */
char *
-lcstring(char *d, char *s, int n)
+lcstring(char *d, const char *s, int n)
{
char *original_d = d;
char c;
}
char *
-ucstring(char *d, char *s, int n)
+ucstring(char *d, const char *s, int n)
{
char *original_d = d;
char c;
* buf: storage for the composed string. Any data in it will be lost.
* len: length of the buffer.
* ...: variable number of string arguments. The last argument must be
- * NULL.
+ * (char *)NULL.
* Returns buf or NULL if the buffer was not sufficiently large.
*/
char *
/* macros */
+/* should use offsetof() if available */
#define opr_containerof(ptr, structure, member) \
((structure *)((char *)(ptr)-(char *)(&((structure *)NULL)->member)))
#define ucstring opr_ucstring
#define stolower opr_stolower
#define stoupper opr_stoupper
+/* XXX str* is in the implementation namespace when <string.h> is included */
#define strcompose opr_strcompose
-extern char *opr_lcstring(char *d, char *s, int n);
-extern char *opr_ucstring(char *d, char *s, int n);
-extern void opr_stolower(char *s);
-extern void opr_stoupper(char *s);
-extern char *opr_strcompose(char *buf, size_t len, ...);
+extern char *opr_lcstring(char *d, const char *s, int n) AFS_NONNULL((1,2));
+extern char *opr_ucstring(char *d, const char *s, int n) AFS_NONNULL((1,2));
+extern void opr_stolower(char *s) AFS_NONNULL();
+extern void opr_stoupper(char *s) AFS_NONNULL();
+extern char *opr_strcompose(char *buf, size_t len, ...) AFS_NONNULL((1));
#endif