Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:vlefebvre:unified
systemd
2006-libefi-util-introduce-strv_length-for-char...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2006-libefi-util-introduce-strv_length-for-char16_t.patch of Package systemd
From 924f7800bdf78c9357ef208bdd9dab4dd69f616e Mon Sep 17 00:00:00 2001 From: Raito Bezarius <masterancpp@gmail.com> Date: Sat, 8 Jul 2023 20:10:03 +0200 Subject: [PATCH 6/7] libefi(util): introduce `strv_length` for char16_t With improved const-correctness across the previous users. --- src/boot/efi/device-path-util.c | 7 +++++-- src/boot/efi/device-path-util.h | 2 +- src/fundamental/string-util-fundamental.h | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/boot/efi/device-path-util.c b/src/boot/efi/device-path-util.c index d4d2b974bc..876fb30643 100644 --- a/src/boot/efi/device-path-util.c +++ b/src/boot/efi/device-path-util.c @@ -4,11 +4,14 @@ #include "util.h" EFI_STATUS make_multiple_file_device_path( - EFI_HANDLE device, const char16_t **files, EFI_DEVICE_PATH ***ret_dp) { + EFI_HANDLE device, + char16_t * const *files, + EFI_DEVICE_PATH ***ret_dp) { + EFI_STATUS err; EFI_DEVICE_PATH *cur_dp = NULL, **iterator_dp = NULL; EFI_DEVICE_PATH *original_device_path = NULL; - size_t n_files = strv_length((const void**)files); + size_t n_files = strv_length(files); assert(files); assert(ret_dp); diff --git a/src/boot/efi/device-path-util.h b/src/boot/efi/device-path-util.h index 5071b44016..db0966d3cd 100644 --- a/src/boot/efi/device-path-util.h +++ b/src/boot/efi/device-path-util.h @@ -3,7 +3,7 @@ #include "proto/device-path.h" -EFI_STATUS make_multiple_file_device_path(EFI_HANDLE device, const char16_t **files, EFI_DEVICE_PATH +EFI_STATUS make_multiple_file_device_path(EFI_HANDLE device, char16_t * const *files, EFI_DEVICE_PATH ***ret_dp); EFI_STATUS make_file_device_path(EFI_HANDLE device, const char16_t *file, EFI_DEVICE_PATH **ret_dp); EFI_STATUS device_path_to_str(const EFI_DEVICE_PATH *dp, char16_t **ret); diff --git a/src/fundamental/string-util-fundamental.h b/src/fundamental/string-util-fundamental.h index 9019542b16..05f4ff98c1 100644 --- a/src/fundamental/string-util-fundamental.h +++ b/src/fundamental/string-util-fundamental.h @@ -102,6 +102,21 @@ static inline void *memory_startswith(const void *p, size_t sz, const sd_char *t #define STRV_FOREACH(s, l) \ _STRV_FOREACH(s, l, UNIQ_T(i, UNIQ)) +#if SD_BOOT +static inline size_t strv_length(char16_t * const *l) { + size_t n = 0; + + if (l == NULL) + return 0; + + STRV_FOREACH(i, l) + n++; + + return n; +} +#endif + + static inline bool ascii_isdigit(sd_char a) { /* A pure ASCII, locale independent version of isdigit() */ return a >= '0' && a <= '9'; -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor