-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert most size_t values to tsk_size_t. #1579
Convert most size_t values to tsk_size_t. #1579
Conversation
Clarify the conventions around using size_t vs tsk_size_t Closes tskit-dev#1573
c082e34
to
4994924
Compare
Codecov Report
@@ Coverage Diff @@
## main #1579 +/- ##
=======================================
Coverage 93.60% 93.60%
=======================================
Files 27 27
Lines 23033 23035 +2
Branches 1079 1079
=======================================
+ Hits 21559 21561 +2
Misses 1440 1440
Partials 34 34
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
Searching through for other size_t
that should be tsk_size_t
these stand out, unless I've misunderstood:
tables.c:7953
tables.c:8230
<-- Seems overflow unsafe, but very unlikely to be an issue?
tables.c:9864
Thanks @benjeffery!
num_sites is being used as the argument to malloc and memcpy, so size_t is correct. I guess there's a potential overflow with the
Similarly, There's probably a bunch of tricky overflows around the code to be honest if people are working with large tables on a 32 bit system, because of all the
So, I think we're good? |
Ok, seems my misunderstanding is was parsing "computing memory block sizes" as "counting bytes". |
Clarify the conventions around using size_t vs tsk_size_t
Closes #1573
Removes (nearly) all size_t values from the public API, and clarifies how we should use them within the library. This is a good step towards 1.0 I think, and should clear up some of the mess on 32 bit machines when we have 64 bit tsk_size_t.