monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] net.venge.monotone: 046b3d9c482da33053f4f97221


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone: 046b3d9c482da33053f4f97221237d0d1498b72f
Date: Tue, 23 Nov 2010 00:11:18 GMT

revision:            046b3d9c482da33053f4f97221237d0d1498b72f
date:                2010-11-23T00:10:47
author:              Timothy Brownawell  <address@hidden>
branch:              net.venge.monotone
changelog:
Don't rely on C99-only variable-stack-arrays.

manifest:
format_version "1"

new_manifest [ca6405c04ede3d20a4eb21d576cdbc7db8a8bcfd]

old_revision [a69b014519d54982daf0ea0ab54999b3a4e292d3]

patch "pcrewrap.cc"
 from [42611610af4de2f7d1da39bf5c023038b7590be7]
   to [096c37a8fcdbd0d4baf2434d16dea8663ecd1704]
============================================================
--- pcrewrap.cc	42611610af4de2f7d1da39bf5c023038b7590be7
+++ pcrewrap.cc	096c37a8fcdbd0d4baf2434d16dea8663ecd1704
@@ -152,8 +152,17 @@ namespace pcre
     cap_count += 1;
 
     int worksize = cap_count * 3;
-    // yes, C99 only
-    int ovector[worksize];
+
+    // "int ovector[worksize]" is C99 only (not valid C++, but allowed by gcc/clang)
+    // boost::shared_array is I think not plannned to be part of C++0x
+    class xyzzy {
+      int *data;
+    public:
+      xyzzy(int len) : data(new int[len]) {}
+      ~xyzzy() { delete[] data; }
+      operator int*() { return data; }
+    } ovector(worksize);
+
     rc = pcre_exec(basedat, extradat,
                    subject.data(), subject.size(),
                    0, flags_to_internal(options), ovector, worksize);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]