Updated libsharp to commit 0787838ab3ec8afc0c28b98479a321ffba388980

This commit is contained in:
Guilhem Lavaux 2016-11-04 18:14:49 +01:00
parent a933430c60
commit 23aa450a77
62 changed files with 5075 additions and 11205 deletions

View file

@ -113,10 +113,10 @@ void util_free_ (void *ptr);
#define ALLOC2D(ptr,type,num1,num2) \
do { \
size_t cnt_, num1_=(num1), num2_=(num2); \
ALLOC(ptr,type *,num1_); \
ALLOC(ptr[0],type,num1_*num2_); \
ALLOC((ptr),type *,num1_); \
ALLOC((ptr)[0],type,num1_*num2_); \
for (cnt_=1; cnt_<num1_; ++cnt_) \
ptr[cnt_]=ptr[cnt_-1]+num2_; \
(ptr)[cnt_]=(ptr)[cnt_-1]+num2_; \
} while(0)
#define DEALLOC2D(ptr) \
do { if(ptr) DEALLOC((ptr)[0]); DEALLOC(ptr); } while(0)

View file

@ -38,7 +38,8 @@ double residentSetSize(void)
FILE *statm = fopen("/proc/self/statm","r");
double res;
if (!statm) return -1.0;
fscanf(statm,"%*f %lf",&res);
if (fscanf(statm,"%*f %lf",&res))
{ fclose(statm); return -1.0; }
fclose(statm);
return (res*4096);
}
@ -55,8 +56,8 @@ double VmHWM(void)
{ fclose(f); return -1.0; }
if (!strncmp(word, "VmHWM:", 6))
{
fscanf(f,"%lf",&res);
fscanf(f,"%2s",word);
if (fscanf(f,"%lf%2s",&res,word)<0)
{ fclose(f); return -1.0; }
if (strncmp(word, "kB", 2))
{ fclose(f); return -1.0; }
res *=1024;