Permalink
Browse files

petscsys.h: find memcpy and memset in string.h

C89 and later say that memcpy and memset are in string.h.  With glibc,
memory.h merely includes string.h, and one user reported an error due to
undefined memset (which I cannot reproduce).  So quit bothering with
nonstandard memory.h and just include string.h.

Reported-by: Alexander Krimm <alex@wirew0rm.de>
  • Loading branch information...
1 parent 345246f commit a3aaec0ab474bb386780073594fdc8ac7d2aa0be @jedbrown jedbrown committed Jan 9, 2014
Showing with 2 additions and 4 deletions.
  1. +1 −1 config/PETSc/Configure.py
  2. +1 −3 include/petscsys.h
@@ -89,7 +89,7 @@ def setupDependencies(self, framework):
self.mpi.headerPrefix = self.headerPrefix
headersC = map(lambda name: name+'.h', ['setjmp','dos', 'endian', 'fcntl', 'float', 'io', 'limits', 'malloc', 'pwd', 'search', 'strings',
'unistd', 'sys/sysinfo', 'machine/endian', 'sys/param', 'sys/procfs', 'sys/resource',
- 'sys/systeminfo', 'sys/times', 'sys/utsname','string', 'stdlib','memory',
+ 'sys/systeminfo', 'sys/times', 'sys/utsname','string', 'stdlib',
'sys/socket','sys/wait','netinet/in','netdb','Direct','time','Ws2tcpip','sys/types',
'WindowsX', 'cxxabi','float','ieeefp','stdint','sched','pthread','mathimf'])
functions = ['access', '_access', 'clock', 'drand48', 'getcwd', '_getcwd', 'getdomainname', 'gethostname',
View
@@ -1572,9 +1572,7 @@ PETSC_EXTERN PetscErrorCode PetscRealView(PetscInt,const PetscReal[],PetscViewer
PETSC_EXTERN PetscErrorCode PetscScalarView(PetscInt,const PetscScalar[],PetscViewer);
#include <stddef.h>
-#if defined(PETSC_HAVE_MEMORY_H)
-#include <memory.h>
-#endif
+#include <string.h> /* for memcpy, memset */
#if defined(PETSC_HAVE_STDLIB_H)
#include <stdlib.h>
#endif

0 comments on commit a3aaec0

Please sign in to comment.