Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strbuf.c|h: Add the constant version initialization method of strbuf #824

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

adlternative
Copy link

According to
https://public-inbox.org/git/nycvar.QRO.7.76.6.1806210857520.11870@tvgsbejvaqbjf.bet/,
we can create a new way to initialize strbuf with string constant
to save the overhead of dynamically allocated memory.
the marco function STRBUF_INIT_CONST(str).For Example,STRBUF_ININ_DEFAULT("default")
will create a strbuf which buf eqoal to "default",len eqoal to 7 and alloc eqoal to 0.
this constant strbuf will be changed to dynamic allocation when we want to modify the contents of the constant buffer,
the function strbuf_const_to_no_const do this by change buf with xstrdup,
some function like strbuf_grow and strbuf_setlen will use it,
to change the strbuf to a dynamically expand buffer.

Signed-off-by: ZheNing Hu adlternative@gmail.com

According to
https://public-inbox.org/git/nycvar.QRO.7.76.6.1806210857520.11870@tvgsbejvaqbjf.bet/,
we can create a new way to initialize strbuf with string constant
to save the overhead of dynamically allocated memory.
the marco function STRBUF_INIT_CONST(str).For Example,STRBUF_ININ_DEFAULT("default")
will create a strbuf which buf eqoal to "default",len eqoal to 7 and alloc eqoal to 0.
this constant strbuf will be changed to dynamic allocation when we want to modify the contents of the constant buffer,
the function strbuf_const_to_no_const do this by change buf with xstrdup,
some function like strbuf_grow and strbuf_setlen will use it,
to change the strbuf to a dynamically expand buffer.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
@gitgitgadget
Copy link

gitgitgadget bot commented Dec 26, 2020

There are issues in commit 85e1e49:
The first line must be separated from the rest by an empty line
Prefixed commit message must be in lower case: strbuf.c|h: Add the constant version initialization method of strbuf

According to
https://public-inbox.org/git/nycvar.QRO.7.76.6.1806210857520.11870@tvgsbejvaqbjf.bet/,
we can create a new way to initialize strbuf with string constant
to save the overhead of dynamically allocated memory.
the marco function STRBUF_INIT_CONST(str).For Example,STRBUF_ININ_DEFAULT("default")
will create a strbuf which buf eqoal to "default",len eqoal to 7 and alloc eqoal to 0.
this constant strbuf will be changed to dynamic allocation when we want to modify the
contents of the constant buffer,the function strbuf_const_to_no_const do this by change
buf with xstrdup,some function like strbuf_grow and strbuf_setlen will use it,to change
the strbuf to a dynamically expand buffer.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
@gitgitgadget
Copy link

gitgitgadget bot commented Dec 26, 2020

There are issues in commit 85e1e49:
The first line must be separated from the rest by an empty line
Prefixed commit message must be in lower case: strbuf.c|h: Add the constant version initialization method of strbuf

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 26, 2020

There are issues in commit e1bce64:
The first line must be separated from the rest by an empty line
Prefixed commit message must be in lower case: strbuf.c|h: Add the constant version initiazation method of strbuf

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 29, 2020

There are issues in commit 85e1e49:
The first line must be separated from the rest by an empty line
Prefixed commit message must be in lower case: strbuf.c|h: Add the constant version initialization method of strbuf

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 29, 2020

There are issues in commit e1bce64:
The first line must be separated from the rest by an empty line
Prefixed commit message must be in lower case: strbuf.c|h: Add the constant version initiazation method of strbuf

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 29, 2020

There is an issue in commit 0a3283f:
Commit not signed off

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 29, 2020

There is an issue in commit 25ded82:
First line of commit message is too long (> 76 columns): strbuf.c:change function strbuf_const_to_no_const with xmalloc instead of use xstrdup.

it's strange ,I don't know why there is a position that strbuf can with zero
alloc and not zero len.so I temporarily removed it.Does that mean there be
something wrong with my previous Inference?(A const strbuf with zero alloc
and no zero len,A no const strbuf with no zero alloc and no zero len)

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
@gitgitgadget
Copy link

gitgitgadget bot commented Dec 29, 2020

There are issues in commit 85e1e49:
The first line must be separated from the rest by an empty line
Prefixed commit message must be in lower case: strbuf.c|h: Add the constant version initialization method of strbuf

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 29, 2020

There are issues in commit e1bce64:
The first line must be separated from the rest by an empty line
Prefixed commit message must be in lower case: strbuf.c|h: Add the constant version initiazation method of strbuf

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 29, 2020

There is an issue in commit 0a3283f:
Commit not signed off

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 29, 2020

There is an issue in commit 25ded82:
First line of commit message is too long (> 76 columns): strbuf.c:change function strbuf_const_to_no_const with xmalloc instead of use xstrdup.

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.

None yet

1 participant