Skip to content

Commit

Permalink
xgettext: Replace PRItime macro in git.git with PRIuMAX
Browse files Browse the repository at this point in the history
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
  • Loading branch information
jiangxin committed Jul 21, 2017
1 parent c737bf8 commit b0a7264
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion gettext-tools/src/x-c.c
Expand Up @@ -1802,6 +1802,12 @@ phase6_unget (token_ty *tp)
static bool
is_inttypes_macro (const char *name)
{
/* PRItime is a maro for timestamp_t in git.git. */
if (!strncmp(name, "PRItime", 7))
{
return true;
}

/* Syntax:
P R I { d | i | o | u | x | X }
{ { | LEAST | FAST } { 8 | 16 | 32 | 64 } | MAX | PTR } */
Expand Down Expand Up @@ -1843,8 +1849,17 @@ phase8a_get (token_ty *tp)
phase6_get (tp);
if (tp->type == token_type_name && is_inttypes_macro (tp->string))
{
char *new_string;
/* Turn PRIdXXX into "<PRIdXXX>". */
char *new_string = xasprintf ("<%s>", tp->string);
if (!strncmp(tp->string, "PRItime", 7))
{
/* Replace PRItime with PRIuMAX for git.git project */
new_string = xasprintf ("<%s>", "PRIuMAX");
}
else
{
new_string = xasprintf ("<%s>", tp->string);
}
free (tp->string);
tp->string = new_string;
tp->comment = add_reference (savable_comment);
Expand Down
2 changes: 1 addition & 1 deletion gettext-tools/src/xgettext.c
Expand Up @@ -676,7 +676,7 @@ main (int argc, char *argv[])
/* Version information requested. */
if (do_version)
{
printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION);
printf ("%s (GNU %s) %s (PRItime to PRIuMAX for git.git)\n", basename (program_name), PACKAGE, VERSION);
/* xgettext: no-wrap */
printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
Expand Down

0 comments on commit b0a7264

Please sign in to comment.