Formatting cleanup.
authorHeikki Linnakangas <[email protected]>
Mon, 20 Apr 2015 11:28:19 +0000 (14:28 +0300)
committerHeikki Linnakangas <[email protected]>
Mon, 20 Apr 2015 12:59:33 +0000 (15:59 +0300)
src/backend/access/sequence/seqlocal.c
src/backend/commands/sequence.c

index 77edd6b9582390f485094e50f18ea84fd59809c5..0f8dc9bd9c5f9c6a4f2a3dc7a20fd5a38ce20a03 100644 (file)
@@ -46,9 +46,9 @@ typedef struct FormLocalSequence
 Datum
 seqam_local_reloptions(PG_FUNCTION_ARGS)
 {
-       Datum   reloptions = PG_GETARG_DATUM(0);
-       bool    validate = PG_GETARG_BOOL(1);
-       bytea  *result;
+       Datum           reloptions = PG_GETARG_DATUM(0);
+       bool            validate = PG_GETARG_BOOL(1);
+       bytea      *result;
 
        result = default_reloptions(reloptions, validate, RELOPT_KIND_SEQUENCE);
        if (result)
@@ -65,15 +65,15 @@ seqam_local_reloptions(PG_FUNCTION_ARGS)
 Datum
 seqam_local_init(PG_FUNCTION_ARGS)
 {
-       Oid             seqrelid = PG_GETARG_OID(0);
-       List   *seqoptions = (List *) PG_GETARG_POINTER(1);
-       Datum  *values = (Datum *) PG_GETARG_POINTER(3);
-       bool   *nulls = (bool *) PG_GETARG_POINTER(4);
-       bool    found_restart;
-       int64   start_value,
-                       last_value,
-                       min_value,
-                       max_value;
+       Oid                     seqrelid = PG_GETARG_OID(0);
+       List       *seqoptions = (List *) PG_GETARG_POINTER(1);
+       Datum      *values = (Datum *) PG_GETARG_POINTER(3);
+       bool       *nulls = (bool *) PG_GETARG_POINTER(4);
+       bool            found_restart;
+       int64           start_value,
+                               last_value,
+                               min_value,
+                               max_value;
        FormLocalSequence *localseq;
 
        /* Get the new value to use as starting point. */
@@ -133,7 +133,7 @@ Datum
 seqam_local_alloc(PG_FUNCTION_ARGS)
 {
        Relation        seqrel = (Relation) PG_GETARG_POINTER(0);
-       SequenceHandle *seqh = (SequenceHandle*) PG_GETARG_POINTER(1);
+       SequenceHandle *seqh = (SequenceHandle *) PG_GETARG_POINTER(1);
        int64       nrequested = PG_GETARG_INT64(2);
        int64      *last = (int64 *) PG_GETARG_POINTER(3);
        FormData_pg_sequence *seq;
@@ -202,7 +202,7 @@ seqam_local_alloc(PG_FUNCTION_ARGS)
        /* Fetch as many values as was requested by backend. */
        if (rescnt < nrequested)
                rescnt += sequence_increment(seqrel, &next, nrequested-rescnt, minv,
-                                                                       maxv, incby, is_cycled, false);
+                                                                        maxv, incby, is_cycled, false);
 
        /* Last value available for calling backend. */
        *last = next;
@@ -251,9 +251,9 @@ seqam_local_alloc(PG_FUNCTION_ARGS)
 Datum
 seqam_local_setval(PG_FUNCTION_ARGS)
 {
-       SequenceHandle     *seqh = (SequenceHandle*) PG_GETARG_POINTER(1);
-       int64                           next = PG_GETARG_INT64(2);
-       FormData_pg_sequence  *seq;
+       SequenceHandle *seqh = (SequenceHandle *) PG_GETARG_POINTER(1);
+       int64           next = PG_GETARG_INT64(2);
+       FormData_pg_sequence *seq;
        FormLocalSequence *localseq;
 
        seq = (FormData_pg_sequence *) GETSTRUCT(sequence_read_tuple(seqh));
@@ -276,12 +276,12 @@ seqam_local_setval(PG_FUNCTION_ARGS)
 Datum
 seqam_local_get_state(PG_FUNCTION_ARGS)
 {
-       SequenceHandle     *seqh = (SequenceHandle *) PG_GETARG_POINTER(1);
-       char                     ***out_keys = (char ***) PG_GETARG_POINTER(2);
-       char                     ***out_values = (char ***) PG_GETARG_POINTER(3);
-       char                      **keys;
-       char                      **values;
-       FormData_pg_sequence  *seq;
+       SequenceHandle *seqh = (SequenceHandle *) PG_GETARG_POINTER(1);
+       char     ***out_keys = (char ***) PG_GETARG_POINTER(2);
+       char     ***out_values = (char ***) PG_GETARG_POINTER(3);
+       char      **keys;
+       char      **values;
+       FormData_pg_sequence *seq;
 
        seq = (FormData_pg_sequence *) GETSTRUCT(sequence_read_tuple(seqh));
 
@@ -305,17 +305,17 @@ seqam_local_get_state(PG_FUNCTION_ARGS)
 /*
  * seqam_local_set_state()
  *
- * Restore previously dumpred state of local sequence (used by pg_dump)
+ * Restore previously dumped state of local sequence (used by pg_dump)
 */
 Datum
 seqam_local_set_state(PG_FUNCTION_ARGS)
 {
-       SequenceHandle     *seqh = (SequenceHandle*) PG_GETARG_POINTER(1);
-       char                      **keys = (char **) PG_GETARG_POINTER(2);
-       char                      **values = (char **) PG_GETARG_POINTER(3);
-       int                                     count = PG_GETARG_INT32(4);
-       FormData_pg_sequence  *seq;
-       int                                     i;
+       SequenceHandle *seqh = (SequenceHandle *) PG_GETARG_POINTER(1);
+       char      **keys = (char **) PG_GETARG_POINTER(2);
+       char      **values = (char **) PG_GETARG_POINTER(3);
+       int                     count = PG_GETARG_INT32(4);
+       FormData_pg_sequence *seq;
+       int                     i;
 
        seq = (FormData_pg_sequence *) GETSTRUCT(sequence_read_tuple(seqh));
 
index bb05bb32732f1f1cbb04a6a7541c9e28c079b462..64ffd5478a1c2f7001de4a1c1b4591c7c8536799 100644 (file)
@@ -781,7 +781,7 @@ setval3_oid(PG_FUNCTION_ARGS)
        Oid                     relid = PG_GETARG_OID(0);
        int64           next = PG_GETARG_INT64(1);
        bool            iscalled = PG_GETARG_BOOL(2);
-       char       *keys[2] = {"last_value", "is_called"};
+       char       *keys[2];
        char       *values[2];
        SeqTable        elm;
        Relation        seqrel;
@@ -810,8 +810,10 @@ setval3_oid(PG_FUNCTION_ARGS)
                                 errmsg("the setval(oid, bigint, bool) function can only be called for \"local\" sequences")));
 
        /* Convert the data into 'local' sequence dump format and call restore API. */
+       keys[0] = "last_value";
        values[0] = DatumGetCString(DirectFunctionCall1(int8out,
                                                                                                        Int64GetDatum(next)));
+       keys[1] = "is_called";
        values[1] = DatumGetCString(DirectFunctionCall1(boolout,
                                                                                                        BoolGetDatum(iscalled)));
        seqam_set_state(seqh.rel, &seqh, keys, values, 2);
@@ -977,9 +979,7 @@ sequence_read_tuple(SequenceHandle *seqh)
        Form_pg_sequence seq_form;
 
        if (seqh->tup.t_data != NULL)
-       {
                return &seqh->tup;
-       }
 
        seqh->buf = buf = ReadBuffer(seqh->rel, 0);
        LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
@@ -1353,7 +1353,7 @@ init_params(List *params, bool isInit,
 }
 
 /*
- * Process an OWNED BY param for CREATE/ALTER SEQUENCE
+ * Process an OWNED BY option for CREATE/ALTER SEQUENCE
  *
  * Ownership permissions on the sequence are already checked,
  * but if we are establishing a new owned-by dependency, we must
@@ -1369,7 +1369,8 @@ process_owned_by(Relation seqrel, List *owned_by)
 
        nnames = list_length(owned_by);
        Assert(nnames > 0);
-       if (nnames == 1)        {
+       if (nnames == 1)
+       {
                /* Must be OWNED BY NONE */
                if (strcmp(strVal(linitial(owned_by)), "none") != 0)
                        ereport(ERROR,
@@ -1721,7 +1722,6 @@ seq_redo(XLogReaderState *record)
        pfree(localpage);
 }
 
-
 /*
  * Flush cached sequence information.
  */
@@ -1744,8 +1744,8 @@ int64
 sequence_increment(Relation seqrel, int64 *value, int64 incnum, int64 minv,
                                   int64 maxv, int64 incby, bool is_cycled, bool report_errors)
 {
-       int64 next = *value;
-       int64 rescnt = 0;
+       int64           next = *value;
+       int64           rescnt = 0;
 
        while (incnum)
        {
@@ -1760,8 +1760,8 @@ sequence_increment(Relation seqrel, int64 *value, int64 incnum, int64 minv,
                                (maxv < 0 && next + incby > maxv))
                        {
                                /*
-                                * We were asked to not report errors, return without incrementing
-                                * and let the caller handle it.
+                                * We were asked to not report errors, return without
+                                * incrementing and let the caller handle it.
                                 */
                                if (!report_errors)
                                        return rescnt;