Unbloat the build

This change resurrects ae5d06dc53
This commit is contained in:
Justine Tunney 2022-08-11 00:15:29 -07:00
parent 2d64b9994b
commit 10fd8bdb70
1397 changed files with 1204 additions and 5031 deletions

View file

@ -16,16 +16,17 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/log/log.h"
#include "libc/bits/likely.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/x/x.h"
/**
* Allocates new copy of string, or dies.
*/
char *xstrdup(const char *s) {
void *res = strdup(s);
if (!res) xdie();
return res;
size_t len = strlen(s);
char *s2 = malloc(len + 1);
if (UNLIKELY(!s2)) xdie();
return memcpy(s2, s, len + 1);
}