Skip to content
Snippets Groups Projects
Select Git revision
  • develop
  • master default protected
  • v1.2.11
  • v1.2.10
  • v1.2.9
  • v1.2.8
  • v1.2.7.3
  • v1.2.7.2
  • v1.2.7.1
  • v1.2.7
  • v1.2.6.1
  • v1.2.6
  • v1.2.5.3
  • v1.2.5.2
  • v1.2.5.1
  • v1.2.5
  • v1.2.4.5
  • v1.2.4.4
  • v1.2.4.3
  • v1.2.4.2
  • v1.2.4.1
  • v1.2.4
22 results

zutil.h

  • Mark Adler's avatar
    3c46f5dd
    Avoid the use of ptrdiff_t. · 3c46f5dd
    Mark Adler authored
    This isn't the right type anyway to assure that it contains a
    pointer. That type would be intptr_t or uintptr_t. However the C99
    standard says that those types are optional, so their use would not
    be portable. This commit simply uses size_t or whatever configure
    decided to use for size_t. That would be the same length as
    ptrdiff_t, and so will work just as well. The code checks to see if
    the length of the type used is the same as the length of a void
    pointer, so there is already protection against the use of the
    wrong type. The use of size_t (or ptrdiff_t) will almost always
    work, as all modern architectures have an array size that is the
    same as the pointer size. Only old segmented architectures would
    have to fall back to the slower CRC-32 calculation, where the
    amount of memory that can be accessed is larger than the maximum
    array size.
    3c46f5dd
    History
    Avoid the use of ptrdiff_t.
    Mark Adler authored
    This isn't the right type anyway to assure that it contains a
    pointer. That type would be intptr_t or uintptr_t. However the C99
    standard says that those types are optional, so their use would not
    be portable. This commit simply uses size_t or whatever configure
    decided to use for size_t. That would be the same length as
    ptrdiff_t, and so will work just as well. The code checks to see if
    the length of the type used is the same as the length of a void
    pointer, so there is already protection against the use of the
    wrong type. The use of size_t (or ptrdiff_t) will almost always
    work, as all modern architectures have an array size that is the
    same as the pointer size. Only old segmented architectures would
    have to fall back to the slower CRC-32 calculation, where the
    amount of memory that can be accessed is larger than the maximum
    array size.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.