本文整理汇总了C++中OStream::printf方法的典型用法代码示例。如果您正苦于以下问题:C++ OStream::printf方法的具体用法?C++ OStream::printf怎么用?C++ OStream::printf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OStream
的用法示例。
在下文中一共展示了OStream::printf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pos_to_str
void pos_to_str(Pos p, OStream & buf) {
if (p.name.empty())
buf.write("<anon>");
else
buf.write(p.name);
if (p.line == NPOS)
;//buf.write(":");
else if (p.col == NPOS)
buf.printf(":%u", p.line);
else
buf.printf(":%u:%u", p.line, p.col);
}
示例2: mem_release_all
/* Released all unfree'd memory from all pools */
void mem_release_all()
{
#if defined(MEM_RECLAIM)
OStream *f = NULL;
MEMNODE *p, *tmp;
size_t totsize;
Send_Progress("Reclaiming memory", PROGRESS_RECLAIMING_MEMORY);
p = memlist;
totsize = 0;
#if defined(MEM_TRACE)
if (p != NULL)
f = New_OStream(MEM_LOG_FNAME, POV_File_Data_LOG, true);
#endif
while (p != NULL)
{
#if defined(MEM_TRACE)
#if defined(MEM_TAG)
if (!mem_check_tag(p))
Debug_Info("mem_release_all(): Memory pointer corrupt!\n");
#endif /* MEM_TAG */
totsize += (p->size - NODESIZE - (MEM_GUARD_SIZE * 2));
if (!leak_msg)
{
Debug_Info("Memory leakage detected, see file '%s' for list\n",MEM_LOG_FNAME);
leak_msg = true;
}
if (f != NULL)
f->printf("File:%13s Line:%4d Size:%lu\n", p->file, p->line, (unsigned long)(p->size - NODESIZE - (MEM_GUARD_SIZE * 2)));
#endif
#if defined(MEM_STATS)
/* This is after we have printed stats, and this may slow us down a little, */
/* so we may want to simply re-initialize the mem-stats at the end of this loop. */
mem_stats_free(p->size);
#endif
tmp = p;
p = p->next;
remove_node(tmp);
FREE(tmp);
}
if (f != NULL)
delete f;
if (totsize > 0)
Debug_Info("\n%lu bytes reclaimed\n", totsize);
poolno = 0;
memlist = NULL;
#endif
#if defined(MEM_STATS)
/* reinitialize the stats structure for next time through */
mem_stats_init();
#endif
}
示例3: mem_release
/* Releases all unfree'd memory from current memory pool */
void mem_release()
{
#if defined(MEM_RECLAIM)
OStream *f = NULL;
MEMNODE *p, *tmp;
size_t totsize;
p = memlist;
totsize = 0;
#if defined(MEM_TRACE)
if (p != NULL && (p->poolno == poolno))
f = New_OStream(MEM_LOG_FNAME, POV_File_Data_LOG, true);
#endif /* MEM_TRACE */
while (p != NULL && (p->poolno == poolno))
{
#if defined(MEM_TRACE)
#if defined(MEM_TAG)
if (!mem_check_tag(p))
Debug_Info("mem_release(): Memory pointer corrupt!\n");
#endif /* MEM_TAG */
totsize += (p->size - NODESIZE - (MEM_GUARD_SIZE * 2));
if (!leak_msg)
{
Debug_Info("Memory leakage detected, see file '%s' for list\n",MEM_LOG_FNAME);
leak_msg = true;
}
if (f != NULL)
f->printf("File:%13s Line:%4d Size:%lu\n", p->file, p->line, (unsigned long)(p->size - NODESIZE - (MEM_GUARD_SIZE * 2)));
#endif /* MEM_TRACE */
#if defined(MEM_STATS)
mem_stats_free(p->size);
#endif
tmp = p;
p = p->next;
remove_node(tmp);
FREE(tmp);
}
if (f != NULL)
delete f;
if (totsize > 0)
Debug_Info("%lu bytes reclaimed (pool #%d)\n", totsize, poolno);
if (poolno > 0)
poolno--;
#if defined(MEM_STATS)
/* reinitialize the stats structure for next time through */
mem_stats_init();
#endif
#endif /* MEM_RECLAIM */
}