funcs.c (191736) | funcs.c (192348) |
---|---|
1/* 2 * Copyright (c) Christos Zoulas 2003. 3 * All Rights Reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27#include "file.h" 28 29#ifndef lint | 1/* 2 * Copyright (c) Christos Zoulas 2003. 3 * All Rights Reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27#include "file.h" 28 29#ifndef lint |
30FILE_RCSID("@(#)$File: funcs.c,v 1.51 2008/11/07 18:57:28 christos Exp $") | 30FILE_RCSID("@(#)$File: funcs.c,v 1.53 2009/04/07 11:07:00 christos Exp $") |
31#endif /* lint */ 32 33#include "magic.h" 34#include <stdarg.h> 35#include <stdlib.h> 36#include <string.h> 37#include <ctype.h> 38#if defined(HAVE_WCHAR_H) --- 259 unchanged lines hidden (view full) --- 298 299protected int 300file_reset(struct magic_set *ms) 301{ 302 if (ms->mlist == NULL) { 303 file_error(ms, 0, "no magic files loaded"); 304 return -1; 305 } | 31#endif /* lint */ 32 33#include "magic.h" 34#include <stdarg.h> 35#include <stdlib.h> 36#include <string.h> 37#include <ctype.h> 38#if defined(HAVE_WCHAR_H) --- 259 unchanged lines hidden (view full) --- 298 299protected int 300file_reset(struct magic_set *ms) 301{ 302 if (ms->mlist == NULL) { 303 file_error(ms, 0, "no magic files loaded"); 304 return -1; 305 } |
306 ms->o.buf = NULL; | 306 if (ms->o.buf) { 307 free(ms->o.buf); 308 ms->o.buf = NULL; 309 } 310 if (ms->o.pbuf) { 311 free(ms->o.pbuf); 312 ms->o.pbuf = NULL; 313 } |
307 ms->event_flags &= ~EVENT_HAD_ERR; 308 ms->error = -1; 309 return 0; 310} 311 312#define OCTALIFY(n, o) \ 313 /*LINTED*/ \ 314 (void)(*(n)++ = '\\', \ --- 105 unchanged lines hidden --- | 314 ms->event_flags &= ~EVENT_HAD_ERR; 315 ms->error = -1; 316 return 0; 317} 318 319#define OCTALIFY(n, o) \ 320 /*LINTED*/ \ 321 (void)(*(n)++ = '\\', \ --- 105 unchanged lines hidden --- |