pike.git / src / pike_memory.h

version» Context lines:

pike.git/src/pike_memory.h:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information.   */      #ifndef MEMORY_H   #define MEMORY_H      #include "global.h" - #include "stralloc.h" +       #ifdef USE_VALGRIND      #define HAVE_VALGRIND_MACROS   /* Assume that any of the following header files have the macros we    * need. Haven't checked if it's true or not. */      #ifdef HAVE_MEMCHECK_H   #include <memcheck.h>   #elif defined(HAVE_VALGRIND_MEMCHECK_H)
pike.git/src/pike_memory.h:145:   struct mem_searcher   {    enum methods method;    char *needle;    size_t needlelen;    size_t hsize, max;    struct link links[MEMSEARCH_LINKS];    struct link *set[MEMSEARCH_LINKS];   };    - /* -  * The purpose of this function is to avoid dead store elimination in cases when -  * sensitive data has to be cleared from memory. -  */ - static inline void ATTRIBUTE((unused)) * guaranteed_memset(void * p, int c, size_t n) { -  volatile char * _p = (char *)p; -  while (n--) *_p++ = c; -  return (void *)p; - } + PMOD_EXPORT void secure_zero(void *p, size_t n);      #ifdef HANDLES_UNALIGNED_MEMORY_ACCESS   /* it is faster to just do the unaligned operation. */   static inline UINT64 ATTRIBUTE((unused)) get_unaligned64(const void *ptr) {    return *(UINT64*)ptr;   }      static inline unsigned INT32 ATTRIBUTE((unused)) get_unaligned32(const void *ptr) {    return *(unsigned INT32*)ptr;   }
pike.git/src/pike_memory.h:212:    unsigned INT16 v;    memcpy(&v, ptr, 2);    return v;   }      static inline void ATTRIBUTE((unused)) set_unaligned16(void * ptr, unsigned INT16 v) {    memcpy(ptr, &v, 2);   }   #endif    - #include "pike_search.h" -  - #include "block_alloc_h.h" +    extern int page_size;      /* Note to self: Prototypes must be updated manually /Hubbe */ - PMOD_EXPORT ptrdiff_t pcharp_memcmp(PCHARP a, PCHARP b, int sz) ATTRIBUTE((pure)); - PMOD_EXPORT long pcharp_strlen(PCHARP a) ATTRIBUTE((pure)); + PMOD_EXPORT long pcharp_strlen(const PCHARP a) ATTRIBUTE((pure));      #define MEMCHR0 memchr   p_wchar1 *MEMCHR1(p_wchar1 *p, p_wchar2 c, ptrdiff_t e) ATTRIBUTE((pure));   p_wchar2 *MEMCHR2(p_wchar2 *p, p_wchar2 c, ptrdiff_t e) ATTRIBUTE((pure));    - /* PMOD_EXPORT void swap(char *a, char *b, size_t size); */ - PMOD_EXPORT void reverse(char *memory, size_t nitems, size_t size); - PMOD_EXPORT void reorder(char *memory, INT32 nitems, INT32 size,INT32 *order); + void reorder(char *memory, INT32 nitems, INT32 size, const INT32 *order);      size_t hashmem_siphash24( const void *s, size_t len );   #if (defined(__i386__) || defined(__amd64__)) && defined(__GNUC__)   extern PMOD_EXPORT   #ifdef __i386__   ATTRIBUTE((fastcall))   #endif   size_t (*low_hashmem)(const void *, size_t, size_t, size_t);   #else   PMOD_EXPORT size_t low_hashmem(const void *, size_t len, size_t mlen, size_t key) ATTRIBUTE((pure));   #endif   PMOD_EXPORT size_t hashmem(const void *, size_t len, size_t mlen) ATTRIBUTE((pure)); - /* - PMOD_EXPORT void memfill(char *to, -  INT32 tolen, -  char *from, -  INT32 fromlen, -  INT32 offset); - */ +    #define MALLOC_FUNCTION ATTRIBUTE((malloc)) PIKE_WARN_UNUSED_RESULT_ATTRIBUTE      PMOD_EXPORT void *debug_xalloc(size_t size) MALLOC_FUNCTION;   PMOD_EXPORT void *debug_xmalloc(size_t s) MALLOC_FUNCTION;   PMOD_EXPORT void debug_xfree(void *mem);   PMOD_EXPORT void *debug_xrealloc(void *m, size_t s) MALLOC_FUNCTION;   PMOD_EXPORT void *debug_xcalloc(size_t n, size_t s) MALLOC_FUNCTION;   PMOD_EXPORT void *xalloc_aligned(size_t size, size_t alignment) MALLOC_FUNCTION;      #define PIKE_ALIGNTO(x, a) (((x) + (a)-1) & ~((a)-1))
pike.git/src/pike_memory.h:269:   PMOD_EXPORT void *mexec_realloc(void *ptr, size_t sz) MALLOC_FUNCTION;   PMOD_EXPORT void mexec_free(void *ptr);   void init_pike_memory (void);   void exit_pike_memory (void);      #ifdef DEBUG_MALLOC   PMOD_EXPORT void * system_malloc(size_t) MALLOC_FUNCTION;   PMOD_EXPORT void system_free(void *);   #endif    - #undef BLOCK_ALLOC -  +    #ifdef HANDLES_UNALIGNED_MEMORY_ACCESS   #define DO_IF_ELSE_UNALIGNED_MEMORY_ACCESS(IF, ELSE) IF   #else /* !HANDLES_UNALIGNED_MEMORY_ACCESS */   #define DO_IF_ELSE_UNALIGNED_MEMORY_ACCESS(IF, ELSE) ELSE   #endif /* HANDLES_UNALIGNED_MEMORY_ACCESS */      /* Determine if we should use our own heap manager for executable    * memory. */   #if defined(MEXEC_USES_MMAP) || defined (_WIN32)   #define USE_MY_MEXEC_ALLOC   #endif      #endif