src/backend/utils/mmgr/mcxt.c
static void
MemoryContextStatsPrint(MemoryContext context, void *passthru,
						const char *stats_string,
						bool print_to_stderr)
{
	int			level = *(int *) passthru;
	const char *name = context->name;
	const char *ident = context->ident;
	char		truncated_ident[110];
	int			i;

	/*
	 * It seems preferable to label dynahash contexts with just the hash table
	 * name.  Those are already unique enough, so the "dynahash" part isn't
	 * very helpful, and this way is more consistent with pre-v11 practice.
	 */
	if (ident && strcmp(name, "dynahash") == 0)
	{
		name = ident;
		ident = NULL;
	}

	truncated_ident[0] = '\0';

	if (ident)
	{
		/*
		 * Some contexts may have very long identifiers (e.g., SQL queries).
		 * Arbitrarily truncate at 100 bytes, but be careful not to break
		 * multibyte characters.  Also, replace ASCII control characters, such
		 * as newlines, with spaces.
		 */
		int			idlen = strlen(ident);
		bool		truncated = false;

		strcpy(truncated_ident, ": ");
		i = strlen(truncated_ident);

		if (idlen > 100)
		{
			idlen = pg_mbcliplen(ident, idlen, 100);
			truncated = true;
		}

		while (idlen-- > 0)
		{
			unsigned char c = *ident++;

			if (c < ' ')
				c = ' ';
			truncated_ident[i++] = c;
		}
		truncated_ident[i] = '\0';

		if (truncated)
			strcat(truncated_ident, "...");
	}

	if (print_to_stderr)
	{
		for (i = 0; i < level; i++)
			fprintf(stderr, "  ");
		fprintf(stderr, "%s: %s%s\n", name, stats_string, truncated_ident);
	}
	else
		ereport(LOG_SERVER_ONLY,
				(errhidestmt(true),
				 errhidecontext(true),
				 errmsg_internal("level: %d; %s: %s%s",
								 level, name, stats_string, truncated_ident)));
}
/*
 * MemoryContextStatsPrint
 *		Print callback used by MemoryContextStatsInternal
 *
 * For now, the passthru pointer just points to "int level"; later we might
 * make that more complicated.
 */


For now, the passthru pointer just points to "int level"; later we might
make that more complicated.
For now the passthru pointer just points to " int level " ; later we might make that more complicated .
static void
MemoryContextStatsPrint(MemoryContext context, void *passthru,
						const char *stats_string,
						bool print_to_stderr)
{
	int			level = *(int *) passthru;
	const char *name = context->name;
	const char *ident = context->ident;
	char		truncated_ident[110];
	int			i;
	if (ident && strcmp(name, "dynahash") == 0)
	{
		name = ident;
		ident = NULL;
	}
	truncated_ident[0] = '\0';
	if (ident)
	{
		int			idlen = strlen(ident);
		bool		truncated = false;
		strcpy(truncated_ident, ": ");
		i = strlen(truncated_ident);
		if (idlen > 100)
		{
			idlen = pg_mbcliplen(ident, idlen, 100);
			truncated = true;
		}
		while (idlen-- > 0)
		{
			unsigned char c = *ident++;
			if (c < ' ')
				c = ' ';
			truncated_ident[i++] = c;
		}
		truncated_ident[i] = '\0';
		if (truncated)
			strcat(truncated_ident, "...");
	}
	if (print_to_stderr)
	{
		for (i = 0; i < level; i++)
			fprintf(stderr, "  ");
		fprintf(stderr, "%s: %s%s\n", name, stats_string, truncated_ident);
	}
	else
		ereport(LOG_SERVER_ONLY,
				(errhidestmt(true),
				 errhidecontext(true),
				 errmsg_internal("level: %d; %s: %s%s",
								 level, name, stats_string, truncated_ident)));
}
static void MemoryContextStatsPrint ( MemoryContext context , void * passthru , const char * stats_string , bool print_to_stderr ) { int level = * ( int * ) passthru ; const char * name = context -> name ; const char * ident = context -> ident ; char truncated_ident [ 110 ] ; int i ; if ( ident && strcmp ( name , " " ) == 0 ) { name = ident ; ident = NULL ; } truncated_ident [ 0 ] = ' \0 ' ; if ( ident ) { int idlen = strlen ( ident ) ; bool truncated = false ; strcpy ( truncated_ident , " " ) ; i = strlen ( truncated_ident ) ; if ( idlen > 100 ) { idlen = pg_mbcliplen ( ident , idlen , 100 ) ; truncated = true ; } while ( idlen -- > 0 ) { unsigned char c = * ident ++ ; if ( c < ' ' ) c = ' ' ; truncated_ident [ i ++ ] = c ; } truncated_ident [ i ] = ' \0 ' ; if ( truncated ) strcat ( truncated_ident , " " ) ; } if ( print_to_stderr ) { for ( i = 0 ; i < level ; i ++ ) fprintf ( stderr , " " ) ; fprintf ( stderr , " \n " , name , stats_string , truncated_ident ) ; } else ereport ( LOG_SERVER_ONLY , ( errhidestmt ( true ) , errhidecontext ( true ) , errmsg_internal ( " " , level , name , stats_string , truncated_ident ) ) ) ; }
MemoryContextStatsPrint
              Print callback used by MemoryContextStatsInternal
MemoryContextStatsPrint Print callback used by MemoryContextStatsInternal
/*
	 * It seems preferable to label dynahash contexts with just the hash table
	 * name.  Those are already unique enough, so the "dynahash" part isn't
	 * very helpful, and this way is more consistent with pre-v11 practice.
	 */ /*
		 * Some contexts may have very long identifiers (e.g., SQL queries).
		 * Arbitrarily truncate at 100 bytes, but be careful not to break
		 * multibyte characters.  Also, replace ASCII control characters, such
		 * as newlines, with spaces.
		 */