mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-27 15:52:28 +00:00
Rearrange code and make a faster sha256sum program
This commit is contained in:
parent
5e60e5ad10
commit
89d1e5b8f2
32 changed files with 933 additions and 517 deletions
|
@ -16,6 +16,8 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/lock.internal.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
|
@ -35,7 +37,12 @@ int setvbuf(FILE *f, char *buf, int mode, size_t size) {
|
|||
flockfile(f);
|
||||
if (buf) {
|
||||
if (!size) size = BUFSIZ;
|
||||
if (!f->nofree && f->buf != buf) free_s(&f->buf);
|
||||
if (!f->nofree && //
|
||||
f->buf != buf && //
|
||||
f->buf != f->mem && //
|
||||
_weaken(free)) {
|
||||
_weaken(free)(f->buf);
|
||||
}
|
||||
f->buf = buf;
|
||||
f->size = size;
|
||||
f->nofree = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue