[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 5aeab80: Warp: checking for option value exist
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 5aeab80: Warp: checking for option value existance before its contents |
Date: |
Mon, 22 Jul 2019 12:36:26 -0400 (EDT) |
branch: master
commit 5aeab80b9e55d88b0e73376f2293be916ac9ef8e
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Warp: checking for option value existance before its contents
The `ui_add_to_modular_warps_ll' function was in charge of preparing the
individual warping parameters into a final matrix. Until now, it would
assume that all the functions have an argument (to make sure that its not
an empty string). But we had forgot to account for the `--align' option
that doesn't take an argument.
With this commit, the check for the contents of the argument is only done
when an argument is actually given.
---
bin/warp/ui.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/bin/warp/ui.c b/bin/warp/ui.c
index 20893d6..da77151 100644
--- a/bin/warp/ui.c
+++ b/bin/warp/ui.c
@@ -224,8 +224,11 @@ ui_add_to_modular_warps_ll(struct argp_option *option,
char *arg,
gal_data_t *new;
struct warpparams *p=(struct warpparams *)params;
- /* Make sure we actually have a string to parse. */
- if(*arg=='\0')
+ /* When an argument is necessary (note that `--align' doesn't take an
+ argument), make sure we actually have a string to parse. Also note
+ that if an argument is necessary, but none is given Argp will
+ automatically abort the program with an informative error. */
+ if(arg && *arg=='\0')
error(EXIT_FAILURE, 0, "empty string given to `--%s'", option->name);
/* Parse the (possible) arguments. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 5aeab80: Warp: checking for option value existance before its contents,
Mohammad Akhlaghi <=