Actions
Bug #14613
closedformat: cstyle cleanup
Start date:
Due date:
% Done:
100%
Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
Description
Clean it up. No functional changes intended.
Testing done: used format command to partition the disk and browse the partition table. wsdiff is mostly complaining about changes of constants, but since we do have 2 small code changes there is analysis from Dan:
Remaining noise was generated by these two functions: gen_alts_ent() get_altsctr() The first has an additional fix where the antipattern: if (foo != NULL) free(foo); is replaced with: free(foo) - if ((ap->ap_mapp = (uchar_t *)malloc(ap->ap_map_secsiz)) == NULL) { - (void) fprintf(stderr, - "Unable to malloc alternate partition map.\n"); - return (52); - } + /* allocate buffer for the alts partition table (sector size) */ + ap->ap_tbl_secsiz = byte_to_secsiz(ALTS_PARTTBL_SIZE, NBPSCTR); + ap->ap_tblp = malloc(ap->ap_tbl_secsiz); + if (ap->ap_tblp == NULL) { + (void) fprintf(stderr, + "Unable to malloc alternate partition table.\n"); + return (50); + } which the extra reference to ap->ap_tblp AFTER malloc causing a fresh reload of the field, caused some more cascading.
Updated by Electric Monk 4 months ago
- Status changed from In Progress to Closed
- % Done changed from 90 to 100
git commit b12aaafbf56c5a06b6cfd21655531a33e38a8ed9
commit b12aaafbf56c5a06b6cfd21655531a33e38a8ed9 Author: Toomas Soome <tsoome@me.com> Date: 2022-04-18T22:58:17.000Z 14613 format: cstyle cleanup Reviewed by: C Fraire <cfraire@me.com> Approved by: Dan McDonald <danmcd@joyent.com>
Actions