From 596954622c9456db2965b7f735c7a1d0f4b440b7 Mon Sep 17 00:00:00 2001 From: Gokhan Gulbiz Date: Mon, 13 Mar 2023 14:31:41 +0300 Subject: [PATCH] Indent --- src/backend/distributed/utils/attribute.c | 43 ++++++++++++----------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/backend/distributed/utils/attribute.c b/src/backend/distributed/utils/attribute.c index 75f5abf02..e9b9f3624 100644 --- a/src/backend/distributed/utils/attribute.c +++ b/src/backend/distributed/utils/attribute.c @@ -61,7 +61,7 @@ static int CreateTenantStats(MultiTenantMonitor *monitor); static int FindTenantStats(MultiTenantMonitor *monitor); static size_t MultiTenantMonitorshmemSize(void); static char * extractTopComment(const char *inputString); -static char* get_substring(const char* str, int start, int end); +static char * get_substring(const char *str, int start, int end); int MultiTenantMonitoringLogLevel = CITUS_LOG_LEVEL_OFF; int CitusStatsTenantsPeriod = (time_t) 60; @@ -178,9 +178,9 @@ AttributeQueryIfAnnotated(const char *query_string, CmdType commandType) if (MultiTenantMonitoringLogLevel != CITUS_LOG_LEVEL_OFF) { ereport(NOTICE, (errmsg( - "attributing query to tenant: %s, colocationGroupId: %d", - quote_literal_cstr(attributeToTenant), - colocationGroupId))); + "attributing query to tenant: %s, colocationGroupId: %d", + quote_literal_cstr(attributeToTenant), + colocationGroupId))); } } } @@ -584,12 +584,13 @@ static char * extractTopComment(const char *inputString) { int commentStartCharsLength = 2; - if (strlen(inputString) < commentStartCharsLength ) + if (strlen(inputString) < commentStartCharsLength) { return NULL; } int i = 0; + /* If query starts with a comment */ if (inputString[i] == '/' && inputString[i + 1] == '*') { @@ -611,24 +612,26 @@ extractTopComment(const char *inputString) } } -static char* -get_substring(const char* str, int start, int end) { - int len = strlen(str); - char* substr = NULL; - // Ensure start and end are within the bounds of the string - if (start < 0 || end > len || start > end) { - return NULL; - } +static char * +get_substring(const char *str, int start, int end) +{ + int len = strlen(str); - // Allocate memory for the substring - substr = (char*) palloc((end - start + 1) * sizeof(char)); + /* Ensure start and end are within the bounds of the string */ + if (start < 0 || end > len || start > end) + { + return NULL; + } - // Copy the substring to the new memory location - strncpy_s(substr, end - start + 1, str + start, end - start); + /* Allocate memory for the substring */ + char *substr = (char *) palloc((end - start + 1) * sizeof(char)); - // Add null terminator to end the substring - substr[end - start] = '\0'; + /* Copy the substring to the new memory location */ + strncpy_s(substr, end - start + 1, str + start, end - start); - return substr; + /* Add null terminator to end the substring */ + substr[end - start] = '\0'; + + return substr; }