Replace strcasecmp with str_caseeq

This commit is contained in:
MCUdude
2023-08-09 23:07:41 +02:00
parent 72597dbd16
commit 2501fcd97b
7 changed files with 10 additions and 10 deletions

View File

@@ -47,7 +47,7 @@ int upidxsig(const uint8_t *sigs) {
// Given the long name of a part return index in uP table or -1 if not found
int upidxname(const char *name) {
for(size_t i=0; i < sizeof uP_table/sizeof *uP_table; i++)
if(0 == strcasecmp(name, uP_table[i].name))
if(str_caseeq(name, uP_table[i].name))
return i;
return -1;

View File

@@ -342,11 +342,11 @@ buspirate_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) {
char *resetpin;
while ((resetpin = strtok(preset, ","))) {
preset = NULL; /* for subsequent strtok() calls */
if (strcasecmp(resetpin, "cs") == 0)
if (str_caseeq(resetpin, "cs"))
PDATA(pgm)->reset |= BP_RESET_CS;
else if (strcasecmp(resetpin, "aux") == 0 || strcasecmp(reset, "aux1") == 0)
else if (str_caseeq(resetpin, "aux") || str_caseeq(reset, "aux1"))
PDATA(pgm)->reset |= BP_RESET_AUX;
else if (strcasecmp(resetpin, "aux2") == 0)
else if (str_caseeq(resetpin, "aux2"))
PDATA(pgm)->reset |= BP_RESET_AUX2;
else {
pmsg_error("reset must be either CS or AUX\n");

View File

@@ -939,7 +939,7 @@ void cfg_update_mcuid(AVRPART *part) {
// Find an entry that shares the same name, overwrite mcuid with known, existing mcuid
for(size_t i=0; i < sizeof uP_table/sizeof *uP_table; i++) {
if(strcasecmp(part->desc, uP_table[i].name) == 0) {
if(str_caseeq(part->desc, uP_table[i].name)) {
if(part->mcuid != (int) uP_table[i].mcuid) {
if(part->mcuid >= 0 && verbose >= MSG_DEBUG)
yywarning("overwriting mcuid of part %s to be %d", part->desc, uP_table[i].mcuid);

View File

@@ -118,7 +118,7 @@ const PROGRAMMER_TYPE programmers_types[] = { // Name(s) the programmers call th
const PROGRAMMER_TYPE *locate_programmer_type(const char *id) {
for(size_t i = 0; i < sizeof programmers_types/sizeof*programmers_types; i++)
if(strcasecmp(id, programmers_types[i].id) == 0)
if(str_caseeq(id, programmers_types[i].id))
return programmers_types + i;
return NULL;

View File

@@ -981,9 +981,9 @@ static int serialupdi_parseextparms(const PROGRAMMER *pgm, const LISTID extparms
extended_param = ldata(ln);
if (sscanf(extended_param, "rtsdtr=%4s", rts_mode) == 1) {
if (strcasecmp(rts_mode, "low") == 0) {
if (str_caseeq(rts_mode, "low")) {
updi_set_rts_mode(pgm, RTS_MODE_LOW);
} else if (strcasecmp(rts_mode, "high") == 0) {
} else if (str_caseeq(rts_mode, "high")) {
updi_set_rts_mode(pgm, RTS_MODE_HIGH);
} else {
pmsg_error("RTS/DTR mode must be LOW or HIGH\n");

View File

@@ -179,7 +179,7 @@ static int usbdev_open(const char *port, union pinfo pinfo, union filedescriptor
* right-to-left.
*/
x = strlen(string) - strlen(serno);
if (strcasecmp(string + x, serno) != 0)
if (!str_caseeq(string + x, serno))
{
pmsg_debug("usbdev_open(): serial number does not match\n");
usb_close(udev);

View File

@@ -561,7 +561,7 @@ static int usbasp_open(PROGRAMMER *pgm, const char *port) {
/* try alternatives */
if(str_eq(pgmid, "usbasp")) {
/* for id usbasp autodetect some variants */
if(strcasecmp(port, "nibobee") == 0) {
if(str_caseeq(port, "nibobee")) {
pmsg_error("using -C usbasp -P nibobee is deprecated, use -C nibobee instead\n");
if (usbOpenDevice(&PDATA(pgm)->usbhandle, USBASP_NIBOBEE_VID, "www.nicai-systems.com",
USBASP_NIBOBEE_PID, "NIBObee") != 0) {