replace {pre,suf}fixcmp() with {starts,ends}_with()
Leaving only the function definitions and declarations so that any new topic in flight can still make use of the old functions, replace existing uses of the prefixcmp() and suffixcmp() with new API functions. The change can be recreated by mechanically applying this: $ git grep -l -e prefixcmp -e suffixcmp -- \*.c | grep -v strbuf\\.c | xargs perl -pi -e ' s|!prefixcmp\(|starts_with\(|g; s|prefixcmp\(|!starts_with\(|g; s|!suffixcmp\(|ends_with\(|g; s|suffixcmp\(|!ends_with\(|g; ' on the result of preparatory changes in this series. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
956623157f
commit
5955654823
@ -19,7 +19,7 @@ static void handle_command(const char *command, const char *arg, struct line_buf
|
||||
{
|
||||
switch (*command) {
|
||||
case 'b':
|
||||
if (!prefixcmp(command, "binary ")) {
|
||||
if (starts_with(command, "binary ")) {
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
strbuf_addch(&sb, '>');
|
||||
buffer_read_binary(buf, &sb, strtouint32(arg));
|
||||
@ -28,12 +28,12 @@ static void handle_command(const char *command, const char *arg, struct line_buf
|
||||
return;
|
||||
}
|
||||
case 'c':
|
||||
if (!prefixcmp(command, "copy ")) {
|
||||
if (starts_with(command, "copy ")) {
|
||||
buffer_copy_bytes(buf, strtouint32(arg));
|
||||
return;
|
||||
}
|
||||
case 's':
|
||||
if (!prefixcmp(command, "skip ")) {
|
||||
if (starts_with(command, "skip ")) {
|
||||
buffer_skip_bytes(buf, strtouint32(arg));
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user