RTEMS Tools | misc/bin2c/rtems-bin2c.c: Add feature to include license header in generated C files (!58)
Christian Mauderer (@c-mauderer)
gitlab at rtems.org
Fri Mar 21 07:22:46 UTC 2025
Christian Mauderer commented on a discussion on misc/bin2c/rtems-bin2c.c: https://gitlab.rtems.org/rtems/tools/rtems-tools/-/merge_requests/58#note_121520
> exit(1);
> }
> }
> +
> + /* Read license header if specified */
> + char *license_header = NULL;
> + if (licensefile) {
> + license_header = read_license_file(licensefile);
> + } else if (usebsdlicense) {
> + license_header = strdup(
Sorry, I haven't been clear here. It was more a question than a request to change something. If you assign the constant string, the `free(license_header)` will make problems later. So the original solution was better than the change.
There are at least three possible solutions:
- Using `strdup` like you did in your original approach.
- Using a constant string and only `free` the pointer if it is not pointing to that string.
- Keeping the `license_header` on NULL and decide later to write a constant string instead of the `license_header`.
All have advantages and disadvantages. I just wanted to know why you picked the approach that you did.
--
View it on GitLab: https://gitlab.rtems.org/rtems/tools/rtems-tools/-/merge_requests/58#note_121520
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250321/a81d4ce1/attachment-0001.htm>
More information about the bugs
mailing list