[Pkg-privacy-commits] [libgsecuredelete] 20/168: Made build_args() return a list of strings instead of an array.
Ulrike Uhlig
u-guest at moszumanska.debian.org
Thu Jul 7 20:06:33 UTC 2016
This is an automated email from the git hooks/post-receive script.
u-guest pushed a commit to branch master
in repository libgsecuredelete.
commit f52c4688d31b7541493cc0816f74f0bcc7cad52f
Author: Colomban Wendling <ban at herbesfolles.org>
Date: Thu Oct 1 19:10:05 2009 +0200
Made build_args() return a list of strings instead of an array.
AsyncOperation.build_args() now returns a List<string> instead of an
array of strings because arrays are not flexible as lists.
---
gsecuredelete/async-operation.vala | 27 +++++++++++++++++++++++----
gsecuredelete/delete-operation.vala | 16 +++++++---------
gsecuredelete/fill-operation.vala | 15 +++++++--------
3 files changed, 37 insertions(+), 21 deletions(-)
diff --git a/gsecuredelete/async-operation.vala b/gsecuredelete/async-operation.vala
index ec987f8..b15dda0 100644
--- a/gsecuredelete/async-operation.vala
+++ b/gsecuredelete/async-operation.vala
@@ -123,9 +123,28 @@ namespace SecureDelete
}
/* builds the command's arguments (argv) */
- protected abstract string?[] build_args ()
+ protected abstract List<string> build_args ()
throws AsyncOperationError;
+ /* converts the args built by build_args() to the expected format */
+ private string?[] do_build_args ()
+ throws AsyncOperationError
+ {
+ List<string> args;
+ string?[] array_args;
+ size_t i;
+
+ args = this.build_args ();
+ array_args = new string[args.length () + 1];
+ i = 0;
+ foreach (unowned string arg in args) {
+ array_args[i++] = arg;
+ }
+ array_args[i] = null;
+
+ return array_args;
+ }
+
/* builds the command's environment */
protected virtual string?[]? build_environ ()
{
@@ -181,7 +200,7 @@ namespace SecureDelete
Posix.pid_t wait_rv;
string? message = null;
- /* FIXME: 1 = WNOHANG, buf WNOHANG doesn't seems to be accessible from
+ /* FIXME: 1 = WNOHANG, but WNOHANG doesn't seems to be accessible from
* Vala */
wait_rv = Posix.waitpid ((Posix.pid_t)this.pid, out exit_status, 1);
if ((int)wait_rv < 0) {
@@ -248,7 +267,7 @@ namespace SecureDelete
this.busy = true;
}
try {
- args = this.build_args ();
+ args = this.do_build_args ();
} catch (AsyncOperationError e) {
throw e;
}
@@ -305,7 +324,7 @@ namespace SecureDelete
this.busy = true;
}
try {
- args = this.build_args ();
+ args = this.do_build_args ();
} catch (AsyncOperationError e) {
throw e;
}
diff --git a/gsecuredelete/delete-operation.vala b/gsecuredelete/delete-operation.vala
index 0bebee5..584e49c 100644
--- a/gsecuredelete/delete-operation.vala
+++ b/gsecuredelete/delete-operation.vala
@@ -63,23 +63,21 @@ namespace SecureDelete
}
/* builds the command's arguments (argv) */
- protected override string?[] build_args ()
+ protected override List<string> build_args ()
throws AsyncOperationError
{
- string?[] args = {
- "srm",
- "-rv"
- };
+ List<string> args = null;
+ args.append ("srm");
+ args.append ("-rv");
if (this.fast) {
- args += "-f";
+ args.append ("-f");
}
this.n_files = 0;
- foreach (string path in this._paths) {
- args += path;
+ foreach (unowned string path in this._paths) {
+ args.append (path);
this.n_files++;
}
- args += null;
if (this.n_files == 0) {
throw new AsyncOperationError.ARGS_ERROR ("Nothing to remove");
diff --git a/gsecuredelete/fill-operation.vala b/gsecuredelete/fill-operation.vala
index 585aaf4..7604b62 100644
--- a/gsecuredelete/fill-operation.vala
+++ b/gsecuredelete/fill-operation.vala
@@ -48,22 +48,21 @@ namespace SecureDelete
}
/* builds the argument vector */
- private override string?[] build_args ()
+ private override List<string> build_args ()
throws AsyncOperationError
{
+ List<string> args = null;
+
if (this.directory == null) {
throw new AsyncOperationError.ARGS_ERROR ("Missing directory to fill");
}
- string?[] args = {
- "sfill",
- "-v"
- };
+ args.append ("sfill");
+ args.append ("-v");
if (this.fast) {
- args += "-f";
+ args.append ("-f");
}
- args += this.directory;
- args += null;
+ args.append (this.directory);
return args;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/libgsecuredelete.git
More information about the Pkg-privacy-commits
mailing list