From 2cbda0cfe46ddbda4deba96aadd162e02fc8dc9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 15 Nov 2009 20:04:05 +0100 Subject: [PATCH] Manual: Minor refactorings. Added a simple build script --- man/buildman.sh | 8 ++++++++ man/manual.docbook | 20 +++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 man/buildman.sh diff --git a/man/buildman.sh b/man/buildman.sh new file mode 100755 index 000000000..2be77f898 --- /dev/null +++ b/man/buildman.sh @@ -0,0 +1,8 @@ +#/bin/sh + +xsltproc -o manual.html /usr/share/xml/docbook/stylesheet/nwalsh/xhtml/docbook.xsl manual.docbook + +xsltproc -o intermediate-fo-file.fo /usr/share/xml/docbook/stylesheet/nwalsh/fo/docbook.xsl manual.docbook + +fop -pdf manual.pdf -fo intermediate-fo-file.fo + diff --git a/man/manual.docbook b/man/manual.docbook index e0b4692ef..203ae68b8 100644 --- a/man/manual.docbook +++ b/man/manual.docbook @@ -423,6 +423,24 @@ void DestroyFred(void *p) If an exception occurs when b is allocated, a will leak. - + Here is another example: + + int *p; + +int a(int sz) +{ + delete [] p; + if (sz <= 0) + throw std::runtime_error("size <= 0"); + p = new int[sz]; +} + + Check that with Cppcheck: + + cppcheck --enable=exceptNew,exceptRealloc except2.cpp + + The output from Cppcheck is: + + [except2.cpp:7]: (error) Throwing exception in invalid state, p points at deallocated memory