aboutsummaryrefslogtreecommitdiff
path: root/nss/nss_action_parse.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2020-11-09 22:06:57 -0500
committerDJ Delorie <dj@redhat.com>2020-12-04 17:15:53 -0500
commitf8847d83e17774ed5e9c0f75ef693680b91bcae4 (patch)
treee67c662ee3cc09742242c19a253b5b62bbaa3ee7 /nss/nss_action_parse.c
parentfa78feca47fdc226b46e7f6fea4c08c10fccd182 (diff)
downloadglibc-f8847d83e17774ed5e9c0f75ef693680b91bcae4.zip
glibc-f8847d83e17774ed5e9c0f75ef693680b91bcae4.tar.gz
glibc-f8847d83e17774ed5e9c0f75ef693680b91bcae4.tar.bz2
nsswitch: use new internal API (core)
Core changes to switch the NSS internals to use the new API. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'nss/nss_action_parse.c')
-rw-r--r--nss/nss_action_parse.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/nss/nss_action_parse.c b/nss/nss_action_parse.c
index 1a7643a..15c63a8 100644
--- a/nss/nss_action_parse.c
+++ b/nss/nss_action_parse.c
@@ -16,8 +16,7 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#include "nss_action.h"
-#include "nss_module.h"
+#include <nsswitch.h>
#include <ctype.h>
#include <string.h>
@@ -169,18 +168,13 @@ nss_action_list
action_list_init (&list);
if (nss_action_parse (line, &list))
{
- size_t size = action_list_size (&list);
- nss_action_list result
- = malloc (sizeof (*result) * (size + 1));
- if (result == NULL)
- {
- action_list_free (&list);
- return NULL;
- }
- memcpy (result, action_list_begin (&list), sizeof (*result) * size);
- /* Sentinel. */
- result[size].module = NULL;
- return result;
+ size_t size;
+ struct nss_action null_service
+ = { .module = NULL, };
+
+ action_list_add (&list, null_service);
+ size = action_list_size (&list);
+ return __nss_action_allocate (action_list_begin (&list), size);
}
else if (action_list_has_failed (&list))
{