Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitefdc7d7

Browse files
Add INT64_HEX_FORMAT and UINT64_HEX_FORMAT to c.h.
Like INT64_FORMAT and UINT64_FORMAT, these macros produce formatstrings for 64-bit integers. However, INT64_HEX_FORMAT andUINT64_HEX_FORMAT generate the output in hexadecimal instead ofdecimal. Besides introducing these macros, this commit makes useof them in several places. This was originally intended to be partof commit5d6187d, but I left it out because I felt there was anonzero chance that back-patching these new macros into c.h couldcause problems with third-party code. We tend to be less cautiouswith such changes in new major versions.Note that UINT64_HEX_FORMAT was originally added in commitee1b30f, but it was placed in test_radixtree.c, so it wasn'twidely available. This commit moves UINT64_HEX_FORMAT to c.h.Discussion:https://postgr.es/m/ZwQvtUbPKaaRQezd%40nathan
1 parent8589876 commitefdc7d7

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

‎contrib/postgres_fdw/option.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ process_pgfdw_appname(const char *appname)
521521
appendStringInfoString(&buf,application_name);
522522
break;
523523
case'c':
524-
appendStringInfo(&buf,"%"INT64_MODIFIER"x.%x",MyStartTime,MyProcPid);
524+
appendStringInfo(&buf,INT64_HEX_FORMAT".%x",MyStartTime,MyProcPid);
525525
break;
526526
case'C':
527527
appendStringInfoString(&buf,cluster_name);

‎src/backend/utils/error/csvlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ write_csvlog(ErrorData *edata)
120120
appendStringInfoChar(&buf,',');
121121

122122
/* session id */
123-
appendStringInfo(&buf,"%"INT64_MODIFIER"x.%x",MyStartTime,MyProcPid);
123+
appendStringInfo(&buf,INT64_HEX_FORMAT".%x",MyStartTime,MyProcPid);
124124
appendStringInfoChar(&buf,',');
125125

126126
/* Line number */

‎src/backend/utils/error/elog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2947,12 +2947,12 @@ log_status_format(StringInfo buf, const char *format, ErrorData *edata)
29472947
{
29482948
charstrfbuf[128];
29492949

2950-
snprintf(strfbuf,sizeof(strfbuf)-1,"%"INT64_MODIFIER"x.%x",
2950+
snprintf(strfbuf,sizeof(strfbuf)-1,INT64_HEX_FORMAT".%x",
29512951
MyStartTime,MyProcPid);
29522952
appendStringInfo(buf,"%*s",padding,strfbuf);
29532953
}
29542954
else
2955-
appendStringInfo(buf,"%"INT64_MODIFIER"x.%x",MyStartTime,MyProcPid);
2955+
appendStringInfo(buf,INT64_HEX_FORMAT".%x",MyStartTime,MyProcPid);
29562956
break;
29572957
case'p':
29582958
if (padding!=0)

‎src/backend/utils/error/jsonlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ write_jsonlog(ErrorData *edata)
168168
}
169169

170170
/* Session id */
171-
appendJSONKeyValueFmt(&buf,"session_id", true,"%"INT64_MODIFIER"x.%x",
171+
appendJSONKeyValueFmt(&buf,"session_id", true,INT64_HEX_FORMAT".%x",
172172
MyStartTime,MyProcPid);
173173

174174
/* Line number */

‎src/include/c.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,8 @@ typedef unsigned long long int uint64;
550550
/* snprintf format strings to use for 64-bit integers */
551551
#defineINT64_FORMAT "%" INT64_MODIFIER "d"
552552
#defineUINT64_FORMAT "%" INT64_MODIFIER "u"
553+
#defineINT64_HEX_FORMAT "%" INT64_MODIFIER "x"
554+
#defineUINT64_HEX_FORMAT "%" INT64_MODIFIER "x"
553555

554556
/*
555557
* 128-bit signed and unsigned integers

‎src/test/modules/test_radixtree/test_radixtree.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
/* uncomment to use shared memory for the tree */
2222
/* #define TEST_SHARED_RT */
2323

24-
#defineUINT64_HEX_FORMAT "%" INT64_MODIFIER "X"
25-
2624
/* Convenient macros to test results */
2725
#defineEXPECT_TRUE(expr)\
2826
do { \

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp