• Clemens Hammacher's avatar
    [platform] Allow to memory-map empty files · 6962334d
    Clemens Hammacher authored
    This current fails, since {mmap} fails with EINVAL for empty mappings.
    The destructor already has special handling for a {nullptr} mapping, so
    we can just use {nullptr} for empty files. We get a similar error on
    windows, and can fix it the same way.
    
    On order to make presubmit checks happy, we have to skip copyright
    checking and checking for terminating newlines for empty files.
    
    R=mlippautz@chromium.org
    
    Change-Id: I2b73da7ff6df72d8bdd40df1fff6422e0a46881e
    Reviewed-on: https://chromium-review.googlesource.com/c/1424861Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
    Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#58970}
    6962334d
platform-win32.cc 44.7 KB