Skip to content

Conversation

@lecaros
Copy link
Contributor

@lecaros lecaros commented Oct 5, 2023

  • Remove redundant initializations in

    /* Reset variables for found log_key and correct type */
    found = FLB_FALSE;
    check = FLB_FALSE;

    The variables are already initialized with these values, and there's no code that could change them until this point.

  • Remove unnecessary if

if (found == FLB_FALSE) {
log_key_missing++;
}

At this point, found will always be FLB_FALSE (hence, the expression will always be true).
It's only changed in one line, and that block ends with a break hence never reaching the removed if statement

  • Following the reasoning above, the found variable is not needed.
    If the record is found, a break is issued. If it's not, then it must always log_key_missing++.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

These initializations are redundant. The variables are already initialized with these values and there's no code that could change them until this point.

Signed-off-by: lecaros <lecaros@calyptia.com>
To this point, found will always be FLB_FALSE (hence the expression will always be true).
It's only changed in one line, and that block ends with a break, hence never reaching the removed if statement.

Signed-off-by: lecaros <lecaros@calyptia.com>
If the record is found, a break is issued. If it's not, then it must always log_key_missing++.

Signed-off-by: lecaros <lecaros@calyptia.com>
@lecaros lecaros added this to the Fluent Bit v2.1.11 milestone Oct 6, 2023
@lecaros lecaros temporarily deployed to pr October 13, 2023 21:35 — with GitHub Actions Inactive
@lecaros lecaros temporarily deployed to pr October 13, 2023 21:35 — with GitHub Actions Inactive
@lecaros lecaros temporarily deployed to pr October 13, 2023 21:35 — with GitHub Actions Inactive
@lecaros lecaros temporarily deployed to pr October 13, 2023 22:03 — with GitHub Actions Inactive
@edsiper edsiper merged commit 8982e2d into master Oct 17, 2023
@edsiper edsiper deleted the chronicle-suggestions branch October 17, 2023 14:18
leonardo-albertovich pushed a commit that referenced this pull request Nov 3, 2023
These initializations are redundant. The variables are already initialized with these values and there's no code that could change them until this point.

Signed-off-by: lecaros <lecaros@calyptia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants