flipper-io / flipper

Flipper is a development platform that can be controlled from any programming language.
https://www.flipper.io/
Apache License 2.0
72 stars 15 forks source link

Eliminate labels and consolidate error logic. #69

Closed georgemorgan closed 6 years ago

georgemorgan commented 7 years ago

There are a handful of places in the project where labels can be eliminated in favor of while loops or if else statements. There are also a variety of places in the project where the error logic could be cleaned up. For example:

loader.c

    int retval;

    if (header -> entry) {
        /* If the image has an entry point, load it as an application. */
        if (retval = os_load_application(base, header) < lf_success) {
            goto failure;
        }
    } else {
        /* If not, load the image as a module. */
        if (retval = os_load_module(base, header) < lf_success) {
            goto failure;
        }
    }

    return retval;
failure:
    /* Free the memory allocated to load the image. */
    free(base);
    return lf_error;
nicholastmosher commented 6 years ago

Is this a type of issue where there are specific instances of this which need to be addressed, or is this more of a design style that we should adopt for the future? If there are specific instances which need fixing, can you enumerate those here and potentially make a checklist for completing them? I think we should try to phrase issues in such a way that they become units of work with a clear final state. That way we get into a healthy habit of a) not having long-running issues with no clear end in sight and b) documenting what exactly needs fixing so potential contributors can help out :)

georgemorgan commented 6 years ago

This was an issue that was moved over from the old repo. At the time it was a serious problem, now it's mostly fixed. However, it's good to have this as a reminder. We can close it if you want.

nicholastmosher commented 6 years ago

If we don't have a specific instance that needs to be fix (that we know of) I'll go ahead and close this. In the future we can reopen this if necessary.