Blame support/blob_repeat.h

Packit Service d34d2f
/* Repeating a memory blob, with alias mapping optimization.
Packit Service d34d2f
   Copyright (C) 2018 Free Software Foundation, Inc.
Packit Service d34d2f
   This file is part of the GNU C Library.
Packit Service d34d2f
Packit Service d34d2f
   The GNU C Library is free software; you can redistribute it and/or
Packit Service d34d2f
   modify it under the terms of the GNU Lesser General Public
Packit Service d34d2f
   License as published by the Free Software Foundation; either
Packit Service d34d2f
   version 2.1 of the License, or (at your option) any later version.
Packit Service d34d2f
Packit Service d34d2f
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service d34d2f
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service d34d2f
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service d34d2f
   Lesser General Public License for more details.
Packit Service d34d2f
Packit Service d34d2f
   You should have received a copy of the GNU Lesser General Public
Packit Service d34d2f
   License along with the GNU C Library; if not, see
Packit Service d34d2f
   <http://www.gnu.org/licenses/>.  */
Packit Service d34d2f
Packit Service d34d2f
#ifndef SUPPORT_BLOB_REPEAT_H
Packit Service d34d2f
#define SUPPORT_BLOB_REPEAT_H
Packit Service d34d2f
Packit Service d34d2f
#include <stdbool.h>
Packit Service d34d2f
#include <stddef.h>
Packit Service d34d2f
Packit Service d34d2f
struct support_blob_repeat
Packit Service d34d2f
{
Packit Service d34d2f
  void *start;
Packit Service d34d2f
  size_t size;
Packit Service d34d2f
  bool use_malloc;
Packit Service d34d2f
};
Packit Service d34d2f
Packit Service d34d2f
/* Return an allocation of COUNT elements, each of ELEMENT_SIZE bytes,
Packit Service d34d2f
   initialized with the bytes starting at ELEMENT.  The memory is
Packit Service d34d2f
   writable (and thus counts towards the commit charge).  In case of
Packit Service d34d2f
   on error, all members of the return struct are zero-initialized,
Packit Service d34d2f
   and errno is set accordingly.  */
Packit Service d34d2f
struct support_blob_repeat support_blob_repeat_allocate (const void *element,
Packit Service d34d2f
                                                         size_t element_size,
Packit Service d34d2f
                                                         size_t count);
Packit Service d34d2f
Packit Service d34d2f
/* Deallocate the blob created by support_blob_repeat_allocate.  */
Packit Service d34d2f
void support_blob_repeat_free (struct support_blob_repeat *);
Packit Service d34d2f
Packit Service d34d2f
#endif /* SUPPORT_BLOB_REPEAT_H */