Skip to content

Commit d84a69d

Browse files
committed
Removed trailing whitespace from scheduler code
1 parent 8c885c6 commit d84a69d

File tree

7 files changed

+121
-121
lines changed

7 files changed

+121
-121
lines changed

contrib/pgpro_scheduler/src/cron_string.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ char *_cps_append_string(char *str, char *to_add)
4949
{
5050
int end = str ? strlen(str): 0;
5151
int len = strlen(to_add);
52-
52+
5353
str = realloc(str, end + len + 1);
5454
memcpy(str+end, to_add, len);
5555
str[end+len] = 0;
@@ -66,7 +66,7 @@ char *_cps_make_array(int *src, int len)
6666
out = _cps_append_string(out, "[");
6767
for(i=0; i<len; i++)
6868
{
69-
sprintf(buff, "%d,", src[i]);
69+
sprintf(buff, "%d,", src[i]);
7070
if(len == (i+1)) buff[strlen(buff)-1] = 0;
7171
out = _cps_append_string(out, buff);
7272
}
@@ -78,7 +78,7 @@ int _cps_dig_digit(char *str)
7878
int len = strlen(str);
7979
char *endptr = NULL;
8080
int res;
81-
81+
8282
if(len == 1 && str[0] == '*')
8383
{
8484
return -1;
@@ -110,14 +110,14 @@ char **_cps_split_by(char sep, char *src, int *N)
110110
char **res = NULL;
111111
int i, n = 1, ri = 0, ti = 0;
112112
char tmp[1024];
113-
113+
114114
for(i=0; i<len; i++)
115115
{
116116
if(src[i] == sep) n++;
117117
}
118118
res = malloc(sizeof(char *)*n);
119119
*N = n;
120-
120+
121121
for(i=0; i < len; i++)
122122
{
123123
if(src[i] == sep)
@@ -205,7 +205,7 @@ int *_cps_parse_range(char *src, int start, int end, int *len)
205205
}
206206
for(i = 0; i < range_len; i++)
207207
{
208-
if(i >= (a-start) && i <= (b-start)) values[i] = 1;
208+
if(i >= (a-start) && i <= (b-start)) values[i] = 1;
209209
}
210210
_cps_clean_charchar(elements, e_len);
211211
}
@@ -272,16 +272,16 @@ int *_cps_parse_range(char *src, int start, int end, int *len)
272272
}
273273
values[a-start] = 1;
274274
}
275-
}
275+
}
276276
}
277-
277+
278278
if(isError == 0)
279279
{
280280
for(i =0; i < range_len; i++)
281281
{
282282
if(values[i]) (*len)++;
283283
}
284-
284+
285285
if(*len > 0)
286286
{
287287
ptr = malloc(sizeof(int)*(*len));
@@ -290,7 +290,7 @@ int *_cps_parse_range(char *src, int start, int end, int *len)
290290
{
291291
ptr = NULL;
292292
}
293-
293+
294294
for(i = 0; i < range_len; i++)
295295
{
296296
if(values[i]) ptr[ni++] = i+start;
@@ -450,11 +450,11 @@ cron_ent_t *parse_crontab(char *cron_str)
450450
int N = strlen(cron_str);
451451
char tmp[256];
452452
int i, ti =0, en = 0 ;
453-
453+
454454
if(N == 7 && strcmp(cron_str, "@reboot") == 0)
455455
{
456456
CE = (cron_ent_t *)malloc(sizeof(cron_ent_t));
457-
memset((void *)CE, 0, sizeof(cron_ent_t));
457+
memset((void *)CE, 0, sizeof(cron_ent_t));
458458
CE->onstart = 1;
459459

460460
return CE;
@@ -492,11 +492,11 @@ cron_ent_t *parse_crontab(char *cron_str)
492492
}
493493

494494
CE = (cron_ent_t *)malloc(sizeof(cron_ent_t));
495-
memset((void *)CE, 0, sizeof(cron_ent_t));
495+
memset((void *)CE, 0, sizeof(cron_ent_t));
496496

497497

498498
entrs[3] = _cps_subst_str(entrs[3], cps_month_subst_data, 12, 1);
499-
entrs[4] = _cps_subst_str(entrs[4], cps_wday_subst_data, 7, 0);
499+
entrs[4] = _cps_subst_str(entrs[4], cps_wday_subst_data, 7, 0);
500500

501501
CE->mins = _cps_parse_range(entrs[0], 0, 59, &(CE->mins_len));
502502
if(CE->mins) CE->hour = _cps_parse_range(entrs[1], 0, 23, &(CE->hour_len));

contrib/pgpro_scheduler/src/pgpro_scheduler.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ char *make_date_from_timestamp(TimestampTz ts, bool hires)
119119
fsec_t fsec;
120120
const char *tzn;
121121

122-
timestamp2tm(ts, &tz, &dt, &fsec, &tzn, NULL );
122+
timestamp2tm(ts, &tz, &dt, &fsec, &tzn, NULL );
123123
sprintf(str, "%04d-%02d-%02d %02d:%02d:%02d", dt.tm_year , dt.tm_mon,
124124
dt.tm_mday, dt.tm_hour, dt.tm_min, dt.tm_sec);
125125
if(!hires) str[16] = 0;
@@ -178,7 +178,7 @@ char *set_schema(const char *name, bool get_old)
178178
}
179179
else
180180
{
181-
schema_name = _copy_string((char *)GetConfigOption("schedule.schema", true, false));
181+
schema_name = _copy_string((char *)GetConfigOption("schedule.schema", true, false));
182182
free_name = true;
183183
}
184184
SetConfigOption("search_path", schema_name, PGC_USERSET, PGC_S_SESSION);
@@ -264,7 +264,7 @@ char_array_t *readBasesToCheck(void)
264264
{
265265
appendStringInfo(&sql, "'%s'", names->data[i]);
266266
if(i + 1 != names->n) appendStringInfo(&sql, ",");
267-
}
267+
}
268268
destroyCharArray(names);
269269
appendStringInfo(&sql, ")");
270270

@@ -304,7 +304,7 @@ void parent_scheduler_main(Datum arg)
304304
CurrentResourceOwner = ResourceOwnerCreate(NULL, "pgpro_scheduler");
305305

306306
init_worker_mem_ctx("Parent scheduler context");
307-
elog(LOG, "Start PostgresPro scheduler.");
307+
elog(LOG, "Start PostgresPro scheduler.");
308308

309309
SetConfigOption("application_name", "pgp-s supervisor", PGC_USERSET, PGC_S_SESSION);
310310
pgstat_report_activity(STATE_RUNNING, "Initialize");
@@ -358,7 +358,7 @@ void parent_scheduler_main(Datum arg)
358358
destroyCharArray(names);
359359
}
360360
}
361-
else
361+
else
362362
{
363363
for(i=0; i < pool->n; i++)
364364
{
@@ -417,7 +417,7 @@ pg_scheduler_startup(void)
417417
memcpy(worker.bgw_library_name, "pgpro_scheduler", 16);
418418
memcpy(worker.bgw_name, "pgpro scheduler", 16);
419419

420-
RegisterBackgroundWorker(&worker);
420+
RegisterBackgroundWorker(&worker);
421421
}
422422

423423
void _PG_init(void)
@@ -468,7 +468,7 @@ void _PG_init(void)
468468
"schedule.transaction_state",
469469
"State of scheduler executor transaction",
470470
"If not under scheduler executor process the variable has no mean and has a value = 'undefined', possible values: progress, success, failure",
471-
&scheduler_transaction_state ,
471+
&scheduler_transaction_state ,
472472
"undefined",
473473
PGC_INTERNAL,
474474
0,
@@ -542,14 +542,14 @@ cron_string_to_json_text(PG_FUNCTION_ARGS)
542542
text *text_p;
543543
int len;
544544
char *error = NULL;
545-
545+
546546
if(PG_ARGISNULL(0))
547-
{
547+
{
548548
PG_RETURN_NULL();
549549
}
550550
source = PG_GETARG_CSTRING(0);
551551
jsonText = parse_crontab_to_json_text(source);
552-
552+
553553
if(jsonText)
554554
{
555555
len = strlen(jsonText);

contrib/pgpro_scheduler/src/sched_manager_poll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ pid_t registerManagerWorker(schd_manager_t *man)
238238

239239
void _sortPollManagers(schd_managers_poll_t *poll)
240240
{
241-
if(poll->n > 1)
241+
if(poll->n > 1)
242242
qsort(poll->workers, poll->n, sizeof(schd_manager_t *), __cmp_managers);
243243
}
244244

contrib/pgpro_scheduler/src/scheduler_executor.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ int do_one_job(schd_executor_share_t *shared, schd_executor_status_t *status)
182182
if(!job)
183183
{
184184
if(shared->message[0] == 0)
185-
snprintf(shared->message, PGPRO_SCHEDULER_EXECUTOR_MESSAGE_MAX,
185+
snprintf(shared->message, PGPRO_SCHEDULER_EXECUTOR_MESSAGE_MAX,
186186
"Cannot retrive job information");
187187
shared->worker_exit = true;
188188
*status = shared->status = SchdExecutorError;
@@ -324,7 +324,7 @@ int do_one_job(schd_executor_share_t *shared, schd_executor_status_t *status)
324324

325325
return 1;
326326
}
327-
327+
328328

329329
int set_session_authorization(char *username, char **error)
330330
{
@@ -337,7 +337,7 @@ int set_session_authorization(char *username, char **error)
337337
char *sql = "select oid, rolsuper from pg_catalog.pg_roles where rolname = $1";
338338
char buff[1024];
339339

340-
values[0] = CStringGetTextDatum(username);
340+
values[0] = CStringGetTextDatum(username);
341341
START_SPI_SNAP();
342342
r = execute_spi_sql_with_args(sql, 1, types, values, NULL);
343343

@@ -431,7 +431,7 @@ TimestampTz get_next_excution_time(char *sql, executor_error_t *ee)
431431
return 0;
432432
}
433433
if(r->n_rows == 0)
434-
{
434+
{
435435
push_executor_error(ee, "next time statement returns 0 rows");
436436
}
437437
else if(r->types[0] != TIMESTAMPTZOID)
@@ -581,33 +581,33 @@ int push_executor_error(executor_error_t *e, char *fmt, ...)
581581
}
582582

583583
PG_FUNCTION_INFO_V1(get_self_id);
584-
Datum
584+
Datum
585585
get_self_id(PG_FUNCTION_ARGS)
586586
{
587587
if(current_job_id == -1)
588588
{
589-
elog(ERROR, "There is no active job in progress");
589+
elog(ERROR, "There is no active job in progress");
590590
}
591591
PG_RETURN_INT64(current_job_id);
592592
}
593593

594594
PG_FUNCTION_INFO_V1(resubmit);
595-
Datum
595+
Datum
596596
resubmit(PG_FUNCTION_ARGS)
597597
{
598-
Interval *interval;
598+
Interval *interval;
599599

600600
if(current_job_id == -1)
601601
{
602-
elog(ERROR, "There is no active job in progress");
602+
elog(ERROR, "There is no active job in progress");
603603
}
604604
if(PG_ARGISNULL(0))
605605
{
606-
resubmit_current_job = 1;
606+
resubmit_current_job = 1;
607607
PG_RETURN_INT64(1);
608608
}
609609
interval = PG_GETARG_INTERVAL_P(0);
610-
#ifdef HAVE_INT64_TIMESTAMP
610+
#ifdef HAVE_INT64_TIMESTAMP
611611
resubmit_current_job = interval->time / 1000000.0;
612612
#else
613613
resubmit_current_job = interval->time;
@@ -662,7 +662,7 @@ void at_executor_worker_main(Datum arg)
662662

663663
while(1)
664664
{
665-
if(shared->stop_worker) break;
665+
if(shared->stop_worker) break;
666666
if(got_sighup)
667667
{
668668
got_sighup = false;
@@ -671,7 +671,7 @@ void at_executor_worker_main(Datum arg)
671671
CHECK_FOR_INTERRUPTS();
672672
result = process_one_job(shared, &status);
673673

674-
if(result == 0)
674+
if(result == 0)
675675
{
676676
lets_sleep = true;
677677
}
@@ -812,7 +812,7 @@ int process_one_job(schd_executor_share_state_t *shared, schd_executor_status_t
812812
set_ret = set_at_job_done(job, NULL, resubmit_current_job, &set_error);
813813
}
814814
destroy_spi_data(r);
815-
815+
816816
resubmit_current_job = 0;
817817
current_job_id = -1;
818818
pgstat_report_activity(STATE_RUNNING, "finish job processing");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy