Browse Source

[1407] Cleanups

Michal 'vorner' Vaner 13 years ago
parent
commit
207038a3ff
2 changed files with 9 additions and 18 deletions
  1. 8 14
      src/lib/dns/python/rdata_python.cc
  2. 1 4
      src/lib/dns/python/tests/rdata_python_test.py

+ 8 - 14
src/lib/dns/python/rdata_python.cc

@@ -100,31 +100,25 @@ Rdata_init(s_Rdata* self, PyObject* args) {
                                        input_buffer, len);
             return (0);
         }
-    }
-    catch (const isc::dns::rdata::InvalidRdataText& irdt) {
+    } catch (const isc::dns::rdata::InvalidRdataText& irdt) {
         PyErr_SetString(po_InvalidRdataText, irdt.what());
         return (-1);
-    }
-    catch (const isc::dns::rdata::InvalidRdataLength& irdl) {
+    } catch (const isc::dns::rdata::InvalidRdataLength& irdl) {
         PyErr_SetString(po_InvalidRdataLength, irdl.what());
         return (-1);
-    }
-    catch (const isc::dns::rdata::CharStringTooLong& cstl) {
+    } catch (const isc::dns::rdata::CharStringTooLong& cstl) {
         PyErr_SetString(po_CharStringTooLong, cstl.what());
         return (-1);
-    }
-    catch (const isc::dns::DNSMessageFORMERR& dmfe) {
+    } catch (const isc::dns::DNSMessageFORMERR& dmfe) {
         PyErr_SetString(po_DNSMessageFORMERR, dmfe.what());
         return (-1);
-    }
-    // FIXME: These exceptions are not tested, I don't know how or if
-    // at all they can be triggered. But they are caught just in the case.
-    catch (const std::exception& ex) {
+    } catch (const std::exception& ex) {
+        // FIXME: These exceptions are not tested, I don't know how or if
+        // at all they can be triggered. But they are caught just in the case.
         PyErr_SetString(PyExc_Exception, (std::string("Unknown exception: ") +
                         ex.what()).c_str());
         return (-1);
-    }
-    catch (...) {
+    } catch (...) {
         PyErr_SetString(PyExc_Exception, "Unknown exception");
         return (-1);
     }

+ 1 - 4
src/lib/dns/python/tests/rdata_python_test.py

@@ -37,11 +37,8 @@ class RdataTest(unittest.TestCase):
         self.assertRaises(TypeError, Rdata, RRType("A"), RRClass("IN"), 1)
         self.assertRaises(InvalidRdataText, Rdata, RRType("A"), RRClass("IN"),
                           "Invalid Rdata Text")
-        s = ""
-        for i in range(0, 256):
-            s += ' '
         self.assertRaises(CharStringTooLong, Rdata, RRType("TXT"),
-                          RRClass("IN"), s)
+                          RRClass("IN"), ' ' * 256)
         self.assertRaises(InvalidRdataLength, Rdata, RRType("TXT"),
                           RRClass("IN"), bytes(65536))
         self.assertRaises(DNSMessageFORMERR, Rdata, RRType("TXT"),