MCPcopy Create free account
hub / github.com/Singular/Singular / _omDebugStrDup

Function _omDebugStrDup

omalloc/omDebug.c:231–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229}
230
231char* _omDebugStrDup(const char* addr, OM_TFL_DECL)
232{
233#if 0
234 unsigned long size;
235#endif
236 unsigned long i=0;
237 char* ret;
238 OM_R_DEF;
239
240 if (addr == NULL)
241 {
242 omReportAddrError(omError_NotString, omError_NoError, (char *)addr, 0, 0, OM_FLR_VAL, "NULL String");
243 return NULL;
244 }
245 track = MAX(track, om_Opts.MinTrack);
246 track = MIN(track, om_Opts.MaxTrack);
247
248#if 0
249 // this breaks if SizeOfAddr(addr) > PAGESIZE
250 if (omIsBinPageAddr(addr))
251 {
252 size = omSizeOfAddr(addr);
253 }
254 else
255 {
256 size = ULONG_MAX;
257 }
258#endif
259 while ((addr[i] != '\0') /* && (i < size)*/) i++;
260// there seems to be no way to check if it is really a string
261#if 0
262 if (i == size)
263 {
264 omReportAddrError(omError_NotString, omError_NoError, addr, 0, 0, OM_FLR_VAL, "Not 0 terminated");
265 i = size-1;
266 }
267#endif
268 ret = __omDebugAlloc((char*)i+1, OM_FSIZE, track, OM_FLR_VAL);
269 memcpy(ret, addr, i);
270 ret[i] = '\0';
271
272#ifdef OM_INTERNAL_DEBUG
273 (void) _omCheckAddr(ret, (void*)i+1,OM_FUSED|OM_FSIZE,om_Opts.MinCheck, omError_InternalBug, OM_FLR);
274#endif
275 return ret;
276}
277
278omError_t _omDebugAddr(void* addr, void* bin_size, omTrackFlags_t flags, OM_CFL_DECL)
279{

Callers

nothing calls this directly

Calls 4

omReportAddrErrorFunction · 0.85
omSizeOfAddrFunction · 0.85
__omDebugAllocFunction · 0.85
_omCheckAddrFunction · 0.85

Tested by

no test coverage detected