Fri Jun 15 14:42:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>

* src/test.c, src/virsh.c, src/xend_internal.c, src/xm_internal.c:
	  Replace calls to deprecated {,r}index with str{,r}chr.
This commit is contained in:
Richard W.M. Jones 2007-06-15 13:44:19 +00:00
parent b69fcc15b4
commit a770b4c357
6 changed files with 20 additions and 15 deletions

View File

@ -1,3 +1,8 @@
Fri Jun 15 14:42:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* 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 <rjones@redhat.com> Fri Jun 15 08:53:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/internal.h, src/virsh.c: Replace _N with N_ so that * src/internal.h, src/virsh.c: Replace _N with N_ so that

View File

@ -158,7 +158,7 @@ int qemudGetCPUInfo(unsigned int *cpus, unsigned int *mhz,
if (!strncmp(line, "processor\t", 10)) { /* aka a single logical CPU */ if (!strncmp(line, "processor\t", 10)) { /* aka a single logical CPU */
(*cpus)++; (*cpus)++;
} else if (!strncmp(line, "cpu MHz\t", 8)) { } else if (!strncmp(line, "cpu MHz\t", 8)) {
char *offset = index(line, ':'); char *offset = strchr(line, ':');
if (!offset) if (!offset)
continue; continue;
offset++; offset++;
@ -167,7 +167,7 @@ int qemudGetCPUInfo(unsigned int *cpus, unsigned int *mhz,
*mhz = (unsigned int)strtol(offset, NULL, 10); *mhz = (unsigned int)strtol(offset, NULL, 10);
} else if (!strncmp(line, "physical id\t", 12)) { /* aka socket */ } else if (!strncmp(line, "physical id\t", 12)) { /* aka socket */
unsigned int id; unsigned int id;
char *offset = index(line, ':'); char *offset = strchr(line, ':');
if (!offset) if (!offset)
continue; continue;
offset++; offset++;
@ -178,7 +178,7 @@ int qemudGetCPUInfo(unsigned int *cpus, unsigned int *mhz,
*sockets = (id + 1); *sockets = (id + 1);
} else if (!strncmp(line, "cpu cores\t", 9)) { /* aka cores */ } else if (!strncmp(line, "cpu cores\t", 9)) { /* aka cores */
unsigned int id; unsigned int id;
char *offset = index(line, ':'); char *offset = strchr(line, ':');
if (!offset) if (!offset)
continue; continue;
offset++; offset++;

View File

@ -504,7 +504,7 @@ static char *testBuildFilename(const char *relativeTo,
if (filename[0] == '/') if (filename[0] == '/')
return strdup(filename); return strdup(filename);
offset = rindex(relativeTo, '/'); offset = strrchr(relativeTo, '/');
if ((baseLen = (offset-relativeTo+1))) { if ((baseLen = (offset-relativeTo+1))) {
char *absFile = malloc(baseLen + strlen(filename) + 1); char *absFile = malloc(baseLen + strlen(filename) + 1);
strncpy(absFile, relativeTo, baseLen); strncpy(absFile, relativeTo, baseLen);

View File

@ -1576,7 +1576,7 @@ cmdVcpupin(vshControl * ctl, vshCmd * cmd)
virDomainFree(dom); virDomainFree(dom);
return FALSE; return FALSE;
} }
cpulist = index(cpulist, ','); cpulist = strchr(cpulist, ',');
if (cpulist) if (cpulist)
cpulist++; cpulist++;
} while (cpulist); } while (cpulist);

View File

@ -1571,7 +1571,7 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
/* New style disk config from Xen >= 3.0.3 */ /* New style disk config from Xen >= 3.0.3 */
if (xendConfigVersion > 1) { if (xendConfigVersion > 1) {
offset = rindex(dst, ':'); offset = strrchr(dst, ':');
if (offset) { if (offset) {
if (!strcmp(offset, ":cdrom")) { if (!strcmp(offset, ":cdrom")) {
cdrom = 1; cdrom = 1;

View File

@ -734,7 +734,7 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
*/ */
/* Extract the source */ /* Extract the source */
if (!(offset = index(head, ',')) || offset[0] == '\0') if (!(offset = strchr(head, ',')) || offset[0] == '\0')
goto skipdisk; goto skipdisk;
if ((offset - head) >= (PATH_MAX-1)) if ((offset - head) >= (PATH_MAX-1))
goto skipdisk; goto skipdisk;
@ -743,7 +743,7 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
head = offset + 1; head = offset + 1;
/* Extract the dest */ /* Extract the dest */
if (!(offset = index(head, ',')) || offset[0] == '\0') if (!(offset = strchr(head, ',')) || offset[0] == '\0')
goto skipdisk; goto skipdisk;
if ((offset - head) >= (PATH_MAX-1)) if ((offset - head) >= (PATH_MAX-1))
goto skipdisk; goto skipdisk;
@ -753,14 +753,14 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
/* Extract source driver type */ /* Extract source driver type */
if (!(tmp = index(src, ':')) || !tmp[0]) if (!(tmp = strchr(src, ':')) || !tmp[0])
goto skipdisk; goto skipdisk;
strncpy(drvName, src, (tmp-src)); strncpy(drvName, src, (tmp-src));
drvName[tmp-src] = '\0'; drvName[tmp-src] = '\0';
/* And the source driver sub-type */ /* And the source driver sub-type */
if (!strncmp(drvName, "tap", 3)) { if (!strncmp(drvName, "tap", 3)) {
if (!(tmp1 = index(tmp+1, ':')) || !tmp1[0]) if (!(tmp1 = strchr(tmp+1, ':')) || !tmp1[0])
goto skipdisk; goto skipdisk;
strncpy(drvType, tmp+1, (tmp1-(tmp+1))); strncpy(drvType, tmp+1, (tmp1-(tmp+1)));
memmove(src, src+(tmp1-src)+1, strlen(src)-(tmp1-src)); 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 */ /* Check for a :cdrom/:disk postfix */
if ((tmp = index(dev, ':')) != NULL) { if ((tmp = strchr(dev, ':')) != NULL) {
if (!strcmp(tmp, ":cdrom")) if (!strcmp(tmp, ":cdrom"))
cdrom = 1; cdrom = 1;
tmp[0] = '\0'; tmp[0] = '\0';
@ -838,9 +838,9 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
key = list->str; key = list->str;
while (key) { while (key) {
char *data; 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; goto skipnic;
data++; data++;
@ -928,14 +928,14 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
while (key) { while (key) {
char *data; char *data;
char *nextkey = index(key, ','); char *nextkey = strchr(key, ',');
char *end = nextkey; char *end = nextkey;
if (nextkey) { if (nextkey) {
*end = '\0'; *end = '\0';
nextkey++; nextkey++;
} }
if (!(data = index(key, '=')) || (data[0] == '\0')) if (!(data = strchr(key, '=')) || (data[0] == '\0'))
break; break;
data++; data++;