From 8451da6ac77e602dd042051d6afc3fe944fefb2c Mon Sep 17 00:00:00 2001 From: Jonathan Kamens Date: Fri, 29 Sep 2023 14:24:04 -0400 Subject: [PATCH] Comment out small block of code that doesn't do anything There's a small block of code that calls strnlen on a string, saves the esult in a variable, conditionally decrements the variable, and then does nothing with it, making the entire block of code a no-op. I don't want to just remove it entirely since it's possible that there was intended to be some sort of check here that was inadvertently omitted. So to make the compiler stop complaining I've commented out the code, but I've left a comment above it explaining why it was commented out and pointing out that maybe something different needs to be done with it. --- src/link.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/link.c b/src/link.c index 194f453..2a72d4e 100644 --- a/src/link.c +++ b/src/link.c @@ -406,10 +406,20 @@ static void HTML_to_LinkTable(const char *url, GumboNode *node, * This is to prevent duplicated link, if an Apache server has the * IconsAreLinks option. */ + /* The following four lines of code have no effect so I've commented + them out. I'm not removing them entirely because it's possible the + original intent was to do a check of some sort here and it's an + error that this check wasn't fully implemented, in which case this + commented out code and the comment above it should serve as a + reminder to whoever originally wrote it that there's something + unfinished here that needs to be finished. + */ + /* size_t comp_len = strnlen(link_url, MAX_FILENAME_LEN); if (type == LINK_DIR) { comp_len--; } + */ if (((type == LINK_DIR) || (type == LINK_UNINITIALISED_FILE)) && !linknames_equal(linktbl->links[linktbl->num - 1]->linkname, link_url)) {