summaryrefslogtreecommitdiff
path: root/util.c
Commit message (Collapse)AuthorAgeFilesLines
* Restore null checks to stashpv_hvname_match [perl #101430]Father Chrysostomos2011-10-161-0/+2
| | | | | | Commit aa33328e8 inadvertently removed the null checks from stashpv_hvname_match when adding UTF8 support, resulting in crashes it List::Gen’s test suite.
* util.c UTF8 cleanupBrian Fraser2011-10-061-12/+17
|
* util.c for threads: stashpv_hvname_match UTF8 cleanup.Brian Fraser2011-10-061-7/+16
|
* Don't #include headers already included by perl.hNicholas Clark2011-09-151-4/+0
| | | | | | | | | 097ee67dff1c60f2 didn't need to include <locale.h> in locale.c (then util.c) because it had been included by perl.h since 5.002 beta 1 3f270f98f9305540 missed removing the include of <unistd.h> from perl.c or perlio.c de8ca8af19546d49 changed perl.h to also include <sys/wait.h>, but didn't notice that it code therefore be removed from perl.c, pp_sys.c and util.c
* Convert some files from Latin-1 to UTF-8Keith Thompson2011-09-071-1/+1
|
* Eliminate global.sym, as makedef.pl can generate it internally.Nicholas Clark2011-08-251-1/+1
| | | | | | | | global.sym was a file listing the exported symbols, generated by regen/embed.pl from embed.fnc and regen/opcodes, which was only used by makedef.pl Move the code that generates global.sym from regen/embed.pl to makedef.pl, and thereby eliminate the need to ship a 907 line generated file.
* Simplify embedvar.h, removing a level of macro indirection for PL_* variables.Nicholas Clark2011-08-111-4/+4
| | | | | | | For the default (non-multiplicity) configuration, PERLVAR*() macros now directly expand their arguments to tokens such as C<PL_defgv>, instead of expanding to C<PL_Idefgv>. This removes over 350 lines from F<embedvar.h>, which defined macros to map from C<PL_Idefgv> to C<PL_defgv> and so forth.
* Revise check for negative versions plus testJohn Peacock2011-07-011-3/+5
|
* For shorter strings, store C<study>'s data as U8s or U16s, instead of U32s.Nicholas Clark2011-07-011-16/+69
| | | | | | | The assumption is that most studied strings are fairly short, hence the pain of the extra code is worth it, given the memory savings. 80 character string, 336 bytes as U8, down from 1344 as U32 800 character string, 2112 bytes as U16, down from 4224 as U32
* Store C<study>'s data as U32s, instead of I32s.Nicholas Clark2011-07-011-10/+11
| | | | The "no more" condition is now represented as ~0, instead of -1.
* Tidy code in pp_study and Perl_screaminstr()Nicholas Clark2011-07-011-7/+7
| | | | | | | | | In pp_study eliminate the variable pos, which duplicates len. ch should be U8, not I32. In Perl_screaminstr(), move the declarations of s and x to their point of use, convert a for loop to a while loop, and avoid incrementing and decrementing s. found is a boolean.
* Store C<study>'s data in in mg_ptr instead of interpreter variables.Nicholas Clark2011-07-011-2/+10
| | | | | This allows more than one C<study> to be active at the same time. It eliminates PL_screamfirst, PL_lastscream, PL_maxscream.
* Merge PL_scream{first,next} into one allocated buffer.Nicholas Clark2011-07-011-3/+4
| | | | | Effectively, PL_screamnext is now PL_screamfirst + 256. The actual interpreter variable PL_screamnext is eliminated.
* Change PL_screamnext to store absolute positions.Nicholas Clark2011-07-011-16/+18
| | | | | | | | | | PL_screamnext gives the position of the next occurrence of the current octet. Previously it stored this as an offset from the current position, with -pos stored for "no more", so that the calculated new offset would be zero, allowing a zero/non-zero loop exit test in Perl_screaminstr(). Now it stores absolute position, with -1 for "no more". Also codify -1 as the "not present" value for PL_screamfirst, instead of any negative value.
* Report a better error when trying to use negative version numbers instead of ↵Claes Jakobsson2011-06-301-0/+3
| | | | 'Invalid version format (non-numeric data)' as it currently does. Also update documentation that version should be a positive number.
* Move PL_{No,Yes,hexdigit} from perlvars.h to perl.h, as all are const char[]Nicholas Clark2011-06-121-3/+0
| | | | | | | | | | | They were converted in perl.h from const char[] to #define in 31fb120917c4f65d, then re-instated as const char[], but in perlvars.h, in 3fe35a814d0a98f4. There's no need for compile-time constants to jump through the hoops of perlvars.h, even for Symbian, as the various "EXTCONST" variables already in perl.h demonstrate. These were the only 3 users of the the PERLVARISC macro, so eliminate that, and all related code.
* Refactor Perl_get_vtbl() to a small array lookup from a large switch statement.Nicholas Clark2011-06-111-95/+2
| | | | Provide magic_vtable_max, the number of elements in PL_magic_vtables[].
* Abolish PL_vtbl_sig. It's been all 0s since it was added in 5.0 alpha 2.Nicholas Clark2011-06-111-3/+0
| | | | | Magic with a NULL vtable is equivalent to magic with a vtable of all 0s. On CPAN, only Apache::Peek's code for 5.005 is referencing it.
* Don't even declare PL_vtbl_sigelem under -DPERL_MICRONicholas Clark2011-06-111-0/+2
| | | | This turns out to be a simpler solution than 9ba75e3cf905a6e6.
* Store FBMs in PVMGs, instead of GVs.Nicholas Clark2011-06-111-2/+2
| | | | | | | | This should reduce the complexity of code dealing with GVs, as they no longer try to play several different incompatible roles. (As suggested by Ben Morrow. However, it didn't turn out to be as straightforward as one might have hoped).
* Store the BM table in mg_ptr instead of after SvCUR().Nicholas Clark2011-06-111-11/+28
| | | | | | | | | | | | Previously the 256 byte Boyer-Moore table was stored in the buffer of SvPVX() after the raw string by extending the buffer. Given that the scalar is alway upgraded to add PERL_MAGIC_bm magic, to clear the table and other flags, there's no extra memory cost in using mg_ptr in the MAGIC struct to point directly to the table. I believe that this removes the last place in the core that stores data beyond SvCUR().
* Exit early from Perl_fbm_compile() if the SV is already "compiled".Nicholas Clark2011-06-111-0/+3
| | | | | I believe that this can only happen if a constant subroutine is used more than once as the second argument to index.
* In Perl_fbm_instr(), use a switch() statement for the special case code.Nicholas Clark2011-06-111-8/+10
| | | | | Previously the special-case code for lengths 0, 1 and 2 was in a nested set of if() statements, which was slightly cryptic to read.
* In Perl_fbm_compile(), use STRLEN instead of U32 to calculate BmPREVIOUS().Nicholas Clark2011-06-111-4/+4
| | | | | | | | | This should fix a theoretical bug on strings longer than 2**32 bytes where the byte referenced by BmRARE() is at an offset beyond 2**32. I'm not sure how to test this, as I think to trigger it one would need to have one of a: the second argument to index as a string literal, longer than 2**32 bytes b: a fixed string in a regex, longer than 2**32 bytes
* Use SvTAIL() instead of BmFLAGS(). The core no longer uses BmFLAGS().Nicholas Clark2011-06-111-1/+1
|
* Emulate the value of BmFLAGS() using SvTAIL().Nicholas Clark2011-06-111-1/+0
| | | | | | | | | | | | | | | | | | | | Don't set BmFLAGS() in Perl_fbm_compile() Originally fbm_compile() had an I32 flags argument, which seems to have been part of case folding/locale improvements. bbce6d69784bf43b removed this. SvTAIL() was only used in once place until c277df42229d99fe. 2779dcf1a3ceec16 added the U32 flags argument to fbm_compile(), not used until cf93c79d660ae36c. That commit also added FBMcf_TAIL and FBMcf_TAIL{z,Z,DOLLAR} but didn't use the last three. Additionally, it stored the BmFLAGS as part of the compiled table: + table[-1] = flags; /* Not used yet */ f722798beaa43749 added FBMcf_TAIL_DOLLARM, renumbered FBMcf_TAIL{z,Z,DOLLAR}, but still didn't use anything other than FBMcf_TAIL. The core, nothing on CPAN, and nothing visible to Google codesearch, has ever used the 4 specialist flags. The only use is 0 or FBMcf_TAIL, which is in lockstep with SvTAIL() of 0 or non-0.
* Don't fbm_compile() studied scalars, to give more flexibility in SV flag usage.Nicholas Clark2011-06-111-0/+7
| | | | | No real-world code would ever end up using a studied scalar as a compile-time second argument to index, so this isn't a real pessimisation.
* unused variable tmpgvRobin Barker2011-06-101-1/+0
| | | | | | | | gcc reports an unused variable 'tmpgv', this was left behind by commit 0e21945565eb4664d843bb819fb032cedee4d5a6. Deleting the declaration has no consequences. Signed-off-by: David Golden <dagolden@cpan.org>
* Turn $$ into a magical readonly variable that always fetches getpid() ↵Max Maischein2011-05-221-6/+0
| | | | | | | | | | | instead of caching it The intent is that by not caching $$, we eliminate one opportunity for bugs: If one embeds Perl or uses XS and calls fork(3) from C, Perls notion of $$ may go out of sync with what getpid() returns. By always fetching the value of $$ via getpid(), this bug opportunity is eliminated. The overhead of always fetching $$ should be small and is likely only used for tempfile creation, which should be dwarfed by file system accesses.
* In Perl_safesyscalloc(), only declare total_size if conditional code needs it.Nicholas Clark2011-05-181-1/+6
| | | | | | gcc 4.6.0 warns about variables that are set but never read, and for most combinations of conditional compilation options, total_size is never read. So avoid declaring or setting it if it's not actually going to be used later.
* Fix building with -UuseperlioNicholas Clark2011-03-071-0/+4
| | | | | | It was inadvertently broken by 2e0cfa16dea85dd3. Many tests still fail, but that is unrelated to that change. It's more likely that we will remove -Uuseperlio than fix the tests.
* Windows builds require perliol.h conditional on USE_PERLIO.George Greer2011-02-161-0/+2
|
* [perl #78494] Pipes cause threads to hang on join()Father Chrysostomos2011-02-151-4/+15
| | | | | | | | | | | | | or on close() in either thread. close() in one thread blocks until close() is called in the other thread, because both closes are waiting for the child process to end. Since we have a reference-counting mechanism for the underlying fileno, we can use that to determine whether close() should wait. This does not solve the problem of close $OUT block when it has been duplicated via open $OUT2, ">&" and $OUT2 is still in scope.
* Silence util.c compiler warning from win32 smokesKarl Williamson2011-02-131-1/+1
|
* Move grok_bslash_c to dquote.c and make staticKarl Williamson2011-02-091-41/+0
| | | | No other changes were made
* Move grok_blsash_o and make staticKarl Williamson2011-02-091-79/+0
| | | | | | This function is only used in the same places as dquote_static.c is used, so move it there, and we won't have to worry about changing its API will break something. No other changes made
* util.c handling of return value of vsnprintfRobin Barker2011-01-161-4/+16
| | | | | | | At two points in util.c, there is code that use vsnprintf if available, otherwise vsprintf. The handling of the return value does not reflect which function has been called. The patch tries to improve this.
* In Perl_write_to_stderr(), use Perl_magic_methcall() if STDERR is tied.Nicholas Clark2011-01-131-22/+2
| | | | | | Add a flag G_WRITING_TO_STDERR to signal that Perl_magic_methcall() needs to localise PL_stderrgv to NULL, and save/free temps, inside its ENTER/LEAVE pair.
* Fix typos (spelling errors) in Perl sources.Peter J. Acklam) (via RT2011-01-071-2/+2
| | | | | | | | | # New Ticket Created by (Peter J. Acklam) # Please include the string: [perl #81904] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81904 > Signed-off-by: Abigail <abigail@abigail.be>
* Calling "PRINT" on a tied STDERR can use G_DISCARD, as the result is ignored.Nicholas Clark2011-01-051-1/+1
|
* Argument op to report_evil_fh() is always PL_op->op_type, so need not be passedNicholas Clark2010-12-281-2/+2
|
* The io argument to report_evil_fh() is always GvIO(gv), so need not be passed.Nicholas Clark2010-12-281-4/+5
|
* Extract the OP_phoney_* code from report_evil_fh() into report_wrongway_fh()Nicholas Clark2010-12-281-59/+60
| | | | | Previously Perl_report_evil_fh()'s body was just an if/else at the top level - a good sign that it is actually implementing two disjoint functions.
* Add Perl_foldEQ_latin1()Karl Williamson2010-11-281-0/+21
| | | | | | | | | | This function compares two non-utf8 strings to see if they are equivalent without regards to case differences. It does not work nor check for three problematic code points that require special handling: MICRO_SIGN, LATIN_SMALL_LETTER_SHARP_S, and LATIN_SMALL_LETTER_Y_WITH_DIAERESIS. make regen required
* Bring core Perl in line with CPAN 0.86 releaseJohn Peacock2010-11-271-21/+32
| | | | | | | Attached is a patch that bring the core Perl version code inline with the latest CPAN release. The vast majority of changes are in code that does not execute in core, but that makes it easier to keep the core and CPAN changes in sync.
* Document the refcount of version functions’ retvalFather Chrysostomos2010-11-231-1/+7
|
* Eliminate PL_dirtyFlorian Ragwitz2010-11-141-2/+2
| | | | | It now only exists as a compatibility macro for extensions that want to introspect it.
* adjust output of -DmDavid Mitchell2010-10-311-1/+1
| | | | | The address printed for malloc() didn't always match that for free(). Print the malloc() address *after* any modification by PERL_TRACK_MEMPOOL
* Refactor Perl_xs_apiversion_bootcheck()Nicholas Clark2010-10-081-7/+12
| | | | Use fewer mortals, and avoid leaking an SV if upg_version() croaks.
* Convert the implementation of XS_APIVERSION_BOOTCHECK to a function.Nicholas Clark2010-10-081-0/+25
| | | | | | The previous macro generated over .5K of object code. This is in every shared object, and is only called once. Hence this change increases the perl binary by about .5K (once), to save .5K for every XS module loaded.