Comments (9)
Can you write that as a macro? As inline is not supported on all compilers, and I'd hate to make those slow just because gcc can do a better job
from text-csv_xs.
@pali do you have a test case that fails under the current code?
from text-csv_xs.
For test case you need to take scalar which do not have SVs_RMG, but has SVs_GMG. Then mg_get() would never be called.
from text-csv_xs.
Can you write that as a macro?
Yes, just rewrite commands via standard boolean logic into one if statement. E.g.:
#define _is_arrayref(sv) ((sv) && (SvGETMAGICAL(sv), 1) && (SvROK(sv)) && (SvTYPE(SvRV(sv)) == SVt_PVAV))
from text-csv_xs.
#define _is_reftype(f,x) \
(f && (SvGETMAGIC (f), 1) && SvROK (f) && SvTYPE (SvRV (f)) == x)
#define _is_arrayref(f) _is_reftype (f, SVt_PVAV)
#define _is_hashref(f) _is_reftype (f, SVt_PVHV)
#define _is_coderef(f) _is_reftype (f, SVt_PVCV)
Still passed all tests. I could not come up with a new test in t/76_magic.t
to probe the old code was wrong, but this looks cleaner anyway.
BTW it is SvGETMAGIC (sv)
not SvGETMAGICAL (sv)
.
See 0fafcee
from text-csv_xs.
For example magic variable $$
has GMG and does not have RMG. But it is not reference. I do not know currently which internal perl variable is magic, reference and also without RMG.
from text-csv_xs.
Sure, but I still could not (yet) come up with a test :)
from text-csv_xs.
Change passed all tests on all 200+ perl versions I have that should be supported and all 858 modules on CPAN that directly or indirectly depend on my still pass. The speed test did not show a slowdown.
Just have to check on the other architectures, and it will be on its way to CPAN.
Thanks again for your input and feedback.
from text-csv_xs.
Released in 1.37. Closing
from text-csv_xs.
Related Issues (20)
- csv() cannot have both in and out be filenames HOT 3
- Wishlist: ability to throw exception if formula seen in CSV HOT 8
- Add an option to the csv function to neither return nor print anything HOT 3
- Add support for configurable NULL encoding HOT 7
- csv2xls does not like (nearly) empty files HOT 3
- Calling $csv->header breaks auto_diag in 1.40 HOT 8
- csv munge_column_names function fails with sep=; header HOT 1
- getter quote_char() and escape_char() returning 0 instead of undef HOT 5
- Can't parse fields with nested quotes and commas HOT 2
- Offer option to not put empty columns into hashes created HOT 1
- Procedure (or method) returning the error text HOT 2
- csv in => $aoa, out => … produces a CSV file with two empty records when $aoa is empty HOT 2
- Turn off column naming munging HOT 2
- Multiple spaces as a separator? HOT 3
- Typo in sub csv() causes sep chars set to not work HOT 2
- getline_all does not understand scientific ("e") notation HOT 2
- BOM without a header line. HOT 6
- FR: Reading multiple CSVs from a single file HOT 6
- skip empty or blank HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from text-csv_xs.