Use vector for dynamic memory in sample (closes #612) #616

Merged
merged 1 commit into from Dec 14, 2016

Projects

None yet

5 participants

@nathan-russell
Contributor

This replaces the use of alloca, Calloc, and Free with std::vector.

@@ -13,6 +13,7 @@ RnwWeave: Sweave
LaTeX: pdfLaTeX
AutoAppendNewline: Yes
+StripTrailingWhitespace: Yes
@@ -1,8 +1,13 @@
-2016-12-13 Nathan Russell <russell.nr2012@gmail.com>
+2016-12-14 Nathan Russell <russell.nr2012@gmail.com>
-
-// In order to mirror the behavior of `base::sample`
-// as closely as possible, this file contains adaptations
+#include <vector>
@eddelbuettel
eddelbuettel Dec 14, 2016 Member

Code below looks good. I trust the tests...

@codecov-io

Current coverage is 62.42% (diff: 100%)

Merging #616 into master will not change coverage

@@             master       #616   diff @@
==========================================
  Files            69         69          
  Lines          4798       4798          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits           2995       2995          
  Misses         1803       1803          
  Partials          0          0          

Powered by Codecov. Last update 2a0d5b3...0e38823

@eddelbuettel eddelbuettel merged commit e4ca728 into RcppCore:master Dec 14, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jeroenooms

Much better :)

Member

Yep :)

We'll get back to strict headers too. But other meat on the plate as well...

Contributor

LGTM as well.

(I wish it were possible to create a std::vector of some size without zero-initializing it, though -- although I doubt it has a meaningful cost here.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment