Skip to content

Commit 452b7f8

Browse files
committed
Don't use enum for flags
Using an `enum` causes trouble when used with C++ as bitwise operations are not possible w/o casting (e.g., `opts.flags &= ~GIT_BLOB_FILTER_CHECK_FOR_BINARY;` is invalid as there is no `&=` operator for `enum`). Signed-off-by: Sven Strickroth <email@cs-ware.de>
1 parent 9cd5240 commit 452b7f8

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

include/git2/blob.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ typedef enum {
122122
typedef struct {
123123
int version;
124124

125-
/** Flags to control the filtering process */
126-
git_blob_filter_flag_t flags;
125+
/** Flags to control the filtering process, see `git_blob_filter_flag_t` above */
126+
uint32_t flags;
127127
} git_blob_filter_options;
128128

129129
#define GIT_BLOB_FILTER_OPTIONS_VERSION 1

include/git2/diff.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,8 @@ typedef enum {
13781378
typedef struct {
13791379
unsigned int version;
13801380

1381-
git_diff_format_email_flags_t flags;
1381+
/** see `git_diff_format_email_flags_t` above */
1382+
uint32_t flags;
13821383

13831384
/** This patch number */
13841385
size_t patch_no;
@@ -1435,7 +1436,7 @@ GIT_EXTERN(int) git_diff_commit_as_email(
14351436
git_commit *commit,
14361437
size_t patch_no,
14371438
size_t total_patches,
1438-
git_diff_format_email_flags_t flags,
1439+
uint32_t flags,
14391440
const git_diff_options *diff_opts);
14401441

14411442
/**

include/git2/merge.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ typedef struct {
192192
git_merge_file_favor_t favor;
193193

194194
/** see `git_merge_file_flag_t` above */
195-
git_merge_file_flag_t flags;
195+
uint32_t flags;
196196

197197
/** The size of conflict markers (eg, "<<<<<<<"). Default is
198198
* GIT_MERGE_CONFLICT_MARKER_SIZE. */
@@ -247,7 +247,7 @@ typedef struct {
247247
unsigned int version;
248248

249249
/** See `git_merge_flag_t` above */
250-
git_merge_flag_t flags;
250+
uint32_t flags;
251251

252252
/**
253253
* Similarity to consider a file renamed (default 50). If
@@ -291,7 +291,7 @@ typedef struct {
291291
git_merge_file_favor_t file_favor;
292292

293293
/** see `git_merge_file_flag_t` above */
294-
git_merge_file_flag_t file_flags;
294+
uint32_t file_flags;
295295
} git_merge_options;
296296

297297
#define GIT_MERGE_OPTIONS_VERSION 1

include/git2/stash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ typedef struct git_stash_apply_options {
127127
unsigned int version;
128128

129129
/** See `git_stash_apply_flags_t`, above. */
130-
git_stash_apply_flags flags;
130+
uint32_t flags;
131131

132132
/** Options to use when writing files to the working directory. */
133133
git_checkout_options checkout_options;

src/diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ int git_diff_commit_as_email(
323323
git_commit *commit,
324324
size_t patch_no,
325325
size_t total_patches,
326-
git_diff_format_email_flags_t flags,
326+
uint32_t flags,
327327
const git_diff_options *diff_opts)
328328
{
329329
git_diff *diff = NULL;

0 commit comments

Comments
 (0)