Skip to content

patch_generate: represent buffers as void pointers#4304

Merged
ethomson merged 1 commit intolibgit2:masterfrom
pks-t:pks/patch-buffers
Jul 31, 2017
Merged

patch_generate: represent buffers as void pointers#4304
ethomson merged 1 commit intolibgit2:masterfrom
pks-t:pks/patch-buffers

Conversation

@pks-t
Copy link
Copy Markdown
Member

@pks-t pks-t commented Jul 10, 2017

Pointers to general data should usually be used as a void pointer such
that it is possible to hand in variables of a different pointer type
without the need to cast. This is the same when creating patches from
buffers, where the buffers may contain arbitrary data. Instead of
requiring the caller to care whether his buffer is e.g. char * or
unsigned char *, we should instead just accept a void *. This is
also consistent in how we tread other types like for example git_blob,
which also just has a void pointer as its raw contents.


Fixes #3986

Pointers to general data should usually be used as a void pointer such
that it is possible to hand in variables of a different pointer type
without the need to cast. This is the same when creating patches from
buffers, where the buffers may contain arbitrary data. Instead of
requiring the caller to care whether his buffer is e.g. `char *` or
`unsigned char *`, we should instead just accept a `void *`. This is
also consistent in how we tread other types like for example `git_blob`,
which also just has a void pointer as its raw contents.
@ethomson ethomson merged commit a9d6b9d into libgit2:master Jul 31, 2017
@pks-t pks-t deleted the pks/patch-buffers branch September 15, 2017 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants