diff --git a/ChangeLog b/ChangeLog index 50e366b0e159652657517bcaca76777db8c7193f..570c6eb49f44623a3895043e034e389f31205b32 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Jun 15 14:42:00 BST 2007 Richard W.M. Jones + + * src/test.c, src/virsh.c, src/xend_internal.c, src/xm_internal.c: + Replace calls to deprecated {,r}index with str{,r}chr. + Fri Jun 15 08:53:00 BST 2007 Richard W.M. Jones * src/internal.h, src/virsh.c: Replace _N with N_ so that diff --git a/qemud/driver.c b/qemud/driver.c index 0c3548679db90a64379a2af78471fee7d18324c9..1bcb66f5163f1489213b50ae58c08fa4cc595510 100644 --- a/qemud/driver.c +++ b/qemud/driver.c @@ -158,7 +158,7 @@ int qemudGetCPUInfo(unsigned int *cpus, unsigned int *mhz, if (!strncmp(line, "processor\t", 10)) { /* aka a single logical CPU */ (*cpus)++; } else if (!strncmp(line, "cpu MHz\t", 8)) { - char *offset = index(line, ':'); + char *offset = strchr(line, ':'); if (!offset) continue; offset++; @@ -167,7 +167,7 @@ int qemudGetCPUInfo(unsigned int *cpus, unsigned int *mhz, *mhz = (unsigned int)strtol(offset, NULL, 10); } else if (!strncmp(line, "physical id\t", 12)) { /* aka socket */ unsigned int id; - char *offset = index(line, ':'); + char *offset = strchr(line, ':'); if (!offset) continue; offset++; @@ -178,7 +178,7 @@ int qemudGetCPUInfo(unsigned int *cpus, unsigned int *mhz, *sockets = (id + 1); } else if (!strncmp(line, "cpu cores\t", 9)) { /* aka cores */ unsigned int id; - char *offset = index(line, ':'); + char *offset = strchr(line, ':'); if (!offset) continue; offset++; diff --git a/src/test.c b/src/test.c index ddd64fe1e38606fded0b4978cd10ae57a281604d..765dc55503491acff9c9714504e9528fadb9bebf 100644 --- a/src/test.c +++ b/src/test.c @@ -504,7 +504,7 @@ static char *testBuildFilename(const char *relativeTo, if (filename[0] == '/') return strdup(filename); - offset = rindex(relativeTo, '/'); + offset = strrchr(relativeTo, '/'); if ((baseLen = (offset-relativeTo+1))) { char *absFile = malloc(baseLen + strlen(filename) + 1); strncpy(absFile, relativeTo, baseLen); diff --git a/src/virsh.c b/src/virsh.c index ada4b0a9d1d4cc793b177451ebb934efd9a3cfac..3c96a2a1ba3957b0077238103f9037e1701291a6 100644 --- a/src/virsh.c +++ b/src/virsh.c @@ -1576,7 +1576,7 @@ cmdVcpupin(vshControl * ctl, vshCmd * cmd) virDomainFree(dom); return FALSE; } - cpulist = index(cpulist, ','); + cpulist = strchr(cpulist, ','); if (cpulist) cpulist++; } while (cpulist); diff --git a/src/xend_internal.c b/src/xend_internal.c index 218d9fea293064017651f8d92d6e5cf3c89fca3b..0a7736c99732f8346e93971701cdf211d6503ef2 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -1571,7 +1571,7 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi /* New style disk config from Xen >= 3.0.3 */ if (xendConfigVersion > 1) { - offset = rindex(dst, ':'); + offset = strrchr(dst, ':'); if (offset) { if (!strcmp(offset, ":cdrom")) { cdrom = 1; diff --git a/src/xm_internal.c b/src/xm_internal.c index da391a5aaa0a1763c16299651151f2a3f5f68c57..fe8d04857f13ef494b3cdc780966e7e2cc0970b2 100644 --- a/src/xm_internal.c +++ b/src/xm_internal.c @@ -734,7 +734,7 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) { */ /* Extract the source */ - if (!(offset = index(head, ',')) || offset[0] == '\0') + if (!(offset = strchr(head, ',')) || offset[0] == '\0') goto skipdisk; if ((offset - head) >= (PATH_MAX-1)) goto skipdisk; @@ -743,7 +743,7 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) { head = offset + 1; /* Extract the dest */ - if (!(offset = index(head, ',')) || offset[0] == '\0') + if (!(offset = strchr(head, ',')) || offset[0] == '\0') goto skipdisk; if ((offset - head) >= (PATH_MAX-1)) goto skipdisk; @@ -753,14 +753,14 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) { /* Extract source driver type */ - if (!(tmp = index(src, ':')) || !tmp[0]) + if (!(tmp = strchr(src, ':')) || !tmp[0]) goto skipdisk; strncpy(drvName, src, (tmp-src)); drvName[tmp-src] = '\0'; /* And the source driver sub-type */ if (!strncmp(drvName, "tap", 3)) { - if (!(tmp1 = index(tmp+1, ':')) || !tmp1[0]) + if (!(tmp1 = strchr(tmp+1, ':')) || !tmp1[0]) goto skipdisk; strncpy(drvType, tmp+1, (tmp1-(tmp+1))); memmove(src, src+(tmp1-src)+1, strlen(src)-(tmp1-src)); @@ -780,7 +780,7 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) { } /* Check for a :cdrom/:disk postfix */ - if ((tmp = index(dev, ':')) != NULL) { + if ((tmp = strchr(dev, ':')) != NULL) { if (!strcmp(tmp, ":cdrom")) cdrom = 1; tmp[0] = '\0'; @@ -838,9 +838,9 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) { key = list->str; while (key) { char *data; - char *nextkey = index(key, ','); + char *nextkey = strchr(key, ','); - if (!(data = index(key, '=')) || (data[0] == '\0')) + if (!(data = strchr(key, '=')) || (data[0] == '\0')) goto skipnic; data++; @@ -928,14 +928,14 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) { while (key) { char *data; - char *nextkey = index(key, ','); + char *nextkey = strchr(key, ','); char *end = nextkey; if (nextkey) { *end = '\0'; nextkey++; } - if (!(data = index(key, '=')) || (data[0] == '\0')) + if (!(data = strchr(key, '=')) || (data[0] == '\0')) break; data++;