Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
420cbdc2
Commit
420cbdc2
authored
Aug 25, 2011
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #379 from kiryl/STRLEN
Drop STRLEN() macros
parents
a7e34e3c
85b91652
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
34 additions
and
36 deletions
+34
-36
src/commit.c
+1
-1
src/config_file.c
+1
-1
src/indexer.c
+4
-4
src/odb_pack.c
+1
-1
src/pack.c
+2
-2
src/pkt.c
+9
-9
src/remote.c
+1
-1
src/repository.c
+2
-2
src/revwalk.c
+4
-4
src/tag.c
+1
-1
src/transport_git.c
+5
-5
src/transport_local.c
+2
-2
src/util.h
+0
-2
tests/t15-config.c
+1
-1
No files found.
src/commit.c
View file @
420cbdc2
...
@@ -225,7 +225,7 @@ int commit_parse_buffer(git_commit *commit, const void *data, size_t len)
...
@@ -225,7 +225,7 @@ int commit_parse_buffer(git_commit *commit, const void *data, size_t len)
if
(
git__prefixcmp
(
buffer
,
"encoding "
)
==
0
)
{
if
(
git__prefixcmp
(
buffer
,
"encoding "
)
==
0
)
{
const
char
*
encoding_end
;
const
char
*
encoding_end
;
buffer
+=
STRLEN
(
"encoding "
);
buffer
+=
strlen
(
"encoding "
);
encoding_end
=
buffer
;
encoding_end
=
buffer
;
while
(
encoding_end
<
buffer_end
&&
*
encoding_end
!=
'\n'
)
while
(
encoding_end
<
buffer_end
&&
*
encoding_end
!=
'\n'
)
...
...
src/config_file.c
View file @
420cbdc2
...
@@ -264,7 +264,7 @@ static char *interiorize_section(const char *orig)
...
@@ -264,7 +264,7 @@ static char *interiorize_section(const char *orig)
len
=
dot
-
orig
;
len
=
dot
-
orig
;
memcpy
(
section
,
orig
,
len
);
memcpy
(
section
,
orig
,
len
);
section
+=
len
;
section
+=
len
;
len
=
STRLEN
(
"
\"
"
);
len
=
strlen
(
"
\"
"
);
memcpy
(
section
,
"
\"
"
,
len
);
memcpy
(
section
,
"
\"
"
,
len
);
section
+=
len
;
section
+=
len
;
len
=
last_dot
-
dot
-
1
;
len
=
last_dot
-
dot
-
1
;
...
...
src/indexer.c
View file @
420cbdc2
...
@@ -176,11 +176,11 @@ static void index_path(char *path, git_indexer *idx)
...
@@ -176,11 +176,11 @@ static void index_path(char *path, git_indexer *idx)
ptr
=
strrchr
(
path
,
'/'
)
+
1
;
ptr
=
strrchr
(
path
,
'/'
)
+
1
;
memcpy
(
ptr
,
prefix
,
STRLEN
(
prefix
));
memcpy
(
ptr
,
prefix
,
strlen
(
prefix
));
ptr
+=
STRLEN
(
prefix
);
ptr
+=
strlen
(
prefix
);
git_oid_fmt
(
ptr
,
&
idx
->
hash
);
git_oid_fmt
(
ptr
,
&
idx
->
hash
);
ptr
+=
GIT_OID_HEXSZ
;
ptr
+=
GIT_OID_HEXSZ
;
memcpy
(
ptr
,
suffix
,
STRLEN
(
suffix
));
memcpy
(
ptr
,
suffix
,
strlen
(
suffix
));
}
}
int
git_indexer_write
(
git_indexer
*
idx
)
int
git_indexer_write
(
git_indexer
*
idx
)
...
@@ -199,7 +199,7 @@ int git_indexer_write(git_indexer *idx)
...
@@ -199,7 +199,7 @@ int git_indexer_write(git_indexer *idx)
namelen
=
strlen
(
idx
->
pack
->
pack_name
);
namelen
=
strlen
(
idx
->
pack
->
pack_name
);
memcpy
(
filename
,
idx
->
pack
->
pack_name
,
namelen
);
memcpy
(
filename
,
idx
->
pack
->
pack_name
,
namelen
);
memcpy
(
filename
+
namelen
-
STRLEN
(
"pack"
),
"idx
\0
"
,
STRLEN
(
"idx
\0
"
)
);
memcpy
(
filename
+
namelen
-
strlen
(
"pack"
),
"idx"
,
strlen
(
"idx"
)
+
1
);
error
=
git_filebuf_open
(
&
idx
->
file
,
filename
,
GIT_FILEBUF_HASH_CONTENTS
);
error
=
git_filebuf_open
(
&
idx
->
file
,
filename
,
GIT_FILEBUF_HASH_CONTENTS
);
...
...
src/odb_pack.c
View file @
420cbdc2
...
@@ -237,7 +237,7 @@ static int packfile_load__cb(void *_data, char *path)
...
@@ -237,7 +237,7 @@ static int packfile_load__cb(void *_data, char *path)
for
(
i
=
0
;
i
<
backend
->
packs
.
length
;
++
i
)
{
for
(
i
=
0
;
i
<
backend
->
packs
.
length
;
++
i
)
{
struct
git_pack_file
*
p
=
git_vector_get
(
&
backend
->
packs
,
i
);
struct
git_pack_file
*
p
=
git_vector_get
(
&
backend
->
packs
,
i
);
if
(
memcmp
(
p
->
pack_name
,
path
,
strlen
(
path
)
-
STRLEN
(
".idx"
))
==
0
)
if
(
memcmp
(
p
->
pack_name
,
path
,
strlen
(
path
)
-
strlen
(
".idx"
))
==
0
)
return
GIT_SUCCESS
;
return
GIT_SUCCESS
;
}
}
...
...
src/pack.c
View file @
420cbdc2
...
@@ -196,7 +196,7 @@ static int pack_index_open(struct git_pack_file *p)
...
@@ -196,7 +196,7 @@ static int pack_index_open(struct git_pack_file *p)
return
GIT_SUCCESS
;
return
GIT_SUCCESS
;
idx_name
=
git__strdup
(
p
->
pack_name
);
idx_name
=
git__strdup
(
p
->
pack_name
);
strcpy
(
idx_name
+
strlen
(
idx_name
)
-
STRLEN
(
".pack"
),
".idx"
);
strcpy
(
idx_name
+
strlen
(
idx_name
)
-
strlen
(
".pack"
),
".idx"
);
error
=
pack_index_check
(
idx_name
,
p
);
error
=
pack_index_check
(
idx_name
,
p
);
free
(
idx_name
);
free
(
idx_name
);
...
@@ -614,7 +614,7 @@ int git_packfile_check(struct git_pack_file **pack_out, const char *path)
...
@@ -614,7 +614,7 @@ int git_packfile_check(struct git_pack_file **pack_out, const char *path)
* Make sure a corresponding .pack file exists and that
* Make sure a corresponding .pack file exists and that
* the index looks sane.
* the index looks sane.
*/
*/
path_len
-=
STRLEN
(
".idx"
);
path_len
-=
strlen
(
".idx"
);
if
(
path_len
<
1
)
{
if
(
path_len
<
1
)
{
free
(
p
);
free
(
p
);
return
git__throw
(
GIT_ENOTFOUND
,
"Failed to check packfile. Wrong path name"
);
return
git__throw
(
GIT_ENOTFOUND
,
"Failed to check packfile. Wrong path name"
);
...
...
src/pkt.c
View file @
420cbdc2
...
@@ -267,7 +267,7 @@ int git_pkt_send_flush(int s)
...
@@ -267,7 +267,7 @@ int git_pkt_send_flush(int s)
{
{
char
flush
[]
=
"0000"
;
char
flush
[]
=
"0000"
;
return
gitno_send
(
s
,
flush
,
STRLEN
(
flush
),
0
);
return
gitno_send
(
s
,
flush
,
strlen
(
flush
),
0
);
}
}
static
int
send_want_with_caps
(
git_remote_head
*
head
,
git_transport_caps
*
caps
,
int
fd
)
static
int
send_want_with_caps
(
git_remote_head
*
head
,
git_transport_caps
*
caps
,
int
fd
)
...
@@ -279,7 +279,7 @@ static int send_want_with_caps(git_remote_head *head, git_transport_caps *caps,
...
@@ -279,7 +279,7 @@ static int send_want_with_caps(git_remote_head *head, git_transport_caps *caps,
if
(
caps
->
ofs_delta
)
if
(
caps
->
ofs_delta
)
strcpy
(
capstr
,
GIT_CAP_OFS_DELTA
);
strcpy
(
capstr
,
GIT_CAP_OFS_DELTA
);
len
=
STRLEN
(
"XXXXwant "
)
+
GIT_OID_HEXSZ
+
1
/* NUL */
+
strlen
(
capstr
)
+
1
/* LF */
;
len
=
strlen
(
"XXXXwant "
)
+
GIT_OID_HEXSZ
+
1
/* NUL */
+
strlen
(
capstr
)
+
1
/* LF */
;
cmd
=
git__malloc
(
len
+
1
);
cmd
=
git__malloc
(
len
+
1
);
if
(
cmd
==
NULL
)
if
(
cmd
==
NULL
)
return
GIT_ENOMEM
;
return
GIT_ENOMEM
;
...
@@ -302,10 +302,10 @@ int git_pkt_send_wants(git_headarray *refs, git_transport_caps *caps, int fd)
...
@@ -302,10 +302,10 @@ int git_pkt_send_wants(git_headarray *refs, git_transport_caps *caps, int fd)
{
{
unsigned
int
i
=
0
;
unsigned
int
i
=
0
;
int
error
=
GIT_SUCCESS
;
int
error
=
GIT_SUCCESS
;
char
buf
[
STRLEN
(
WANT_PREFIX
)
+
GIT_OID_HEXSZ
+
2
];
char
buf
[
sizeof
(
WANT_PREFIX
)
+
GIT_OID_HEXSZ
+
1
];
git_remote_head
*
head
;
git_remote_head
*
head
;
memcpy
(
buf
,
WANT_PREFIX
,
STRLEN
(
WANT_PREFIX
));
memcpy
(
buf
,
WANT_PREFIX
,
strlen
(
WANT_PREFIX
));
buf
[
sizeof
(
buf
)
-
2
]
=
'\n'
;
buf
[
sizeof
(
buf
)
-
2
]
=
'\n'
;
buf
[
sizeof
(
buf
)
-
1
]
=
'\0'
;
buf
[
sizeof
(
buf
)
-
1
]
=
'\0'
;
...
@@ -332,8 +332,8 @@ int git_pkt_send_wants(git_headarray *refs, git_transport_caps *caps, int fd)
...
@@ -332,8 +332,8 @@ int git_pkt_send_wants(git_headarray *refs, git_transport_caps *caps, int fd)
if
(
head
->
local
)
if
(
head
->
local
)
continue
;
continue
;
git_oid_fmt
(
buf
+
STRLEN
(
WANT_PREFIX
),
&
head
->
oid
);
git_oid_fmt
(
buf
+
strlen
(
WANT_PREFIX
),
&
head
->
oid
);
error
=
gitno_send
(
fd
,
buf
,
STRLEN
(
buf
),
0
);
error
=
gitno_send
(
fd
,
buf
,
strlen
(
buf
),
0
);
return
git__rethrow
(
error
,
"Failed to send want pkt"
);
return
git__rethrow
(
error
,
"Failed to send want pkt"
);
}
}
...
@@ -350,13 +350,13 @@ int git_pkt_send_have(git_oid *oid, int fd)
...
@@ -350,13 +350,13 @@ int git_pkt_send_have(git_oid *oid, int fd)
{
{
char
buf
[]
=
"0032have 0000000000000000000000000000000000000000
\n
"
;
char
buf
[]
=
"0032have 0000000000000000000000000000000000000000
\n
"
;
git_oid_fmt
(
buf
+
STRLEN
(
HAVE_PREFIX
),
oid
);
git_oid_fmt
(
buf
+
strlen
(
HAVE_PREFIX
),
oid
);
return
gitno_send
(
fd
,
buf
,
STRLEN
(
buf
),
0
);
return
gitno_send
(
fd
,
buf
,
strlen
(
buf
),
0
);
}
}
int
git_pkt_send_done
(
int
fd
)
int
git_pkt_send_done
(
int
fd
)
{
{
char
buf
[]
=
"0009done
\n
"
;
char
buf
[]
=
"0009done
\n
"
;
return
gitno_send
(
fd
,
buf
,
STRLEN
(
buf
),
0
);
return
gitno_send
(
fd
,
buf
,
strlen
(
buf
),
0
);
}
}
src/remote.c
View file @
420cbdc2
...
@@ -93,7 +93,7 @@ int git_remote_get(git_remote **out, git_config *cfg, const char *name)
...
@@ -93,7 +93,7 @@ int git_remote_get(git_remote **out, git_config *cfg, const char *name)
}
}
/* "fetch" is the longest var name we're interested in */
/* "fetch" is the longest var name we're interested in */
buf_len
=
STRLEN
(
"remote."
)
+
STRLEN
(
".fetch"
)
+
strlen
(
name
)
+
1
;
buf_len
=
strlen
(
"remote."
)
+
strlen
(
".fetch"
)
+
strlen
(
name
)
+
1
;
buf
=
git__malloc
(
buf_len
);
buf
=
git__malloc
(
buf_len
);
if
(
buf
==
NULL
)
{
if
(
buf
==
NULL
)
{
error
=
GIT_ENOMEM
;
error
=
GIT_ENOMEM
;
...
...
src/repository.c
View file @
420cbdc2
...
@@ -449,12 +449,12 @@ static int read_gitfile(char *path_out, const char *file_path, const char *base_
...
@@ -449,12 +449,12 @@ static int read_gitfile(char *path_out, const char *file_path, const char *base_
for
(;
data
[
end_offset
]
==
'\r'
||
data
[
end_offset
]
==
'\n'
;
--
end_offset
);
for
(;
data
[
end_offset
]
==
'\r'
||
data
[
end_offset
]
==
'\n'
;
--
end_offset
);
data
[
end_offset
+
1
]
=
'\0'
;
data
[
end_offset
+
1
]
=
'\0'
;
if
(
STRLEN
(
GIT_FILE_CONTENT_PREFIX
)
==
end_offset
+
1
)
{
if
(
strlen
(
GIT_FILE_CONTENT_PREFIX
)
==
end_offset
+
1
)
{
git_futils_freebuffer
(
&
file
);
git_futils_freebuffer
(
&
file
);
return
git__throw
(
GIT_ENOTFOUND
,
"No path in git file `%s`"
,
file_path
);
return
git__throw
(
GIT_ENOTFOUND
,
"No path in git file `%s`"
,
file_path
);
}
}
data
=
data
+
STRLEN
(
GIT_FILE_CONTENT_PREFIX
);
data
=
data
+
strlen
(
GIT_FILE_CONTENT_PREFIX
);
error
=
git_path_prettify_dir
(
path_out
,
data
,
base_path
);
error
=
git_path_prettify_dir
(
path_out
,
data
,
base_path
);
git_futils_freebuffer
(
&
file
);
git_futils_freebuffer
(
&
file
);
...
...
src/revwalk.c
View file @
420cbdc2
...
@@ -183,7 +183,7 @@ static commit_object *commit_lookup(git_revwalk *walk, const git_oid *oid)
...
@@ -183,7 +183,7 @@ static commit_object *commit_lookup(git_revwalk *walk, const git_oid *oid)
static
int
commit_quick_parse
(
git_revwalk
*
walk
,
commit_object
*
commit
,
git_rawobj
*
raw
)
static
int
commit_quick_parse
(
git_revwalk
*
walk
,
commit_object
*
commit
,
git_rawobj
*
raw
)
{
{
const
int
parent_len
=
STRLEN
(
"parent "
)
+
GIT_OID_HEXSZ
+
1
;
const
int
parent_len
=
strlen
(
"parent "
)
+
GIT_OID_HEXSZ
+
1
;
unsigned
char
*
buffer
=
raw
->
data
;
unsigned
char
*
buffer
=
raw
->
data
;
unsigned
char
*
buffer_end
=
buffer
+
raw
->
len
;
unsigned
char
*
buffer_end
=
buffer
+
raw
->
len
;
...
@@ -192,10 +192,10 @@ static int commit_quick_parse(git_revwalk *walk, commit_object *commit, git_rawo
...
@@ -192,10 +192,10 @@ static int commit_quick_parse(git_revwalk *walk, commit_object *commit, git_rawo
int
i
,
parents
=
0
;
int
i
,
parents
=
0
;
long
commit_time
;
long
commit_time
;
buffer
+=
STRLEN
(
"tree "
)
+
GIT_OID_HEXSZ
+
1
;
buffer
+=
strlen
(
"tree "
)
+
GIT_OID_HEXSZ
+
1
;
parents_start
=
buffer
;
parents_start
=
buffer
;
while
(
buffer
+
parent_len
<
buffer_end
&&
memcmp
(
buffer
,
"parent "
,
STRLEN
(
"parent "
))
==
0
)
{
while
(
buffer
+
parent_len
<
buffer_end
&&
memcmp
(
buffer
,
"parent "
,
strlen
(
"parent "
))
==
0
)
{
parents
++
;
parents
++
;
buffer
+=
parent_len
;
buffer
+=
parent_len
;
}
}
...
@@ -208,7 +208,7 @@ static int commit_quick_parse(git_revwalk *walk, commit_object *commit, git_rawo
...
@@ -208,7 +208,7 @@ static int commit_quick_parse(git_revwalk *walk, commit_object *commit, git_rawo
for
(
i
=
0
;
i
<
parents
;
++
i
)
{
for
(
i
=
0
;
i
<
parents
;
++
i
)
{
git_oid
oid
;
git_oid
oid
;
if
(
git_oid_fromstr
(
&
oid
,
(
char
*
)
buffer
+
STRLEN
(
"parent "
))
<
GIT_SUCCESS
)
if
(
git_oid_fromstr
(
&
oid
,
(
char
*
)
buffer
+
strlen
(
"parent "
))
<
GIT_SUCCESS
)
return
git__throw
(
GIT_EOBJCORRUPTED
,
"Failed to parse commit. Parent object is corrupted"
);
return
git__throw
(
GIT_EOBJCORRUPTED
,
"Failed to parse commit. Parent object is corrupted"
);
commit
->
parents
[
i
]
=
commit_lookup
(
walk
,
&
oid
);
commit
->
parents
[
i
]
=
commit_lookup
(
walk
,
&
oid
);
...
...
src/tag.c
View file @
420cbdc2
...
@@ -388,7 +388,7 @@ typedef struct {
...
@@ -388,7 +388,7 @@ typedef struct {
const
char
*
pattern
;
const
char
*
pattern
;
}
tag_filter_data
;
}
tag_filter_data
;
#define GIT_REFS_TAGS_DIR_LEN
STRLEN
(GIT_REFS_TAGS_DIR)
#define GIT_REFS_TAGS_DIR_LEN
strlen
(GIT_REFS_TAGS_DIR)
static
int
tag_list_cb
(
const
char
*
tag_name
,
void
*
payload
)
static
int
tag_list_cb
(
const
char
*
tag_name
,
void
*
payload
)
{
{
...
...
src/transport_git.c
View file @
420cbdc2
...
@@ -73,7 +73,7 @@ static int gen_proto(char **out, int *outlen, const char *cmd, const char *url)
...
@@ -73,7 +73,7 @@ static int gen_proto(char **out, int *outlen, const char *cmd, const char *url)
if
(
cmd
==
NULL
)
if
(
cmd
==
NULL
)
cmd
=
default_command
;
cmd
=
default_command
;
len
=
4
+
strlen
(
cmd
)
+
1
+
strlen
(
repo
)
+
1
+
STRLEN
(
host
)
+
(
delim
-
url
)
+
2
;
len
=
4
+
strlen
(
cmd
)
+
1
+
strlen
(
repo
)
+
1
+
strlen
(
host
)
+
(
delim
-
url
)
+
2
;
*
out
=
git__malloc
(
len
);
*
out
=
git__malloc
(
len
);
if
(
*
out
==
NULL
)
if
(
*
out
==
NULL
)
...
@@ -148,7 +148,7 @@ static int do_connect(transport_git *t, const char *url)
...
@@ -148,7 +148,7 @@ static int do_connect(transport_git *t, const char *url)
int
error
,
connected
=
0
;
int
error
,
connected
=
0
;
if
(
!
git__prefixcmp
(
url
,
prefix
))
if
(
!
git__prefixcmp
(
url
,
prefix
))
url
+=
STRLEN
(
prefix
);
url
+=
strlen
(
prefix
);
error
=
extract_host_and_port
(
&
host
,
&
port
,
url
);
error
=
extract_host_and_port
(
&
host
,
&
port
,
url
);
s
=
gitno_connect
(
host
,
port
);
s
=
gitno_connect
(
host
,
port
);
...
@@ -242,7 +242,7 @@ static int detect_caps(transport_git *t)
...
@@ -242,7 +242,7 @@ static int detect_caps(transport_git *t)
if
(
!
git__prefixcmp
(
ptr
,
GIT_CAP_OFS_DELTA
))
{
if
(
!
git__prefixcmp
(
ptr
,
GIT_CAP_OFS_DELTA
))
{
caps
->
common
=
caps
->
ofs_delta
=
1
;
caps
->
common
=
caps
->
ofs_delta
=
1
;
ptr
+=
STRLEN
(
GIT_CAP_OFS_DELTA
);
ptr
+=
strlen
(
GIT_CAP_OFS_DELTA
);
continue
;
continue
;
}
}
...
@@ -474,9 +474,9 @@ static int store_pack(char **out, gitno_buffer *buf, git_repository *repo)
...
@@ -474,9 +474,9 @@ static int store_pack(char **out, gitno_buffer *buf, git_repository *repo)
strcpy
(
path
,
repo
->
path_repository
);
strcpy
(
path
,
repo
->
path_repository
);
off
+=
strlen
(
repo
->
path_repository
);
off
+=
strlen
(
repo
->
path_repository
);
strcat
(
path
,
suff
);
strcat
(
path
,
suff
);
//memcpy(path + off, suff, GIT_PATH_MAX - off -
STRLEN
(suff) - 1);
//memcpy(path + off, suff, GIT_PATH_MAX - off -
strlen
(suff) - 1);
if
(
memcmp
(
buf
->
data
,
"PACK"
,
STRLEN
(
"PACK"
)))
{
if
(
memcmp
(
buf
->
data
,
"PACK"
,
strlen
(
"PACK"
)))
{
return
git__throw
(
GIT_ERROR
,
"The pack doesn't start with the signature"
);
return
git__throw
(
GIT_ERROR
,
"The pack doesn't start with the signature"
);
}
}
...
...
src/transport_local.c
View file @
420cbdc2
...
@@ -31,7 +31,7 @@ static int local_connect(git_transport *transport, int GIT_UNUSED(direction))
...
@@ -31,7 +31,7 @@ static int local_connect(git_transport *transport, int GIT_UNUSED(direction))
/* The repo layer doesn't want the prefix */
/* The repo layer doesn't want the prefix */
if
(
!
git__prefixcmp
(
transport
->
url
,
file_prefix
))
if
(
!
git__prefixcmp
(
transport
->
url
,
file_prefix
))
path
=
transport
->
url
+
STRLEN
(
file_prefix
);
path
=
transport
->
url
+
strlen
(
file_prefix
);
else
else
path
=
transport
->
url
;
path
=
transport
->
url
;
...
@@ -92,7 +92,7 @@ static int add_ref(const char *name, git_repository *repo, git_vector *vec)
...
@@ -92,7 +92,7 @@ static int add_ref(const char *name, git_repository *repo, git_vector *vec)
/* And if it's a tag, peel it, and add it to the list */
/* And if it's a tag, peel it, and add it to the list */
head
=
git__malloc
(
sizeof
(
git_remote_head
));
head
=
git__malloc
(
sizeof
(
git_remote_head
));
peel_len
=
strlen
(
name
)
+
STRLEN
(
peeled
);
peel_len
=
strlen
(
name
)
+
strlen
(
peeled
);
head
->
name
=
git__malloc
(
peel_len
+
1
);
head
->
name
=
git__malloc
(
peel_len
+
1
);
ret
=
p_snprintf
(
head
->
name
,
peel_len
+
1
,
"%s%s"
,
name
,
peeled
);
ret
=
p_snprintf
(
head
->
name
,
peel_len
+
1
,
"%s%s"
,
name
,
peeled
);
if
(
ret
>=
peel_len
+
1
)
{
if
(
ret
>=
peel_len
+
1
)
{
...
...
src/util.h
View file @
420cbdc2
...
@@ -93,8 +93,6 @@ extern char *git__strtok(char **end, const char *sep);
...
@@ -93,8 +93,6 @@ extern char *git__strtok(char **end, const char *sep);
extern
void
git__strntolower
(
char
*
str
,
int
len
);
extern
void
git__strntolower
(
char
*
str
,
int
len
);
extern
void
git__strtolower
(
char
*
str
);
extern
void
git__strtolower
(
char
*
str
);
#define STRLEN(str) (sizeof(str) - 1)
extern
int
git__fnmatch
(
const
char
*
pattern
,
const
char
*
name
,
int
flags
);
extern
int
git__fnmatch
(
const
char
*
pattern
,
const
char
*
name
,
int
flags
);
/*
/*
...
...
tests/t15-config.c
View file @
420cbdc2
...
@@ -300,7 +300,7 @@ BEGIN_TEST(config16, "add a variable in a new section")
...
@@ -300,7 +300,7 @@ BEGIN_TEST(config16, "add a variable in a new section")
/* As the section wasn't removed, owerwrite the file */
/* As the section wasn't removed, owerwrite the file */
must_pass
(
git_filebuf_open
(
&
buf
,
CONFIG_BASE
"/config10"
,
0
));
must_pass
(
git_filebuf_open
(
&
buf
,
CONFIG_BASE
"/config10"
,
0
));
must_pass
(
git_filebuf_write
(
&
buf
,
"[empty]
\n
"
,
STRLEN
(
"[empty]
\n
"
)));
must_pass
(
git_filebuf_write
(
&
buf
,
"[empty]
\n
"
,
strlen
(
"[empty]
\n
"
)));
must_pass
(
git_filebuf_commit
(
&
buf
));
must_pass
(
git_filebuf_commit
(
&
buf
));
END_TEST
END_TEST
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment