|
438c9958
|
2019-06-10T10:52:01
|
|
Fix memleaks in analysis tests.
Wrap some missed setup api calls in asserts.
|
|
21ddeabe
|
2019-06-07T15:22:42
|
|
Review fixes:
- whitespace -> tabs
- comment style
- improve repo naming in merge/trees/analysis tests.
|
|
5427461f
|
2019-03-20T11:51:24
|
|
merge: add doc header to analysis tests
|
|
1d04f477
|
2019-03-19T23:43:56
|
|
merge: tests for bare repo merge analysis
dupe of workdir/analysis.c against a bare repo.
|
|
7b27b6cf
|
2019-06-06T16:32:09
|
|
Refactor testing:
- move duplication between merge/trees/ and merge/workdir/ into merge/analysis{.c,.h}
- remove merge-resolve.git resource, open the existing merge-resolve as a bare repo instead.
|
|
6d2ab2cf
|
2019-03-19T23:43:10
|
|
merge: analysis support for bare repositories
|
|
e50d138e
|
2019-06-06T09:48:30
|
|
Merge pull request #5095 from pks-t/pks/ignore-escaped-trailing-space
ignore: handle escaped trailing whitespace
|
|
4de6eb5b
|
2019-06-06T09:47:43
|
|
Merge pull request #5074 from libgit2/ethomson/ignore_leading_slash
Ignore: only treat one leading slash as a root identifier
|
|
d81e7866
|
2019-06-06T14:11:44
|
|
ignore: handle escaped trailing whitespace
The gitignore's pattern format specifies that "Trailing spaces
are ignored unless they are quoted with backslash ("\")". We do
not honor this currently and will treat a pattern "foo\ " as if
it was "foo\" only and a pattern "foo\ \ " as "foo\ \".
Fix our code to handle those special cases and add tests to avoid
regressions.
|
|
b6967c39
|
2019-06-06T14:02:17
|
|
attr_file: refactor stripping of trailing spaces
The stripping of trailing spaces currently happens as part of
`git_attr_fnmatch__parse`. As we aren't currently parsing
trailing whitespaces correct in case they're escaped, we'll have
to change that code, though. To make actual behavioural change
easier to review, refactor the code up-front by pulling it out
into its own function that is expected to retain the exact same
functionality as before. Like this, the fix will be trivial to
apply.
|
|
b1795e0d
|
2019-06-05T15:02:33
|
|
Merge pull request #5094 from libgit2/ethomson/auth_failure
online tests: use gitlab for auth failures
|
|
e66a4eb3
|
2019-06-05T14:19:14
|
|
online tests: use gitlab for auth failures
GitHub recently changed their behavior from returning 401s for private
or nonexistent repositories on a clone to returning 404s. For our tests
that require an auth failure (and 401), move to GitLab to request a
missing repository. This lets us continue to test our auth failure
case, at least until they decide to mimic that decision.
|
|
e2d4f09d
|
2019-06-05T13:04:25
|
|
Merge pull request #5076 from libgit2/ethomson/ignore_spaces
Ignore files: don't ignore whitespace
|
|
4bcebe2c
|
2019-05-19T16:34:44
|
|
attr: ensure regular attr files can have whitespace
Unlike ignore files, gitattribute files can have flexible whitespace at
the beginning of the line. Ensure that by adding new ignore rules that
we have not impeded correct parsing of attribute files.
|
|
63adcc4e
|
2019-05-19T16:27:59
|
|
attr: optionally treat leading whitespace as significant
When `allow_space` is unset, ensure that leading whitespace is not
skipped.
|
|
7d330541
|
2019-05-19T16:33:28
|
|
ignore: test that comments begin at position 0
Comments must have a '#' at the beginning of the line. For
compatibility with git, '#' after a whitespace is a literal part of the
filename.
|
|
19164901
|
2019-05-19T16:27:02
|
|
ignore: test that leading whitespace is significant
Ensure that leading whitespace is treated as being part of the filename,
eg ` foo` in an ignore file indicates that a file literally named ` foo`
is ignored.
|
|
ac070afe
|
2019-05-24T15:54:00
|
|
Merge pull request #5088 from pks-t/pks/cache-eviction-segfault
cache: fix cache eviction using deallocated key
|
|
bcb4d1d0
|
2019-05-24T15:39:25
|
|
Merge pull request #5085 from pks-t/pks/security.md
SECURITY.md: split out security-relevant bits from readme
|
|
add17435
|
2019-05-24T15:24:26
|
|
cache: fix cache eviction using deallocated key
When evicting cache entries, we first retrieve the object that is
to be evicted, delete the object and then finally delete the key
from the cache. In case where the cache eviction caused us to
free the cached object, though, its key will point to invalid
memory now when trying to remove it from the cache map. On my
system, this causes us to not properly remove the key from the
map, as its memory has been overwritten already and thus the key
lookup it will fail and we cannot delete it.
Fix this by only decrementing the refcount of the evictee after
we have removed it from our cache map. Add a test that caused a
segfault previous to that change.
|
|
2b8a05cc
|
2019-05-24T13:33:22
|
|
Merge pull request #5086 from jacquesg/netbsd
Restore NetBSD support
|
|
d668820d
|
2019-05-24T10:48:47
|
|
NetBSD < 7 doesn't have posix_fallocate
See: https://www.netbsd.org/changes/changes-7.0.html
|
|
62bbec5a
|
2019-05-24T11:09:51
|
|
SECURITY.md: split out security-relevant bits from readme
GitHub has recently introduced a new set of tools that aims to
ease the process around vulnerability reports and security fixes.
Part of those tools is a new security tab for projects that will
display contents from a new SECURITY.md file.
Move relevant parts from README.md to this new file to make use
of this feature.
|
|
7a0238b1
|
2019-05-24T11:06:38
|
|
Merge pull request #5084 from eaigner/garbage-value
repository: fix garbage return value
|
|
9cc904da
|
2019-05-23T10:49:44
|
|
repository: fix garbage return value
error was never initialized and a garbage value returned on success.
|
|
2f7b6ad5
|
2019-05-23T00:41:16
|
|
Merge pull request #5083 from libgit2/ethomson/pcre_warnings
cmake: disable fallthrough warnings for PCRE
|
|
1f9b7222
|
2019-05-22T12:47:04
|
|
cmake: disable fallthrough warnings for PCRE
Our PCRE dependency has uncommented fallthroughs in switch statements.
Turn off warnings for those in the PCRE code.
|
|
ca046360
|
2019-05-22T12:18:30
|
|
Merge pull request #5073 from libgit2/ethomson/config_section_validity
Configuration parsing: validate section headers with quotes
|
|
355b02a1
|
2019-05-22T11:48:28
|
|
config: rename subsection header parser func
The `parse_section_header_ext` name suggests that it as an extended
function for parsing the section header. It is not. Rename it to
`parse_subsection_header` to better reflect its true mission.
|
|
42dd38dd
|
2019-05-16T08:55:40
|
|
config: lowercase error messages
Update the configuration parsing error messages to be lower-cased for
consistency with the rest of the library.
|
|
23c5699e
|
2019-05-16T09:37:25
|
|
config: validate quoted section value
When we reach a whitespace after a section name, we assume that what
will follow will be a quoted subsection name. Pass the current position
of the line being parsed to the subsection parser, so that it can
validate that subsequent characters are additional whitespace or a
single quote.
Previously we would begin parsing after the section name, looking for
the first quotation mark. This allows invalid characters to embed
themselves between the end of the section name and the first quotation
mark, eg `[section foo "subsection"]`, which is illegal.
|
|
b83bd037
|
2019-05-16T08:57:10
|
|
config: don't write invalid column
When we don't specify a particular column, don't write it in the error
message. (column "0" is unhelpful.)
|
|
d97afb93
|
2019-05-22T11:45:45
|
|
Merge pull request #5060 from pks-t/pks/refspec-nested-globs
Loosen restriction on wildcard "*" refspecs
|
|
3d9e82fd
|
2019-05-21T14:59:55
|
|
Merge pull request #4935 from libgit2/ethomson/pcre
Use PCRE for our fallback regex engine when regcomp_l is unavailable
|
|
954f5357
|
2019-05-21T14:33:37
|
|
Merge pull request #5062 from tiennou/fix/ssh-url-substitution
Remote URL last-chance resolution
|
|
afb04a95
|
2019-05-21T14:03:04
|
|
ci: use a mix of regex backends
Explicitly enable the `builtin` regex backend and the PCRE backend for
some Linux builds.
|
|
59647e1a
|
2019-04-08T15:54:25
|
|
remote: add callback to resolve URLs before connecting
Since libssh2 doesn't read host configuration from the config file,
this callback can be used to hand over URL resolving to the client
without touching the SSH implementation itself.
|
|
ac2b235e
|
2019-05-21T12:22:40
|
|
regex: use REGEX_BACKEND as the cmake option name
This avoids any misunderstanding with the REGEX keyword in cmake.
|
|
4aa36ff2
|
2019-05-21T12:18:47
|
|
Merge pull request #5075 from libgit2/ethomson/ignore_skip_bom
Skip UTF8 BOM in ignore files
|
|
6b9cc029
|
2019-05-21T12:05:50
|
|
Merge pull request #5080 from dbrnz/issue-5079
We've already added `ZLIB_LIBRARIES` to `LIBGIT2_LIBS` so don't also add the `z` library
|
|
ada1cd01
|
2019-05-21T21:35:57
|
|
Use tabs for indentation (#5079).
|
|
b575c242
|
2019-05-21T20:20:04
|
|
Fix indentation (#5079).
|
|
2c2e924b
|
2019-05-21T20:17:48
|
|
We still need to update pkgconfig variables when zlib is unbundled (#5079).
|
|
06dbf734
|
2019-05-21T15:44:32
|
|
We've already added `ZLIB_LIBRARIES` to `LIBGIT2_LIBS` so don't also add the `z` library (libgit2/#5079).
|
|
040db8ad
|
2019-05-20T14:11:32
|
|
Merge pull request #5077 from jacquesg/symbolic_link_flag_directory
Define SYMBOLIC_LINK_FLAG_DIRECTORY if required
|
|
0fd259ed
|
2019-05-20T12:44:37
|
|
define SYMBOLIC_LINK_FLAG_DIRECTORY if not defined
|
|
133bceba
|
2019-05-19T13:57:13
|
|
ignore: skip UTF8 BOM in ignore file
|
|
73a157e0
|
2019-05-19T13:29:45
|
|
ignore: test we can handle an ignore file with BOM
Ensure that we can read and parse an ignore file with a UTF8 BOM.
|
|
e269b343
|
2019-05-19T13:12:47
|
|
ignore: only skip first leading slash
For compatibility with git, only skip the first leading slash in an
ignore file. That is: `/a.txt` indicates to ignore a file named `a.txt`
at the root. However `//b.txt` does not indicate that a file named
`b.txt` at the root should be ignored.
|
|
e6e6b60f
|
2019-05-19T12:32:06
|
|
ignore: test multiple leading slashes
|
|
31f8f82a
|
2018-03-02T12:18:59
|
|
diff_driver: detect memory allocation errors when loading diff driver
When searching for a configuration key for the diff driver, we construct
the config key by modifying a buffer and then passing it to
`git_config_get_multivar_foreach`. We do not check though whether the
modification of the buffer actually succeded, so we could in theory end
up passing the OOM buffer to the config function.
Fix that by checking return codes. While at it, switch to use
`git_buf_PUTS` to avoid repetition of the appended string to calculate
its length.
|
|
9ceafb57
|
2019-01-12T22:55:31
|
|
regexec: use pcre as our fallback/builtin regex
Use PCRE 8.42 as the builtin regex implementation, using its POSIX
compatibility layer. PCRE uses ASCII by default and the users locale
will not influence its behavior, so its `regcomp` implementation is
similar to `regcomp_l` with a C locale.
|
|
ce6d624a
|
2019-05-19T10:30:04
|
|
regex: optionally use PCRE2
Use PCRE2 and its POSIX compatibility layer if requested by the user.
Although PCRE2 is adequate for our needs, the PCRE2 POSIX layer as
installed on Debian and Ubuntu systems is broken, so we do not opt-in to
it by default to avoid breaking users on those platforms.
|
|
69ecdad5
|
2019-05-19T10:09:55
|
|
regex: use system PCRE if available
Attempt to locate a system-installed version of PCRE and use its POSIX
compatibility layer, if possible.
|
|
622166c4
|
2019-05-18T19:37:59
|
|
regex: disambiguate builtin vs system pcre
|
|
c6e48fef
|
2019-02-17T21:51:34
|
|
regex: allow regex selection in cmake
Users can now select which regex implementation they want to use: one of
the system `regcomp_l`, the system PCRE, the builtin PCRE or the
system's `regcomp`.
By default the system `regcomp_l` will be used if it exists, otherwise
the system PCRE will be used. If neither of those exist, then the
builtin PCRE implementation will be used.
The system's `regcomp` is not used by default due to problems with
locales.
|
|
09902985
|
2019-01-13T21:12:10
|
|
core::posix: skip some locale tests on win32
|
|
fe1fb36e
|
2019-01-13T21:10:50
|
|
win32: move type definitions for improved inclusion
Move some win32 type definitions to a standalone file so that they can
be included before other header files try to use the definitions.
|
|
e4b2ef87
|
2019-01-13T10:09:13
|
|
regex: don't warn on unused functions
PCRE includes compatibility functions that may go unused. Don't warn.
|
|
8877d7d3
|
2019-01-13T02:08:43
|
|
tests: regcomp: use proper character classes
The '[[:digit:]]' and '[[:alpha:]]' classes require double brackets, not
single.
|
|
ca1b07a2
|
2019-01-13T02:05:58
|
|
tests: regcomp: test that regex functions succeed
The regex functions return nonzero (not necessarily negative values) on
failure.
|
|
aea9a712
|
2018-03-02T15:12:14
|
|
tests: regcomp: assert character groups do match normal alphabet
In order to avoid us being unable to match characters which are part of
the normal US alphabet in certain weird languages, add two tests to
catch this behavior.
|
|
e207b2a2
|
2018-03-02T15:09:20
|
|
tests: regex: restructure setup of locales
In order to make it easier adding more locale-related tests, add a
generalized framework handling initial setup of languages as well as the
cleanup of them afterwards.
|
|
b055a6b5
|
2019-01-13T01:24:39
|
|
tests: regex: add test with LC_COLLATE being set
While we already have a test for `p_regexec` with `LC_CTYPE` being
modified, `regexec` also alters behavior as soon as `LC_COLLATE` is
being modified. Most importantly, `LC_COLLATE` changes the way how
ranges are interpreted to just not handling them at all. Thus, ensure
that either we use `regcomp_l` to avoid this, or that we've fallen back
to our builtin regex functionality which also behaves properly.
|
|
ad4ede91
|
2018-03-02T13:51:57
|
|
tests: fix p_regcomp test not checking return type
While the test asserts that the error value indcates a non-value, it is
actually never getting assigned to. Fix this.
|
|
d3a440ca
|
2019-01-13T10:50:13
|
|
fuzzers: use system includes
Use the system includes (defined by libgit2) as the fuzzer includes.
The fuzzers link against internal libgit2 API and therefore need to have
the full include path that libgit2 uses.
|
|
02683b20
|
2019-01-12T23:06:39
|
|
regexec: prefix all regexec function calls with p_
Prefix all the calls to the the regexec family of functions with `p_`.
This allows us to swap out all the regular expression functions with our
own implementation. Move the declarations to `posix_regex.h` for
simpler inclusion.
|
|
c9f116f1
|
2019-05-12T22:06:00
|
|
Merge branch 'pr/5061'
|
|
ab27c835
|
2019-05-12T22:05:26
|
|
revwalk: update error message for clarity
|
|
1e3a639d
|
2019-05-12T21:54:39
|
|
Merge pull request #5065 from danielgindi/feature/win32_symlink_dir
Support symlinks for directories in win32
|
|
7f562f2c
|
2019-05-12T11:00:31
|
|
Merge pull request #5057 from eaigner/merge-rebase-onto-name
rebase: orig_head and onto accessors
|
|
6990a492
|
2019-05-06T11:39:51
|
|
revwalk: fix memory leak in error handling
This is not implemented and should fail, but it should also not leak. To
allow the memory debugger to find leaks and fix this one we test this.
|
|
336e98bb
|
2019-05-06T14:51:52
|
|
Moved dwFlags declaration to beginning of scope
|
|
37a7adb5
|
2019-05-05T07:49:09
|
|
Support symlinks for directories in win32
|
|
d55bb479
|
2019-04-26T15:59:49
|
|
git_revwalk_push_range: do not crash if range is missing
If someone passes just one ref (i.e. "master") and misses passing the
range we should be nice and return an error code instead of crashing.
|
|
604e2811
|
2019-05-02T12:09:23
|
|
Merge pull request #5063 from pks-t/pks/cmake-regcomp-fix
cmake: correctly detect if system provides `regcomp`
|
|
957940bf
|
2019-05-02T12:04:04
|
|
Merge pull request #5023 from ianhattendorf/fix/lock_missing_global_config
Correctly write to missing locked global config
|
|
ee3d71fb
|
2019-04-26T08:01:56
|
|
cmake: fix include ordering issues with bundled deps
When linking against bundled libraries, we include their header
directories by using "-isystem". The reason for that is that we
want to handle our vendored library headers specially, most
importantly to ignore warnings generated by including them. By
using "-isystem", though, we screw up the order of searched
include directories by moving those bundled dependencies towards
the end of the lookup order. Like this, chances are high that any
other specified include directory contains a file that collides
with the actual desired include file.
Fix this by not treating the bundled dependencies' include
directories as system includes. This will move them to the front
of the lookup order and thus cause them to override
system-provided headers. While this may cause the compiler to
generate additional warnings when processing bundled headers,
this is a tradeoff we should make regardless to fix builds on
systems hitting this issue.
|
|
13cb9f7a
|
2019-02-25T11:35:16
|
|
cmake: correctly detect if system provides `regcomp`
We assume that if we are on Win32, Amiga OS, Solaris or SunOS,
that the regcomp(3P) function cannot be provided by the system.
Thus we will in these cases always include our own, bundled regex
sources to make a regcomp implementation available. This test is
obviously very fragile, and we have seen it fail on MSYS2/MinGW
systems, which do in fact provide the regcomp symbol. The effect
is that during compilation, we will use the "regex.h" header
provided by MinGW, but use symbols provided by ourselves. This
in fact may cause subtle memory layout issues, as the structure
made available via MinGW doesn't match what our bundled code
expects.
There's one more problem with our regex detection: on the listed
platforms, we will incorrectly include the bundled regex code
even in case where the system provides regcomp_l(3), but it will
never be used for anything.
Fix the issue by improving our regcomp detection code. Instead of
relying on a fragile listing of platforms, we can just use
`CHECK_FUNCTION_EXISTS` instead. This will not in fact avoid the
header-ordering problem. But we can assume that as soon as a
system-provided "regex.h" header is provided, that
`CHECK_FUNCTION_EXISTS` will now correctly find the desired
symbol and thus not include our bundled regex code.
|
|
e44110db
|
2019-03-20T12:28:45
|
|
Correctly write to missing locked global config
Opening a default config when ~/.gitconfig doesn't exist, locking it,
and attempting to write to it causes an assertion failure.
Treat non-existent global config file content as an empty string.
|
|
bc5b19e6
|
2019-04-29T09:01:45
|
|
Merge pull request #4561 from pks-t/pks/downcasting
[RFC] util: introduce GIT_DOWNCAST macro
|
|
0c71e4cb
|
2019-04-26T10:38:02
|
|
refspec: fix transforming nested stars
When we transform a refspec with a component containing a glob, then
we simply copy over the component until the next separator from
the matching ref. E.g. if we have a ref "refs/heads/foo/bar" and
a refspec "refs/heads/*/bar:refs/remotes/origin/*/bar", we:
1. Copy over everything until hitting the glob from the <dst>
part: "refs/remotes/origin/".
2. Strip the common prefix of ref and <src> part until the glob,
which is "refs/heads/". This leaves us with a ref of "foo/bar".
3. Copy from the ref until the next "/" separator, resulting in
"refs/remotes/origin/foo".
4. Copy over the remaining part of the <dst> spec, which is
"bar": "refs/remotes/origin/foo/bar".
This worked just fine in a world where globs in refspecs were
restricted such that a globbing component may only contain a
single "*", only. But this restriction has been lifted, so that a
glob component may be nested between other characters, causing
the above algorithm to fail. Most notably the third step, where
we copy until hitting the next "/" separator, might result in a
wrong transformation. Given e.g. a ref "refs/gbranchg/head" and a
refspec "refs/g*g/head:refs/remotes/origin/*", we'd also be
copying the "g" between "branch" and "/" and end up with the
wrong transformed ref "refs/remotes/origin/branchg".
Instead of copying until the next component separator, we should
copy until we hit the pattern after the "*". So in the above
example, we'd copy until hitting the string "g/head".
|
|
51214b85
|
2019-04-26T10:15:49
|
|
refs: loosen restriction on wildcard "*" refspecs
In commit cd377f45c9 (refs: loosen restriction on wildcard "*"
refspecs, 2015-07-22) in git.git, the restrictions on wildcard
"*" refspecs has been loosened. While wildcards were previously
only allowed if the component is a single "*", this was changed
to also accept other patterns as part of the component.
We never adapted to that change and still reject any wildcard
patterns that aren't a single "*" only. Update our tests to
reflect the upstream change and adjust our own code accordingly.
|
|
9d651e05
|
2019-04-26T09:09:46
|
|
tests: network::refspecs: add missing assert when parsing refspec
|
|
af95615f
|
2019-04-26T08:48:17
|
|
Merge pull request #5051 from pks-t/pks/examples-ssh-auth
examples: implement SSH authentication
|
|
e215f475
|
2019-04-21T21:36:36
|
|
rebase: orig_head and onto accessors
The rebase struct stores fields with information about the current
rebase process, which were not accessible via a public interface.
Accessors for getting the `orig_head` and `onto` branch
names and object ids have been added.
|
|
b3923cf7
|
2019-04-17T13:43:52
|
|
Merge pull request #5050 from libgit2/ethomson/windows_init_traversal
git_repository_init: stop traversing at windows root
|
|
45f24e78
|
2019-04-12T08:54:06
|
|
git_repository_init: stop traversing at windows root
Stop traversing the filesystem at the Windows directory root. We were
calculating the filesystem root for the given directory to create, and
walking up the filesystem hierarchy. We intended to stop when the
traversal path length is equal to the root path length (ie, stopping at
the root, since no path may be shorter than the root path).
However, on Windows, the root path may be specified in two different
ways, as either `Z:` or `Z:\`, where `Z:` is the current drive letter.
`git_path_dirname_r` returns the path _without_ a trailing slash, even
for the Windows root. As a result, during traversal, we need to test
that the traversal path is _less than or equal to_ the root path length
to determine if we've hit the root to ensure that we stop when our
traversal path is `Z:` and our calculated root path was `Z:\`.
|
|
9c402600
|
2019-04-16T18:17:56
|
|
Merge pull request #5053 from tniessen/cf-check-array-alloc-result
config_file: check result of git_array_alloc
|
|
cc8a9892
|
2019-04-16T18:13:31
|
|
config_file: check result of git_array_alloc
git_array_alloc can return NULL if no memory is available, causing
a segmentation fault in memset. This adds GIT_ERROR_CHECK_ALLOC
similar to how other parts of the code base deal with the return
value of git_array_alloc.
|
|
431601f2
|
2019-04-05T15:05:10
|
|
iterator: make use the `GIT_CONTAINER_OF` macro
|
|
b51789ac
|
2019-04-16T13:20:08
|
|
transports: make use of the `GIT_CONTAINER_OF` macro
|
|
2e246474
|
2019-04-16T13:19:53
|
|
refdb_fs: make use of the `GIT_CONTAINER_OF` macro
|
|
65203b5a
|
2019-04-16T13:21:16
|
|
config_file: make use of `GIT_CONTAINER_OF` macro
|
|
b5f40441
|
2019-04-16T13:21:03
|
|
util: introduce GIT_CONTAINER_OF macro
In some parts of our code, we make rather heavy use of casting
structures to their respective specialized implementation. One
example is the configuration code with the general
`git_config_backend` and the specialized `diskfile_header`
structures. At some occasions, it can get confusing though with
regards to the correct inheritance structure, which led to the
recent bug fixed in 2424e64c4 (config: harden our use of the
backend objects a bit, 2018-02-28).
Object-oriented programming in C is hard, but we can at least try
to have some checks when it comes to casting around stuff. Thus,
this commit introduces a `GIT_CONTAINER_OF` macro, which accepts
as parameters the pointer that is to be casted, the pointer it
should be cast to as well as the member inside of the target
structure that is the containing structure. This macro then tries
hard to detect mis-casts:
- It checks whether the source and target pointers are of the
same type. This requires support by the compiler, as it makes
use of the builtin `__builtin_types_compatible_p`.
- It checks whether the embedded member of the target structure
is the first member. In order to make this a compile-time
constant, the compiler-provided `__builtin_offsetof` is being
used for this.
- It ties these two checks together by the compiler-builtin
`__builtin_choose_expr`. Based on whether the previous two
checks evaluate to `true`, the compiler will either compile in
the correct cast, or it will output `(void)0`. The second case
results in a compiler error, resulting in a compile-time check
for wrong casts.
The only downside to this is that it relies heavily on
compiler-specific extensions. As both GCC and Clang support these
features, only define this macro like explained above in case
`__GNUC__` is set (Clang also defines `__GNUC__`). If the
compiler is not Clang or GCC, just go with a simple cast without
any additional checks.
|
|
ed959ca2
|
2019-04-16T12:36:24
|
|
Merge pull request #5027 from ddevault/master
patch_parse.c: Handle CRLF in parse_header_start
|
|
172786ec
|
2019-04-16T12:03:20
|
|
examples: use username provided via URL
The credentials callback may be passed a username in case where
the URL already includes the expected username. As we usually
cannot use a different username in such context, we should use
that one if provided and not ask the user for a diferent
username.
|
|
611fbe4f
|
2019-04-16T12:02:20
|
|
examples: implement SSH key credentials
Implement SSH key credentials. This allows users to use the SSH
transport with the lg2 example code.
|
|
d9351c65
|
2019-04-16T11:05:37
|
|
examples: implement SSH key credentials
Implement SSH key credentials. This allows users to use the SSH
transport with the lg2 example code.
|
|
e9aa8479
|
2019-04-16T10:52:47
|
|
examples: support plain username credentials
Implement plain username credential types. These type of
credentials might be asked for e.g. as some kind of
pre-authentication step, before the actual credentials are
passed.
|