File: wvassert.cc

package info (click to toggle)
wvstreams 4.4.1-1.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,148 kB
  • ctags: 8,556
  • sloc: cpp: 64,151; ansic: 8,188; sh: 5,994; makefile: 498; perl: 277; tcl: 114
file content (43 lines) | stat: -rw-r--r-- 1,016 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Worldvisions Weaver Software:
 *   Copyright (C) 2005 Net Integration Technologies, Inc.
 *
 * Helper classes and functions to add more information to WvCrashes.
 */

#include "wvassert.h"

WvCrashWill::WvCrashWill(const char *will)
    : old_will(wvcrash_read_will())
{
    wvcrash_leave_will(will);
}

WvCrashWill::WvCrashWill(WVSTRING_FORMAT_DEFN)
    : old_will(wvcrash_read_will())
{
    // We use a WvFastString here, because it is a temporary.  init()
    // will duplicate the string into a local buffer, so don't you
    // worry.
    wvcrash_leave_will(WvFastString(WVSTRING_FORMAT_CALL));
}

void WvCrashWill::rewrite(const char *will)
{
    // Don't touch old_will.
    wvcrash_leave_will(will);
}

void WvCrashWill::rewrite(WVSTRING_FORMAT_DEFN)
{
    // Again, since wvcrash_leave_will will duplicate the string, we
    // can use a WvFastString.
    rewrite(WvFastString(WVSTRING_FORMAT_CALL));
}

WvCrashWill::~WvCrashWill()
{
    // Put the old will back.
    wvcrash_leave_will(old_will);
}