mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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:
parent
b69fcc15b4
commit
a770b4c357
@ -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>
|
||||
|
||||
* src/internal.h, src/virsh.c: Replace _N with N_ so that
|
||||
|
@ -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++;
|
||||
|
@ -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);
|
||||
|
@ -1576,7 +1576,7 @@ cmdVcpupin(vshControl * ctl, vshCmd * cmd)
|
||||
virDomainFree(dom);
|
||||
return FALSE;
|
||||
}
|
||||
cpulist = index(cpulist, ',');
|
||||
cpulist = strchr(cpulist, ',');
|
||||
if (cpulist)
|
||||
cpulist++;
|
||||
} while (cpulist);
|
||||
|
@ -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;
|
||||
|
@ -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++;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user