[PATCH 1/3] util: change type of struct xlat.val to uint64_t

Dmitry V. Levin ldv at altlinux.org
Fri Apr 1 02:30:27 UTC 2016


On Thu, Mar 31, 2016 at 12:34:16AM -0400, Jeff Mahoney wrote:
> -extern const char *xlookup(const struct xlat *, const unsigned int);
> -extern const char *xlat_search(const struct xlat *, const size_t, const unsigned int);
> +extern const char *xlookup(const struct xlat *, const uint64_t);
> +extern const char *xlat_search(const struct xlat *, const size_t, const uint64_t);

xlookup has several users that are not prepared for this change yet
so it also needs an xlookup64 variant.

xlat_search has only one user that passes unsigned int, so it's OK.

> -extern void printxvals(const unsigned int, const char *, const struct xlat *, ...);
> +extern void printxvals(const uint64_t, const char *, const struct xlat *, ...);

printxvals is OK, all its users are ready for the change...

>  #define printxval(xlat, val, dflt) printxvals(val, dflt, xlat, NULL)

... except the main user, printxval, which is not.
Looks like we need printxval and printxval64 wrappers.

> -extern void addflags(const struct xlat *, int);
> -extern int printflags(const struct xlat *, int, const char *);
> -extern const char *sprintflags(const char *, const struct xlat *, int);
> +extern void addflags(const struct xlat *, unsigned int);
> +extern void addflags64(const struct xlat *, uint64_t);
> +extern int printflags(const struct xlat *, unsigned int, const char *);
> +extern int printflags64(const struct xlat *, uint64_t, const char *);
> +extern const char *sprintflags(const char *, const struct xlat *, unsigned int);
> +extern const char *sprintflags64(const char *, const struct xlat *, uint64_t);

All users of addflags are ready for the change so addflags64 is not needed.

All these new wrappers could be implemented as static inline functions
right in defs.h so that compiler would do the right thing without extra
costs.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160401/5bde997d/attachment.bin>


More information about the Strace-devel mailing list