for (vhe = phi->hash_table[key]; vhe && vhe->vnode != vnode;
vhe = vhe->next);
if (make && !vhe) {
- vhe = (vhash_ent *) malloc(sizeof(vhash_ent));
+ vhe = calloc(1, sizeof(vhash_ent));
if (vhe) {
- memset(vhe, 0, sizeof(vhash_ent));
vhe->vnode = vnode;
vhe->next = phi->hash_table[key];
phi->hash_table[key] = vhe;
for (phi->hash_size = 1; nfiles > BUCKET_SIZE;
phi->hash_size++, nfiles >>= 1);
hsize = (1 << phi->hash_size);
- phi->hash_table = (vhash_ent **) malloc(hsize * sizeof(vhash_ent *));
+ phi->hash_table = calloc(hsize ,sizeof(vhash_ent *));
if (!phi->hash_table)
return ENOMEM;
- memset(phi->hash_table, 0, hsize * sizeof(vhash_ent *));
return 0;
} else {
if (phi->p->cb_error)
int nl, pl = 0;
if (vnode == 1) {
- *his_path = (char *)malloc(2);
- if (!his_path) {
+ *his_path = strdup("/");
+ if (!*his_path) {
if (phi->p->cb_error)
(phi->p->cb_error) (ENOMEM, 1, phi->p->err_refcon,
"No memory for pathname of vnode 1");
return ENOMEM;
}
- strcpy(*his_path, "/");
return 0;
}
nl = strlen(name);
if (path) {
- path = (char *)realloc(path, nl + pl + 2);
+ path = realloc(path, nl + pl + 2);
if (!path) {
if (phi->p->cb_error)
(phi->p->cb_error) (ENOMEM, 1, phi->p->err_refcon,