Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions contrib/interconnect/udp/ic_udpifc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1381,8 +1381,6 @@ addCursorIcEntry(CursorICHistoryTable *t, uint32 icId, uint32 cid)
t->count++;

elog(DEBUG2, "add icid %d cid %d status %d", p->icId, p->cid, p->status);

return;
}

/*
Expand Down Expand Up @@ -1770,7 +1768,6 @@ setupUDPListeningSocket(int *listenerSocketFd, int32 *listenerPort, int *txFamil
(errcode(ERRCODE_GP_INTERCONNECTION_ERROR),
errmsg("interconnect error: Could not set up udp listener socket"),
errdetail("%s: %m", fun)));
return;
}

/*
Expand Down Expand Up @@ -1806,8 +1803,6 @@ ic_set_pthread_sigmasks(sigset_t *old_sigs)
#else
(void) old_sigs;
#endif

return;
}

static void
Expand All @@ -1822,8 +1817,6 @@ ic_reset_pthread_sigmasks(sigset_t *sigs)
#else
(void) sigs;
#endif

return;
}

void
Expand Down Expand Up @@ -1945,7 +1938,6 @@ InitMotionUDPIFC(int *listenerSocketFd, int32 *listenerPort)
}

ic_control_info.threadCreated = true;
return;
}

void
Expand Down Expand Up @@ -2175,8 +2167,6 @@ connDelHash(ConnHashTable *ht, MotionConn *mConn)
free(trash);

ic_statistics.activeConnectionsNum--;

return;
}

/*
Expand Down Expand Up @@ -4878,8 +4868,6 @@ markUDPConnInactiveIFC(MotionConn *conn)
pthread_mutex_lock(&ic_control_info.lock);
conn->stillActive = false;
pthread_mutex_unlock(&ic_control_info.lock);

return;
}

void
Expand Down Expand Up @@ -4918,8 +4906,6 @@ DeregisterReadInterestUDP(ChunkTransportState *transportStates,
elog(LOG, "deregisterReadInterest set stillactive = false for node %d route %d (%s)", motNodeID, srcRoute, reason);
#endif
markUDPConnInactiveIFC(conn);

return;
}


Expand Down Expand Up @@ -5509,8 +5495,6 @@ sendOnce(ChunkTransportState *transportStates, ChunkTransportStateEntry *pChunkE
logPkt("PKT DETAILS ", buf->pkt);
#endif
}

return;
}


Expand Down Expand Up @@ -8208,7 +8192,6 @@ SendDummyPacket(void)
pg_freeaddrinfo_all(hint.ai_family, addrs);
if (sockfd != -1)
closesocket(sockfd);
return;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any gcc warning ? I think no need if no warning.

@MutableFire MutableFire Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there were no gcc warnings.
My main motivation, as described in the PR, is simply code clarity. I believe we should avoid unnecessary lines that don't add logic, as they make the code harder to read.
While I agree we should minimize diffs from upstream for standard PostgreSQL code, this is our own custom code. Therefore, I think it's perfectly fine to refine its style and clean it up.
Could you clarify your concern? Is there a specific reason you prefer keeping these return statements?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's generally recommended to keep the final return; when a function already contains multiple early return; statements. This keeps the control flow consistent and makes the code easier to read.

static void
foo(...)
{
    if (a == NULL)
        return;

    if (b == NULL)
        return;

    ...

    return;
}

}

void logChunkParseDetails(MotionConn *conn, uint32 ic_instance_id)
Expand Down
Loading