More usage of GLib functions.

Use g_snprintf instead of snprintf and g_free instaed of free.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2009-12-07 22:17:42 +03:00 committed by Slava Zanko
parent 4ef67c33b9
commit ec3c4c37c3
2 changed files with 6 additions and 6 deletions

View File

@ -711,7 +711,7 @@ extfs_open (struct vfs_class *me, const char *file, int flags, int mode)
if (!created && !(flags & O_TRUNC)
&& extfs_cmd (" copyout ", archive, entry, local_filename)) {
unlink (local_filename);
free (local_filename);
g_free (local_filename);
my_errno = EIO;
return NULL;
}
@ -1223,7 +1223,7 @@ static void extfs_remove_entry (struct entry *e)
if (i <= 0) {
if (e->inode->local_filename != NULL) {
unlink (e->inode->local_filename);
free (e->inode->local_filename);
g_free (e->inode->local_filename);
}
g_free (e->inode->linkname);
g_free (e->inode);
@ -1238,14 +1238,14 @@ static void extfs_free_entry (struct entry *e)
int i = --(e->inode->nlink);
if (S_ISDIR (e->inode->mode) && e->inode->first_in_subdir != NULL) {
struct entry *f = e->inode->first_in_subdir;
e->inode->first_in_subdir = NULL;
extfs_free_entry (f);
}
if (i <= 0) {
if (e->inode->local_filename != NULL) {
unlink (e->inode->local_filename);
free (e->inode->local_filename);
g_free (e->inode->local_filename);
}
g_free (e->inode->linkname);
g_free (e->inode);

View File

@ -338,7 +338,7 @@ send_time (int sock, time_t t)
long ltime = (long) t;
char buf[BUF_SMALL];
snprintf (buf, sizeof (buf), "%lx", ltime);
g_snprintf (buf, sizeof (buf), "%lx", ltime);
rpc_send (sock, RPC_STRING, buf, RPC_END);
}
}
@ -515,7 +515,7 @@ do_readdir (void)
fname_len =
strlen (mcfs_DIR.names[handle]) + strlen (dirent->d_name) + 2;
fname = malloc (fname_len);
snprintf (fname, fname_len, "%s/%s", mcfs_DIR.names[handle],
g_snprintf (fname, fname_len, "%s/%s", mcfs_DIR.names[handle],
dirent->d_name);
n = lstat (fname, &st);
g_free (fname);