Browse Source

Glibing....
Wed Jan 27 03:09:48 1999 Timur I. Bakeyev <mc@bat.ru>

* All around the source: Changed copy_strings() to g_strconcat(). Modi-
fy last parameter in concat_dir_and_file() to "" - to prevent stack from
disbalancing.

Timur Bakeyev 26 years ago
parent
commit
e57da1f7b3
10 changed files with 42 additions and 29 deletions
  1. 11 0
      vfs/ChangeLog
  2. 3 3
      vfs/direntry.c
  3. 6 6
      vfs/extfs.c
  4. 3 3
      vfs/fish.c
  5. 8 8
      vfs/ftpfs.c
  6. 1 1
      vfs/mcfs.c
  7. 2 2
      vfs/mcserv.c
  8. 5 3
      vfs/shared_ftp_fish.c
  9. 1 1
      vfs/tar.c
  10. 2 2
      vfs/undelfs.c

+ 11 - 0
vfs/ChangeLog

@@ -1,8 +1,19 @@
+Wed Jan 27 03:09:48 1999  Timur I. Bakeyev <mc@bat.ru>
+
+	* All around the source: Changed copy_strings() to g_strconcat(). Modi-
+	fy last parameter in concat_dir_and_file() to "" - to prevent stack from
+	disbalancing.
+	
 1999-01-25  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
 	* Makefile.am (libvfs_la_SOURCES): Added utilvfs.h.
 	* Make-mc.in (VFSHDRS): Likewise.
 
+Sat Jan 23 18:40:19 1999  Timur I. Bakeyev <mc@bat.ru>
+
+	* utilvfs.c (append_path_sep): Removed - concat_dir_and_file(dir, NULL);
+	gives the same effect.
+
 1999-01-21  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
 	* utilvfs.c (append_path_sep): Fixed, it was broken for paths

+ 3 - 3
vfs/direntry.c

@@ -535,7 +535,7 @@ vfs_s_fullpath (vfs *me, vfs_s_inode *ino)
 	vfs_die ("Implement me!");
     if ((!ino->ent) || (!ino->ent->dir) || (!ino->ent->dir->ent))
 	ERRNOR (EAGAIN, NULL);
-    return copy_strings (ino->ent->dir->ent->name, PATH_SEP_STR, 
+    return  g_strconcat (ino->ent->dir->ent->name, PATH_SEP_STR, 
 			    ino->ent->name, NULL);
 }
 
