Blame support/blob_repeat.h

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