summaryrefslogtreecommitdiffstats
path: root/util/path.c
Commit message (Collapse)AuthorAgeFilesLines
* util/path: Do not cache all filenames at startupRichard Henderson2019-06-241-150/+43Star
| | | | | | | | | | | | | | | | | | If one uses -L $PATH to point to a full chroot, the startup time is significant. In addition, the existing probing algorithm fails to handle symlink loops. Instead, probe individual paths on demand. Cache both positive and negative results within $PATH, so that any one filename is probed only once. Use glib filename functions for clarity. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Tested-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20190519201953.20161-2-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* util: Removed unneeded header from path.cSuramya Shah2017-03-141-1/+0Star
| | | | | | | Signed-off-by: Suramya Shah <shah.suramya@gmail.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20170310163948.7567-1-shah.suramya@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* util: move declarations out of qemu-common.hVeronia Bahaa2016-03-221-0/+2
| | | | | | | | | | Move declarations out of qemu-common.h for functions declared in utils/ files: e.g. include/qemu/path.h for utils/path.c. Move inline functions out of qemu-common.h and into new files (e.g. include/qemu/bcd.h) Signed-off-by: Veronia Bahaa <veroniabahaa@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* util: Clean up includesPeter Maydell2016-02-041-6/+1Star
| | | | | | | | | | Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-6-git-send-email-peter.maydell@linaro.org
* util/path: Use the GLib memory allocation routineszhanghailiang2014-08-241-5/+5
| | | | | | | | | | | In this file, we don't check the return value of malloc/strdup/realloc which may fail. Instead of using these routines, we use the GLib memory APIs g_malloc/g_strdup/g_realloc. They will exit on allocation failure, so there is no need to test for failure, which would be fine for setup. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* init_paths: fix minor memory leakKirill Batuzov2014-04-281-1/+3
| | | | | | | | | Fields "name" (created with strdup in new_entry) and "pathname" (created with g_strdup_printf in new_entry) of pathelem struct should be freed before the whole struct is. Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* util/path: Fix type which is longer than 8 bit for MinGWStefan Weil2013-10-051-2/+2
| | | | | | | | | | | | | | While dirent->d_type is 8 bit for most systems, it is 32 bit for MinGW. Reducing it to 8 bit results in a compiler warning because the macro is_dir_maybe compares that 8 bit value with 32 bit constants. Using 'unsigned' instead of 'unsigned char' matches the declaration for MinGW and does not harm the other systems. MinGW-w64 is not affected: it does not declare d_type. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* Replace non-portable asprintf by g_strdup_printfStefan Weil2013-01-191-4/+1Star
| | | | | | | | g_strdup_printf already handles OOM errors, so some error handling in QEMU code can be removed. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* build: move libqemuutil.a components to util/Paolo Bonzini2013-01-121-0/+182
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>