Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

out_chronicle: remove redundant code #8004

Merged
merged 3 commits into from
Oct 17, 2023
Merged

out_chronicle: remove redundant code #8004

merged 3 commits into from
Oct 17, 2023

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 <[email protected]>
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 <[email protected]>
If the record is found, a break is issued. If it's not, then it must always log_key_missing++.

Signed-off-by: lecaros <[email protected]>
@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
43 checks passed
@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 <[email protected]>
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