Blame support/blob_repeat.h

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