On 4/23/09, Andreas Robinson <[email protected]> wrote:
> Signed-off-by: Andreas Robinson <[email protected]>
> ---
>  util.h |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/util.h b/util.h
> index c73ad21..6329344 100644
> --- a/util.h
> +++ b/util.h
> @@ -10,6 +10,11 @@ char *underscores(char *string);
>
>  const char *next_string(const char *string, unsigned long *secsize);
>
> +static inline char *my_basename(const char *path)
> +{
> +     return (char *) ((strrchr((path), '/') ?: (path) - 1) + 1);
> +}
> +
>  /*
>   * Change endianness of x if conv is true.
>   */
> @@ -40,6 +45,5 @@ void *get_section64(void *file, unsigned long filesize,
>
>  #define streq(a,b) (strcmp((a),(b)) == 0)
>  #define strstarts(a,start) (strncmp((a),(start), strlen(start)) == 0)
> -#define my_basename(path) ((strrchr((path), '/') ?: (path) - 1) + 1)

Sorry, I didn't explain myself very well.  When I objected to the
macro, what I really disliked was the way it was compressed into one
line.  I think the original 3-line my_basename() function was much
clearer.

Regards
Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to