summaryrefslogtreecommitdiff
path: root/perlio.c
Commit message (Collapse)AuthorAgeFilesLines
* perlio.c - double cast PerlIO_lockcnt()Yves Orton2023-03-291-1/+1
| | | | This avoids various warnings about alignment on HPUX.
* perlio.c: remove silly castsLukas Mai2023-03-231-14/+18
|
* snprintf() calls need to have proper radixKarl Williamson2023-02-101-0/+3
| | | | | | | | | | | | | | | | | | | Calls to libc snprintf() were neglected to be changed when perl was fixed to change the radix character to the proper one based on whether or not 'use locale' is in effect. Perl-level code is unaffected, but core and XS code is. This commit changes to wrap snprintf() calls with the macros designed for the purpose, long used for similar situations elsewhere in the code. Doing this requires the thread context. I achieved this in a few places by a dTHX, instead of assuming a caller would have the context already available, and adding a pTHX_ parameter. I tried doing it the other way, and got a few breakages in our test suite. Formatting already requires significant CPU time, so this addition should just be in the noise This bug was found by new tests that will be added in a future commit.
* Correct typos as per GH 20435James E Keenan2022-12-291-1/+1
| | | | | | | | | | | | | | | | | | | In GH 20435 many typos in our C code were corrected. However, this pull request was not applied to blead and developed merge conflicts. I extracted diffs for the individual modified files and applied them with 'git apply', excepting four files where patch conflicts were reported. Those files were: handy.h locale.c regcomp.c toke.c We can handle these in a subsequent commit. Also, had to run these two programs to keep 'make test_porting' happy: $ ./perl -Ilib regen/uconfig_h.pl $ ./perl -Ilib regen/regcomp.pl regnodes.h
* Use `LINE_Tf` thoroughly for formatting the value of CopLINE()TAKAI Kousuke2022-10-131-3/+3
| | | | | | The value of CopLINE() used to be formatted with various way; sometimes with `%ld` and `(long)` cast, sometimes `IVdf` and `(IV)` cast, or `%d` and so on.
* Make use of av_push_simple in a few places.Richard Leach2022-06-081-4/+4
| | | | | | | | | Specifically, only where a new AV has just been created and it's therefore obvious that av_push_simple is safe to use. In many cases, nearby code does av_push to an existing array. It might well be the case that these are simple arrays and av_push_simple could be used instead. The necessary analysis has been left for the future.
* perlio.c: Add commentKarl Williamson2022-05-071-0/+2
|
* newSVpvn_flags(x, .. ,SVs_TEMP) more efficient than sv_2mortal(newSVpv(x,0))Richard Leach2021-11-291-2/+2
|
* Remove DOS/DJGPP supportDagfinn Ilmari Mannsåker2021-11-021-4/+0
| | | | | | DJGPP is a port of the GNU toolchain to 32-bit x86 systems running DOS. The last known attempt to build Perl on it was on 5.20, which only got as far as building miniperl.
* Remove NetWare supportDagfinn Ilmari Mannsåker2021-10-081-4/+0
| | | | The build has been broken since 2009.
* perlio.c: Save '&' instrs by casting to U8Karl Williamson2021-07-301-2/+2
|
* Remove :win32 PerlIO layerLeon Timmermans2021-06-281-6/+0
|
* perlio.c: Don't wrongly conditionally compileKarl Williamson2021-06-271-4/+4
| | | | | The code is using '#ifdef EBCDIC' when it has nothing to do with EBCDIC; but is a proxy for how things work on IBM boxes that use EBCDIC.
* replace all instances of PERL_IMPLICIT_CONTEXT with MULTIPLICITYTomasz Konojacki2021-06-091-1/+1
| | | | | | | | | | | | Since the removal of PERL_OBJECT (acfe0abcedaf592fb4b9cb69ce3468308ae99d91) PERL_IMPLICIT_CONTEXT and MULTIPLICITY have been synonymous and they're being used interchangeably. To simplify the code, this commit replaces all instances of PERL_IMPLICIT_CONTEXT with MULTIPLICITY. PERL_IMPLICIT_CONTEXT will stay defined for compatibility with XS modules.
* style: Detabify indentation of the C code maintained by the core.Michael G. Schwern2021-01-171-2067/+2067
| | | | | | | | | | | This just detabifies to get rid of the mixed tab/space indentation. Applying consistent indentation and dealing with other tabs are another issue. Done with `expand -i`. * vutil.* left alone, it's part of version. * Left regen managed files alone for now.
* perlio.c: White-space, dead-code onlyKarl Williamson2020-11-011-72/+69
| | | | | This properly indents nested #preprocessor directives, and removes two empty #if's
* Remove code guarded by PERLIO_STD_SPECIALDagfinn Ilmari Mannsåker2020-07-201-8/+0
| | | | | The symbol was only defined on Symbian, and calling macros only defined there.
* Remove use of dVAR in coreDagfinn Ilmari Mannsåker2020-07-201-6/+0
| | | | | It only does anything under PERL_GLOBAL_STRUCT, which is gone. Keep the dNOOP defintion for CPAN back-compat
* Remove Symbian portDagfinn Ilmari Mannsåker2020-07-201-1/+1
| | | | | Also eliminate USE_HEAP_INSTEAD_OF_STACK and SETSOCKOPT_OPTION_VALUE_T, since Symbian was the only user of those.
* perlio.c: make :unix close method call underlaying layers as wellLeon Timmermans2020-01-261-0/+1
|
* Local variable 'imode' hides a parameter of the same nameJames E Keenan2019-12-041-1/+1
| | | | | | | LGTM static code analysis of Perl 5 source code issued this recommendation. Implement fix. https://lgtm.com/projects/g/Perl/perl5/rev/ae73d7ec2329275a2dba4be24415743f884d9dfd
* (perl #134221) support O_APPEND for open ..., undef on VMSTony Cook2019-07-161-4/+6
| | | | | | | | | | VMS doesn't allow you to delete an open file like POSIXish systems do, but you can mark a file to be deleted once it's closed, but only when you open it. Since VMS doesn't (yet) have mkostemp() we can add our own flag to our mkostemp() emulation to pass the necessary magic to open() call to delete the file on close.
* (perl #134221) support append mode temp files on Win32 tooTony Cook2019-07-161-1/+1
|
* (perl #134221) support append mode for open .. undefTony Cook2019-07-161-5/+21
|
* The Windows CE Chainsaw MassacreSteve Hay2019-06-181-6/+0
| | | | | Remove WinCE support as agreed in the thread starting here: https://www.nntp.perl.org/group/perl.perl5.porters/2018/07/msg251683.html
* (perl #133604) fix binmode on Win32 :crlf layersTony Cook2018-10-221-1/+1
| | | | | | | | | | | | | On Win32 the :crlf layer is special - it replaces the use of the normal :perlio buffering layer. So while binmode :raw with :crlf present on non-Win32 removes the CRLF layer, on Win32 it simply switches the :crlf layer's CRLF flag off to prevent translation. Unfortunately the :crlf skipped doing something else expected by :raw - it didn't turn off the layer UTF8 flag. This broke the tests I added in 9704d779004.
* Eliminated 3 '-Wparentheses' warnings detected by g++-8.James E Keenan2018-10-101-1/+1
| | | | For: RT # 133557
* (perl #133510) can't use my_vsnprintf() on quadmath/threaded buildsTony Cook2018-09-121-0/+12
| | | | | | | | | Since anything with quadmath should be recent enough to have vsnprintf() I've fallen back to that. Calls to PerlIO_debug() in core don't include floating point values and I expect it to be unlikely outside of core - if it is needed they'll just have to use double formatting/types.
* Revert "Revert "make PerlIO handle FD_CLOEXEC""Zefram2018-01-181-22/+38
| | | | | | This reverts commit 523d71b314dc75bd212794cc8392eab8267ea744, reinstating commit 2cdf406af42834c46ef407517daab0734f7066fc. Reversion is not the way to address the porting problem that motivated that reversion.
* Revert "make PerlIO handle FD_CLOEXEC"Abigail2018-01-181-38/+22
| | | | | | | | | | | | | | | | | | | | | This reverts commit 2cdf406af42834c46ef407517daab0734f7066fc. The reason for the revert is that with this commit, perl fails to compile on darwin (or at least, one some versions of it): ./miniperl -Ilib make_ext.pl lib/auto/DB_File/DB_File.bundle MAKE="/Applications/Xcode.app/Contents/Developer/usr/bin/make" LIBPERL_A=libperl.a LINKTYPE=dynamic Parsing config.in... Looks Good. dyld: lazy symbol binding failed: Symbol not found: _mkostemp Referenced from: /private/tmp/perl/cpan/DB_File/../../miniperl Expected in: flat namespace dyld: Symbol not found: _mkostemp Referenced from: /private/tmp/perl/cpan/DB_File/../../miniperl Expected in: flat namespace Unsuccessful Makefile.PL(cpan/DB_File): code=5 at make_ext.pl line 518. make: *** [lib/auto/DB_File/DB_File.bundle] Error 2
* make PerlIO handle FD_CLOEXECZefram2017-12-221-22/+38
| | | | | | Move handling of close-on-exec flag for PerlIO handles into PerlIO itself. Where PerlIO opens new file descriptors, have them opened in O_CLOEXEC mode where possible.
* set FD_CLOEXEC on PL_perlio_debug_fdZefram2017-12-221-4/+4
| | | | There's clearly no intent for this to be inherited across exec.
* use Perl_my_mkstemp() where appropriateZefram2017-12-221-12/+4
| | | | | | Since commit e48855bdd2fc57fc51156f5e4b8dee6b544456c8 there has been no need to be conditional about using mkstemp(). Perl_my_mkstemp() is always available, one way or another.
* semicolon-friendly diagnostic controlZefram2017-12-161-2/+2
| | | | | | New macros {GCC,CLANG}_DIAG_{IGNORE,RESTORE}_{DECL,STMT}, which take a following semicolon. It is necessary to use the _DECL or _STMT version as appropriate to the context. Fixes [perl #130726].
* avoid redundant initialisation around Newxz()Zefram2017-11-131-1/+1
| | | | | | Reduce Newxz() to Newx() where all relevant parts of the memory are being explicitly initialised, and don't explicitly zero memory that was already zeroed. [perl #36078]
* perlio.c: simplify cpp conditionalsAaron Crane2017-10-211-16/+10
|
* Rely on C89 vprintf()Aaron Crane2017-10-211-20/+0
|
* get rid of "implicit fallthrough" warnings with gcc 7Lukas Mai2017-10-131-3/+1
|
* Remove #ifdef USE_ITHREADS around MUTEX_* callsDagfinn Ilmari Mannsåker2017-07-031-18/+0
| | | | | These macros are defined as NOOP outside USE_ITHREADS, so there's no point in guarding them with it.
* update size after RenewHugo van der Sanden2017-03-151-3/+4
| | | | | | | | | | | | | | | RT #130841 In general code, change this idiom: PL_foo_max += size; Renew(PL_foo, PL_foo_max, foo_t); to Renew(PL_foo, PL_foo_max + size, foo_t); PL_foo_max += size; so that if Renew dies, PL_foo_max won't be left hanging.
* Add support for VS2015 (VC++ 14.0)Steve Hay2017-02-191-1/+1
| | | | | | | | | | | | | | | Due to the rewritten CRT in this version of Visual C++ it is no longer possible (or at least not at all easy) to make use of the ioinfo struct, which commit b47a847f62 (re-)introduced in order to fix RT#120091/118059. Therefore, we effectively revert commit b47a847f62 for VS2015 onwards on the basis that being able to build with VS2015 onwards is more important than the RT#120091/118059 bug fix. This does unfortunately mean that perls built with <=VS2013 will not be compatible with perls built with >=VS2015, but they may well not have been compatible anyway because of the CRT rewrite, and certainly wouldn't be compatible if perl builds with VS2015 were not supported! See RT#125714 for more discussion about this.
* Use cBOOL() instead of ? TRUE : FALSEDagfinn Ilmari Mannsåker2017-01-251-2/+2
| | | | Except under cpan/ and dist/
* Clean up warnings uncovered by 'clang -Weverything'.Andy Lester2016-12-051-2/+7
| | | | For: RT #130195
* Change white space to avoid C++ deprecation warningKarl Williamson2016-11-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | C++11 requires space between the end of a string literal and a macro, so that a feature can unambiguously be added to the language. Starting in g++ 6.2, the compiler emits a warning when there isn't a space (presumably so that future versions can support C++11). Unfortunately there are many such instances in the perl core. This commit fixes those, including those in ext/, but individual commits will be used for the other modules, those in dist/ and cpan/. This commit also inserts space at the end of a macro before a string literal, even though that is not deprecated, and removes useless "" literals following a macro (instead of inserting a blank). The result is easier to read, making the macro stand out, and be clearer as to the intention. Code and modules included with the Perl core need to be compilable using C++. This is so that perl can be embedded in C++ programs. (Actually, only the hdr files need to be so compilable, but it would be hard to test that just the hdrs are compilable.) So we need to accommodate changes to the C++ language.
* perlio.c: Fix z/OS problemYaroslav Kuzmin2016-09-081-0/+32
| | | | | | | See thread starting at <6E741FE88A7C4E428528A0AAAB94D735B65C65@DFLE10.ent.ti.com> (The commiter made some white space changes to the patch)
* Coverity CID #15149: Missing varargs init or cleanupJarkko Hietaniemi2016-08-161-1/+2
| | | | The return was returning after va_start but before va_end.
* perlio.c: silence a couple of warningsDavid Mitchell2016-06-141-0/+4
|
* (perl #127380) default PERLIO_DEBUG/-Di to use STDERRTony Cook2016-06-081-4/+4
| | | | | This includes under taint, just as other -D switches write to stderr when taint is on.
* (perl #127380) only trace to $PERLIO_DEBUG if -Di is suppliedTony Cook2016-06-081-44/+58
|
* Fix umask for mkstemp(3) callsNiko Tyni2016-01-291-1/+1
| | | | | | | | | | | | | | | | | | With commit v5.21.0-67-g60f7fc1, perl started setting umask to 0600 before calling mkstemp(3), and then restoring it afterwards. This is wrong as it tells open(2) to strip the owner read and write bits from the given mode before applying it, rather than the intended negation of leaving only those bits in place. On modern systems which call open(2) with mode 0600 in mkstemp(3), this clears all the created temporary file permissions. However, any systems that use mode 0666 in mkstemp(3) (like ancient versions of glibc) now create a file with permissions 0066, leaving world read and write permission regardless of current umask. Using umask 0177 instead fixes this. Bug: https://rt.perl.org/Ticket/Display.html?id=127322