From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:25:30 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A6735600; Thu, 21 May 2015 13:25:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 939041CEF; Thu, 21 May 2015 13:25:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDPUJ4098307; Thu, 21 May 2015 13:25:30 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDPTra098302; Thu, 21 May 2015 13:25:29 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211325.t4LDPTra098302@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:25:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283231 - stable/10/usr.sbin/autofs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2015 13:25:30 -0000 Author: trasz Date: Thu May 21 13:25:28 2015 New Revision: 283231 URL: https://svnweb.freebsd.org/changeset/base/283231 Log: MFC r279813: Make things more readable; no functional changes. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/automount.c stable/10/usr.sbin/autofs/automountd.c stable/10/usr.sbin/autofs/common.c stable/10/usr.sbin/autofs/common.h stable/10/usr.sbin/autofs/popen.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/automount.c ============================================================================== --- stable/10/usr.sbin/autofs/automount.c Thu May 21 13:23:49 2015 (r283230) +++ stable/10/usr.sbin/autofs/automount.c Thu May 21 13:25:28 2015 (r283231) @@ -349,8 +349,7 @@ main_automount(int argc, char **argv) if (options == NULL) { options = checked_strdup(optarg); } else { - options = - separated_concat(options, optarg, ','); + options = concat(options, ',', optarg); } break; case 'u': @@ -388,8 +387,7 @@ main_automount(int argc, char **argv) if (show_maps) { if (options != NULL) { - root->n_options = separated_concat(options, - root->n_options, ','); + root->n_options = concat(options, ',', root->n_options); } if (show_maps > 1) { node_expand_indirect_maps(root); Modified: stable/10/usr.sbin/autofs/automountd.c ============================================================================== --- stable/10/usr.sbin/autofs/automountd.c Thu May 21 13:23:49 2015 (r283230) +++ stable/10/usr.sbin/autofs/automountd.c Thu May 21 13:25:28 2015 (r283231) @@ -241,8 +241,7 @@ handle_request(const struct autofs_daemo * Prepend options passed via automountd(8) command line. */ if (cmdline_options != NULL) { - options = - separated_concat(cmdline_options, options, ','); + options = concat(cmdline_options, ',', options); } nobrowse = pick_option("nobrowse", &options); @@ -268,8 +267,7 @@ handle_request(const struct autofs_daemo * We still need to create the single subdirectory * user is trying to access. */ - tmp = separated_concat(adr->adr_path, - adr->adr_key, '/'); + tmp = concat(adr->adr_path, '/', adr->adr_key); node = node_find(root, tmp); if (node != NULL) create_subtree(node, false); @@ -301,12 +299,12 @@ handle_request(const struct autofs_daemo * Prepend options passed via automountd(8) command line. */ if (cmdline_options != NULL) - options = separated_concat(cmdline_options, options, ','); + options = concat(cmdline_options, ',', options); /* * Append "automounted". */ - options = separated_concat(options, "automounted", ','); + options = concat(options, ',', "automounted"); /* * Remove "nobrowse", mount(8) doesn't understand it. @@ -334,11 +332,10 @@ handle_request(const struct autofs_daemo if (retrycnt == NULL) { log_debugx("retrycnt not specified in options; " "defaulting to 1"); - options = separated_concat(options, - separated_concat("retrycnt", "1", '='), ','); + options = concat(options, ',', "retrycnt=1"); } else { - options = separated_concat(options, - separated_concat("retrycnt", retrycnt, '='), ','); + options = concat(options, ',', + concat("retrycnt", '=', retrycnt)); } } @@ -465,8 +462,7 @@ main_automountd(int argc, char **argv) if (options == NULL) { options = checked_strdup(optarg); } else { - options = - separated_concat(options, optarg, ','); + options = concat(options, ',', optarg); } break; case 'v': Modified: stable/10/usr.sbin/autofs/common.c ============================================================================== --- stable/10/usr.sbin/autofs/common.c Thu May 21 13:23:49 2015 (r283230) +++ stable/10/usr.sbin/autofs/common.c Thu May 21 13:25:28 2015 (r283231) @@ -89,7 +89,7 @@ checked_strdup(const char *s) * Concatenate two strings, inserting separator between them, unless not needed. */ char * -separated_concat(const char *s1, const char *s2, char separator) +concat(const char *s1, char separator, const char *s2) { char *result; int ret; @@ -135,7 +135,7 @@ create_directory(const char *path) component = strsep(©, "/"); if (component == NULL) break; - tmp = separated_concat(partial, component, '/'); + tmp = concat(partial, '/', component); free(partial); partial = tmp; //log_debugx("creating \"%s\"", partial); @@ -545,7 +545,7 @@ node_path_x(const struct node *n, char * } assert(n->n_key[0] != '\0'); - path = separated_concat(n->n_key, x, '/'); + path = concat(n->n_key, '/', x); free(x); return (node_path_x(n->n_parent, path)); @@ -581,7 +581,7 @@ node_options_x(const struct node *n, cha if (n == NULL) return (x); - options = separated_concat(x, n->n_options, ','); + options = concat(x, ',', n->n_options); free(x); return (node_options_x(n->n_parent, options)); Modified: stable/10/usr.sbin/autofs/common.h ============================================================================== --- stable/10/usr.sbin/autofs/common.h Thu May 21 13:23:49 2015 (r283230) +++ stable/10/usr.sbin/autofs/common.h Thu May 21 13:25:28 2015 (r283231) @@ -70,7 +70,7 @@ void log_warnx(const char *, ...) __prin void log_debugx(const char *, ...) __printf0like(1, 2); char *checked_strdup(const char *); -char *separated_concat(const char *s1, const char *s2, char separator); +char *concat(const char *s1, char separator, const char *s2); void create_directory(const char *path); struct node *node_new_root(void); Modified: stable/10/usr.sbin/autofs/popen.c ============================================================================== --- stable/10/usr.sbin/autofs/popen.c Thu May 21 13:23:49 2015 (r283230) +++ stable/10/usr.sbin/autofs/popen.c Thu May 21 13:25:28 2015 (r283231) @@ -104,7 +104,7 @@ auto_popen(const char *argv0, ...) if (arg == NULL) break; - command = separated_concat(command, arg, ' '); + command = concat(command, ' ', arg); } va_end(ap);