improve comments and avoid warnings

This commit is contained in:
Martin Reinecke 2012-10-29 10:48:18 +01:00
parent d96a30180b
commit 9f08cd5ec4
2 changed files with 9 additions and 5 deletions

View file

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

View file

@ -213,6 +213,9 @@ void sharp_destroy_geom_info (sharp_geom_info *geom_info)
DEALLOC (geom_info); DEALLOC (geom_info);
} }
/* This currently requires all m values from 0 to nm-1 to be present.
It might be worthwhile to relax this criterion such that holes in the m
distribution are permissible. */
static int sharp_get_mmax (int *mval, int nm) static int sharp_get_mmax (int *mval, int nm)
{ {
int *mcheck=RALLOC(int,nm); int *mcheck=RALLOC(int,nm);
@ -220,12 +223,12 @@ static int sharp_get_mmax (int *mval, int nm)
for (int i=0; i<nm; ++i) for (int i=0; i<nm; ++i)
{ {
int m_cur=mval[i]; int m_cur=mval[i];
UTIL_ASSERT((m_cur>=0) && (m_cur<nm), "m out of range"); UTIL_ASSERT((m_cur>=0) && (m_cur<nm), "not all m values are present");
UTIL_ASSERT(mcheck[m_cur]==0, "duplicate m value"); UTIL_ASSERT(mcheck[m_cur]==0, "duplicate m value");
mcheck[m_cur]=1; mcheck[m_cur]=1;
} }
DEALLOC(mcheck); DEALLOC(mcheck);
return nm-1; // FIXME: this looks wrong return nm-1;
} }
static void ringhelper_phase2ring (ringhelper *self, static void ringhelper_phase2ring (ringhelper *self,