Commit dbeeb957 authored by Seong-Joong Kim's avatar Seong-Joong Kim

file: Simplify file_storage_get_basestore_for_username() usage

file_storage_get_basestore_for_username() can never fail, so simplify
its callers by removing the error checking.
parent 5e764412
Pipeline #19458 passed with stage
in 5 minutes and 7 seconds
......@@ -82,12 +82,9 @@ static char *get_path_to_print_dscv(struct fp_dscv_dev *dev, enum fp_finger fing
fp_dscv_dev_get_devtype(dev), finger, base_store);
}
static int file_storage_get_basestore_for_username(const char *username, char **base_store)
static char *file_storage_get_basestore_for_username(const char *username)
{
char *dirpath = FILE_STORAGE_PATH;
*base_store = g_build_filename(dirpath, username, NULL);
return 0;
return g_build_filename(FILE_STORAGE_PATH, username, NULL);
}
/* if username == NULL function will use current username */
......@@ -101,10 +98,7 @@ int file_storage_print_data_save(struct fp_print_data *data,
char *base_store = NULL;
char *buf = NULL;
r = file_storage_get_basestore_for_username(username, &base_store);
if (r < 0)
goto out;
base_store = file_storage_get_basestore_for_username(username);
len = fp_print_data_get_data(data, (guchar **) &buf);
if (!len) {
......@@ -173,11 +167,7 @@ int file_storage_print_data_load(struct fp_dev *dev,
int r;
char *base_store = NULL;
r = file_storage_get_basestore_for_username(username, &base_store);
if (r < 0) {
return r;
}
base_store = file_storage_get_basestore_for_username(username);
path = get_path_to_print(dev, finger, base_store);
r = load_from_file(path, &fdata);
......@@ -201,11 +191,7 @@ int file_storage_print_data_delete(struct fp_dscv_dev *dev,
int r;
char *base_store;
r = file_storage_get_basestore_for_username(username, &base_store);
if (r < 0) {
return r;
}
base_store = file_storage_get_basestore_for_username(username);
gchar *path = get_path_to_print_dscv(dev, finger, base_store);
......@@ -258,12 +244,7 @@ GSList *file_storage_discover_prints(struct fp_dscv_dev *dev, const char *userna
char *storedir = NULL;
int r;
r = file_storage_get_basestore_for_username(username, &base_store);
if (r < 0) {
return NULL;
}
base_store = file_storage_get_basestore_for_username(username);
storedir = get_path_to_storedir(fp_driver_get_driver_id(fp_dscv_dev_get_driver(dev)),
fp_dscv_dev_get_devtype(dev), base_store);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment