source: MondoRescue/branches/3.3/mindi-busybox/libbb/auto_string.c@ 3647

Last change on this file since 3647 was 3621, checked in by Bruno Cornec, 10 years ago

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

  • Property svn:eol-style set to native
File size: 435 bytes
Line 
1/* vi: set sw=4 ts=4: */
2/*
3 * Utility routines.
4 *
5 * Copyright (C) 2015 Denys Vlasenko
6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */
9//kbuild:lib-y += auto_string.o
10
11#include "libbb.h"
12
13char* FAST_FUNC auto_string(char *str)
14{
15 static char *saved[4];
16 static uint8_t cur_saved; /* = 0 */
17
18 free(saved[cur_saved]);
19 saved[cur_saved] = str;
20 cur_saved = (cur_saved + 1) & (ARRAY_SIZE(saved)-1);
21
22 return str;
23}
Note: See TracBrowser for help on using the repository browser.