@@ -912,7 +912,7 @@ vfs_s_fill_names (vfs *me, void (*func)(char *))
     char *name;
     
     while (a){
-	name = copy_strings ( a->name, "#", me->prefix, "/", /* a->current_dir->name, */ NULL);
+	name = g_strconcat ( a->name, "#", me->prefix, "/", /* a->current_dir->name, */ NULL);
 	(*func)(name);
 	g_free (name);
 	a = a->next;
@@ -938,7 +938,7 @@ vfs_s_dump (vfs *me, char *prefix, vfs_s_inode *ino)
 	ent = ino->subdir;
 	while (ent){
 	    char *s;
-	    s = copy_strings (prefix, "/", ent->name, NULL);
+	    s = g_strconcat (prefix, "/", ent->name, NULL);
 	    if (ent->name[0] == '.')
 		printf ("%s IGNORED\n", s);
 	    else

+ 6 - 6
vfs/extfs.c

@@ -65,7 +65,7 @@ static void extfs_fill_names (vfs *me, void (*func)(char *))
     char *name;
     
     while (a){
-	name = copy_strings (extfs_prefixes [a->fstype], "#", 
+	name = g_strconcat (extfs_prefixes [a->fstype], "#", 
 			    (a->name ? a->name : ""), "/",
 			     a->current_dir->name, NULL);
 	(*func)(name);
@@ -202,7 +202,7 @@ static FILE *open_archive (int fstype, char *name, struct archive **pparc)
 #endif
     
     mc_extfsdir = concat_dir_and_file (mc_home, "extfs/");
-    cmd = copy_strings (mc_extfsdir, extfs_prefixes [fstype], 
+    cmd = g_strconcat (mc_extfsdir, extfs_prefixes [fstype], 
                         " list ", local_name ? local_name : tmp, NULL);
     if (tmp)
 	g_free (tmp);
@@ -562,7 +562,7 @@ void extfs_run (char *file)
     
     archive_name = name_quote (get_archive_name(archive), 0);
     mc_extfsdir = concat_dir_and_file (mc_home, "extfs/");
-    cmd = copy_strings (mc_extfsdir, extfs_prefixes [archive->fstype], 
+    cmd = g_strconcat (mc_extfsdir, extfs_prefixes [archive->fstype], 
                         " run ", archive_name, " ", q, NULL);
     g_free (mc_extfsdir);
     g_free (archive_name);
@@ -613,7 +613,7 @@ static void *extfs_open (vfs *me, char *file, int flags, int mode)
 	archive_name = name_quote (get_archive_name (archive), 0);
 
         mc_extfsdir = concat_dir_and_file (mc_home, "extfs/");
-        cmd = copy_strings (mc_extfsdir, extfs_prefixes [archive->fstype],
+        cmd = g_strconcat (mc_extfsdir, extfs_prefixes [archive->fstype],
                              " copyout ", 
                             archive_name, 
                             " ", q, " ", entry->inode->local_filename, NULL);
@@ -675,7 +675,7 @@ static int extfs_close (void *data)
 	g_free (p);
 	
 	mc_extfsdir = concat_dir_and_file (mc_home, "extfs/");
-	cmd = copy_strings (mc_extfsdir,
+	cmd = g_strconcat (mc_extfsdir,
 			    extfs_prefixes [archive->fstype],
 			    " copyin ", archive_name, " ",
 			    file_name, " ",
@@ -750,7 +750,7 @@ static int extfs_chdir (vfs *me, char *path)
     if ((!entry) || (!S_ISDIR (entry->inode->mode)))
     	return -1;
     entry->inode->archive->current_dir = entry;
-    res = copy_strings (
+    res = g_strconcat (
         entry->inode->archive->name, "#", extfs_prefixes [entry->inode->archive->fstype], 
 	"/", q, NULL);
     my_errno = 0;

+ 3 - 3
vfs/fish.c

@@ -179,7 +179,7 @@ pipeopen(vfs_s_super *super, char *path, char *argv[])
 static char *fish_getcwd(vfs *me, vfs_s_super *super)
 {
     if (command(me, super, WANT_STRING, "#PWD\npwd; echo '### 200'\n") == COMPLETE)
-        return copy_strings(reply_str, "/", NULL);
+        return  g_strconcat (reply_str, "/", NULL);
     ERRNOR (EIO, NULL);
 }
 static int
@@ -226,7 +226,7 @@ open_archive_int (vfs *me, vfs_s_super *super)
 #endif
 	    if (!SUP.password){
 		char *p, *op;
-		p = copy_strings (" fish: Password required for ", SUP.user, 
+		p = g_strconcat (" fish: Password required for ", SUP.user, 
 				  " ", NULL);
 		op = vfs_get_password (p);
 		g_free (p);
@@ -253,7 +253,7 @@ open_archive_int (vfs *me, vfs_s_super *super)
     SUP.home = fish_getcwd (me, super);
     print_vfs_message( "FISH: Connected, home %s.", SUP.home );
 #if 0
-    super->name = copy_strings( "/#sh:", SUP.user, "@", SUP.host, "/", NULL );
+    super->name = g_strconcat ( "/#sh:", SUP.user, "@", SUP.host, "/", NULL );
 #endif
     super->name = g_strdup(PATH_SEP_STR);
 

+ 8 - 8
vfs/ftpfs.c

@@ -229,7 +229,7 @@ command (struct connection *bucket, int wait_reply, char *fmt, ...)
     fmt_str = g_strdup_vprintf (fmt, ap);
     va_end (ap);
 
-    str = copy_strings (fmt_str, "\r\n", NULL);
+    str = g_strconcat (fmt_str, "\r\n", NULL);
     g_free (fmt_str);
 
     if (logfile){
@@ -320,7 +320,7 @@ login_server (struct connection *bucket, char *netrcpass)
             char *p;
 
 	    if (!bucket->password){
-		p = copy_strings (" FTP: Password required for ", quser (bucket), 
+		p = g_strconcat (" FTP: Password required for ", quser (bucket), 
 				  " ", NULL);
 		op = vfs_get_password (p);
 		g_free (p);
@@ -335,7 +335,7 @@ login_server (struct connection *bucket, char *netrcpass)
     if (!anon || logfile)
 	pass = g_strdup (op);
     else
-	pass = copy_strings ("-", op, NULL);
+	pass = g_strconcat ("-", op, NULL);
     wipe_password (op);
 
     
@@ -352,7 +352,7 @@ login_server (struct connection *bucket, char *netrcpass)
 	g_free (host);
 	if (proxypass)
 	    wipe_password (proxypass);
-	p = copy_strings (" Proxy: Password required for ", proxyname, " ",
+	p = g_strconcat (" Proxy: Password required for ", proxyname, " ",
 			  NULL);
 	proxypass = vfs_get_password (p);
 	g_free (p);
@@ -363,7 +363,7 @@ login_server (struct connection *bucket, char *netrcpass)
 	}
 	name = g_strdup (quser (bucket));
 #else
-	name = copy_strings (quser (bucket), "@", 
+	name = g_strconcat (quser (bucket), "@", 
 		qhost (bucket)[0] == '!' ? qhost (bucket)+1 : qhost (bucket), NULL);
 #endif
     } else 
@@ -1243,7 +1243,7 @@ retrieve_dir(struct connection *bucket, char *remote_path, int resolve_symlinks)
     else if (has_spaces)
         sock = open_data_connection (bucket, "LIST -la", ".", TYPE_ASCII, 0);
     else {
-	char *path = copy_strings (remote_path, PATH_SEP_STR, ".", NULL);
+	char *path = g_strconcat (remote_path, PATH_SEP_STR, ".", NULL);
 	sock = open_data_connection (bucket, "LIST -la", path, TYPE_ASCII, 0);
 	g_free (path);
     }
@@ -1560,9 +1560,9 @@ ftpfs_init_passwd(void)
     gethostname(hostname, sizeof(hostname));
     hp = gethostbyname(hostname);
     if (hp != NULL)
-	ftpfs_anonymous_passwd = copy_strings (p, "@", hp->h_name, NULL);
+	ftpfs_anonymous_passwd = g_strconcat (p, "@", hp->h_name, NULL);
     else
-	ftpfs_anonymous_passwd = copy_strings (p, "@", hostname, NULL);
+	ftpfs_anonymous_passwd = g_strconcat (p, "@", hostname, NULL);
     endpwent ();
 }
 

+ 1 - 1
vfs/mcfs.c

@@ -88,7 +88,7 @@ static void mcfs_fill_names (vfs *me, void (*func)(char *))
     for (i = 0; i < MCFS_MAX_CONNECTIONS; i++){
 	if (mcfs_connections [i].host == 0)
 	    continue;
-	name = copy_strings ("/#mc:", mcfs_connections [i].user,
+	name = g_strconcat ("/#mc:", mcfs_connections [i].user,
 			     "@",   mcfs_connections [i].host, NULL);
 	(*func) (name);
 	g_free (name);

+ 2 - 2
vfs/mcserv.c

@@ -454,7 +454,7 @@ void do_readdir (void)
 
 	rpc_send (msock, RPC_INT, length, RPC_END);
 	rpc_send (msock, RPC_BLOCK, length, dirent->d_name, RPC_END);
-	fname = copy_strings (mcfs_DIR.names [handle], 
+	fname = g_strconcat (mcfs_DIR.names [handle], 
 				PATH_SEP_STR, dirent->d_name, NULL);
 	n = lstat (fname, &st);
 	send_status (n, errno);
@@ -1290,7 +1290,7 @@ void vfs_die( char *m )
 	exit (1);
     }
 #ifdef HAVE_MAD
-char *copy_strings (const char *first, ...)
+char * mad_strconcat (const char *first, ...)
 {
     va_list ap;
     long len;

+ 5 - 3
vfs/shared_ftp_fish.c

@@ -187,7 +187,7 @@ static void X_fill_names (vfs *me, void (*func)(char *))
     do {
 	if ((bucket = lptr->data) != 0){
 
-	    path_name = copy_strings ( X_myname, quser (bucket),
+	    path_name = g_strconcat ( X_myname, quser (bucket),
 				      "@",      qhost (bucket), 
 				      qcdir(bucket), NULL);
 	    (*func)(path_name);
@@ -226,8 +226,10 @@ s_get_path (struct connection **bucket, char *path, char *name)
 	    remote_path = NULL;
 	}
     }
-    g_free (host);
-    g_free (user);
+    if (host)
+	g_free (host);
+    if (user)
+	g_free (user);
     if (pass)
         wipe_password (pass);
 

+ 1 - 1
vfs/tar.c

@@ -95,7 +95,7 @@ static int tar_open_archive (vfs *me, char *name, vfs_s_super *archive)
     if (size > 0) {
 	char *s;
 	mc_close( result );
-	s = copy_strings( archive->name, decompress_extension (type), NULL );
+	s = g_strconcat ( archive->name, decompress_extension (type), NULL );
 	result = mc_open (s, O_RDONLY);
 	if (result == -1) 
 	    message_2s (1, MSG_ERROR, _("Couldn't open tar archive\n%s"), s);

+ 2 - 2
vfs/undelfs.c

@@ -133,14 +133,14 @@ undelfs_get_path (char *dirname, char **ext2_fname, char **file)
 	if (*p == '/'){
 	    *file = g_strdup (p+1);
 	    *p = 0;
-	    *ext2_fname = copy_strings ("/dev/", dirname, NULL);
+	    *ext2_fname = g_strconcat ("/dev/", dirname, NULL);
 	    *p = '/';
 	    return;
 	}
 	p--;
     }
     *file = g_strdup ("");
-    *ext2_fname = copy_strings ("/dev/", dirname, NULL);
+    *ext2_fname = g_strconcat ("/dev/", dirname, NULL);
     return;
 }
 

Some files were not shown because too many files changed in this diff