Skip to content

Commit 70480d2

Browse files
committed
lib: remove xbps_file_hash_check_dictionary
1 parent c3caff4 commit 70480d2

2 files changed

Lines changed: 0 additions & 71 deletions

File tree

include/xbps_api_impl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ int HIDDEN xbps_transaction_internalize(struct xbps_handle *, xbps_object_iterat
112112

113113
char HIDDEN *xbps_get_remote_repo_string(const char *);
114114
int HIDDEN xbps_repo_sync(struct xbps_handle *, const char *);
115-
int HIDDEN xbps_file_hash_check_dictionary(struct xbps_handle *,
116-
xbps_dictionary_t, const char *, const char *);
117115
int HIDDEN xbps_file_exec(struct xbps_handle *, const char *, ...);
118116
void HIDDEN xbps_set_cb_fetch(struct xbps_handle *, off_t, off_t, off_t,
119117
const char *, bool, bool, bool);

lib/util_hash.c

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -209,72 +209,3 @@ xbps_file_sha256_check(const char *file, const char *sha256)
209209

210210
return 0;
211211
}
212-
213-
static const char *
214-
file_hash_dictionary(xbps_dictionary_t d, const char *key, const char *file)
215-
{
216-
xbps_object_t obj;
217-
xbps_object_iterator_t iter;
218-
const char *curfile = NULL, *sha256 = NULL;
219-
220-
assert(xbps_object_type(d) == XBPS_TYPE_DICTIONARY);
221-
assert(key != NULL);
222-
assert(file != NULL);
223-
224-
iter = xbps_array_iter_from_dict(d, key);
225-
if (iter == NULL) {
226-
errno = ENOENT;
227-
return NULL;
228-
}
229-
while ((obj = xbps_object_iterator_next(iter)) != NULL) {
230-
xbps_dictionary_get_cstring_nocopy(obj,
231-
"file", &curfile);
232-
if (strcmp(file, curfile) == 0) {
233-
/* file matched */
234-
xbps_dictionary_get_cstring_nocopy(obj,
235-
"sha256", &sha256);
236-
break;
237-
}
238-
}
239-
xbps_object_iterator_release(iter);
240-
if (sha256 == NULL)
241-
errno = ENOENT;
242-
243-
return sha256;
244-
}
245-
246-
int HIDDEN
247-
xbps_file_hash_check_dictionary(struct xbps_handle *xhp,
248-
xbps_dictionary_t d,
249-
const char *key,
250-
const char *file)
251-
{
252-
const char *sha256d = NULL;
253-
char *buf;
254-
int rv;
255-
256-
assert(xbps_object_type(d) == XBPS_TYPE_DICTIONARY);
257-
assert(key != NULL);
258-
assert(file != NULL);
259-
260-
if ((sha256d = file_hash_dictionary(d, key, file)) == NULL) {
261-
if (errno == ENOENT)
262-
return 1; /* no match, file not found */
263-
264-
return -1; /* error */
265-
}
266-
267-
if (strcmp(xhp->rootdir, "/") == 0) {
268-
rv = xbps_file_sha256_check(file, sha256d);
269-
} else {
270-
buf = xbps_xasprintf("%s/%s", xhp->rootdir, file);
271-
rv = xbps_file_sha256_check(buf, sha256d);
272-
free(buf);
273-
}
274-
if (rv == 0)
275-
return 0; /* matched */
276-
else if (rv == ERANGE || rv == ENOENT)
277-
return 1; /* no match */
278-
else
279-
return -1; /* error */
280-
}

0 commit comments

Comments
 (0)