|
samba unix风格的配置文件配置信息读取C代码.(8) return( ((pos >= 0) && ('\\' == line[pos])) ? pos : -1 ); } else { pos2++; } } return (-1); } void *Realloc(void *p,size_t size) /* ------------------------------------------------------------------------ ** * expand a pointer to be a particular size /* ------------------------------------------------------------------------ **/ { void *ret=NULL;
if (size == 0) { if (p) free(p); //DEBUG(5,("Realloc asked for 0 bytes\n")); return NULL; } if (!p) ret = (void *)malloc(size); else ret = (void *)realloc(p,size); if (!ret) printf("Memory allocation error: failed to expand to %d bytes\n",(int)size); return(ret); } static BOOL Section( myFILE *InFile, BOOL (*sfunc)(char *) ) /* ------------------------------------------------------------------------ ** * Scan a section name, and pass the name to function sfunc(). * * Input: InFile - Input source. * sfunc - Pointer to the function to be called if the section * name is successfully read. * * Output: True if the section name was read and True was returned from * <sfunc>. False if <sfunc> failed or if a lexical error was * encountered.
|