summaryrefslogtreecommitdiff
path: root/parseutils.c
Commit message (Collapse)AuthorAgeFilesLines
* Mark more pointers as constAlan Coopersmith2023-01-031-2/+2
| | | | | | Some suggested by cppcheck, others by manual code inspection Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Stop building more unused functionsAlan Coopersmith2023-01-031-0/+2
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Replace malloc()+bzero() pairs with calloc() callsAlan Coopersmith2022-12-111-18/+9
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Remove unnecessary checks for NULL pointers before calling free()Alan Coopersmith2022-12-111-9/+5
| | | | | | Not needed in C89 and later Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Replace uFree() with direct free() callsAlan Coopersmith2022-12-111-10/+10
| | | | | | | All these wrappers did was mess with types and add a test for NULL pointers that isn't needed in C89 and later. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Replace uTypedRecalloc() with direct recallocarray() callsAlan Coopersmith2022-12-111-4/+4
| | | | | | Retains uRecalloc() as a fallback for platforms without recallocarray() Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Replace uCalloc() and uTypedCalloc() with direct calloc() callsAlan Coopersmith2022-12-111-1/+1
| | | | | | All these wrappers did was mess with types. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Replace uAlloc() and uTypedAlloc() with direct malloc() callsAlan Coopersmith2022-12-111-26/+26
| | | | | | All these wrappers did was mess with types. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Use C99 struct initializersAlan Coopersmith2022-12-111-115/+165
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Variable scope reductionsAlan Coopersmith2022-12-111-14/+11
| | | | | | Some found by cppcheck, some found by manual code inspection Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Replace WARN[1-9], ERROR[1-9], etc. with their unnumbered versionPeter Hutterer2021-01-211-3/+3
| | | | | | | | | | | | Those macros date back to when varargs weren't a thing but they've been #defined to the same value for 17 years now. Patch generated with: for action in WARN INFO ERROR ACTION FATAL WSGO; do sed -i "s/${action}[1-9]/${action}/g" `git ls-files` done Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Remove trailing whitespacesPeter Hutterer2021-01-211-9/+9
| | | | | | Let's clean this up so I don't have to fight vim and git in removing them. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Stop including <X11/Xalloca.h> in parseutils.cAlan Coopersmith2015-03-031-1/+0
| | | | | | | | I can not find any point in our git history at which alloca() or the Xalloca.h macros ALLOCATE_LOCAL() & DEALLOCATE_LOCAL() were actually used in this source file. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Remove useless checks for NULL before free in OverlayKeyCreate()Alan Coopersmith2014-03-101-4/+2
| | | | | | | | | | | | | | | | | | There is no need to ensure the pointers passed to free are not NULL, especially right after passing them to strncpy without checking for NULL. Flagged by cppcheck 1.64: [app/xkbcomp/parseutils.c:557] -> [app/xkbcomp/parseutils.c:559]: (warning) Possible null pointer dereference: over - otherwise it is redundant to check it against null. [app/xkbcomp/parseutils.c:558] -> [app/xkbcomp/parseutils.c:561]: (warning) Possible null pointer dereference: under - otherwise it is redundant to check it against null. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
* Reset scan state when opening a new fileDaniel Stone2012-11-011-1/+1
| | | | | | | | | | | | | | | | | When we opened a new file after encountering a parse error, we weren't resetting our scan state, and continued to read out of the old buffer rather than that of the new file. Fixes a regression introduced in 9887842e ('Use fread() instead of getc()'). Test case: xkbcomp -lfhlpR "path/to/xkeyboard-config.git/symbols/*" The Makefiles in that tree would cause parse errors, the resulting directory file is incomplete (down from ~12000 to ~230 lines). Reported-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* Fix -Wformat warningsJeremy Huddleston2011-11-111-2/+2
| | | | Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
* Interp: Allow explicit Any/NoSymbol mappingsDaniel Stone2011-06-211-2/+5
| | | | | | | | | | | | | | | | | | | | | Brown paper bag in full effect. The previous fix, while crushing the previous problem where an unknown keysym for an interp def would lead to every key matching it, also ignored explicit Any+AnyOfOrNone(All) mappings. Such as the one xkeyboard-config relied on for Control to actually update the modifier state. Fix this by allowing mappings explicitly declared as Any/NoSymbol, while ignoring only those with failed keysym lookups. Unfortunately, due to the structure of the parser, it's a deeply inelegant fix. Verified with a quick check of all layouts (albeit using default variants only) in xkeyboard-config that this results in no changes to the output at all, compared to xkbcomp 1.1.1. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* Constify LookupKeysym input argumentDaniel Stone2011-06-211-1/+1
| | | | Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* limits.h is mandated by C89, no need to check for itDaniel Stone2010-07-121-2/+0
| | | | | | | | Alan Coopersmith pointed out that C89 mandates limits.h, so for once in X's life, checking for a system header is just being unnecessarily paranoid. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* Fix parsing of 0x1a2b3c4d-style symbolsDaniel Stone2010-07-091-0/+12
| | | | | | | | Raw keysyms were not getting parsed correctly, due to forgetting to add the code to libX11, forgetting to add the backwards-compat code for old libX11s, and then stuffing the lexing up anyway. Yeesh. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* Lazy keysym parsing (avoid XStringToKeysym)Daniel Stone2010-06-151-5/+5
| | | | | | | Instead of calling XStringToKeysym on every keysym we parse, store it as a string until we need to store it in an actual keymap. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* Correct make distcheck and most gcc and sparse warnings.Paulo Cesar Pereira de Andrade2009-01-211-1/+0
| | | | | | | | | | | | | | | | | | | | Remaining warnings are due to macros that check address or vectors on the stack and auto generated yacc code. Compiled with default flags and also as: % make CFLAGS=-DENTRY_TRACKING_ON -DDEBUG_ON -DASSERTIONS_ON to ensure the "simplification" of code like: foo.c: <hash>define DEBUG_VAR foo_VAR <hash>include "foo.h" ... foo.h: <hash>ifdef DEBUG_VAR_NOT_LOCAL extern <hash>endif int DEBUG_VAR; ... did not change the author's "intended" logic.
* Indent fixes.Peter Hutterer2008-08-121-488/+577
| | | | indent -cbi 0 -nprs -nut -npcs -i4 -bli 0 *.c *.h
* Remove RCS tags.Peter Hutterer2008-08-121-2/+0
|
* Merging XORG-CURRENT into trunkXORG-6_7_99_904XORG-6_7_99_903XORG-6_7_99_902XORG-6_7_99_901XORG-6_7_99_2XORG-6_7_99_1XACE-SELINUX-MERGECOMPOSITEWRAPEgbert Eich2004-04-231-1/+1
|
* Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004xf86-4_4_99_1Egbert Eich2004-03-141-1/+1
|
* Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004xf86-4_4_0STSF-CURRENTEgbert Eich2004-03-031-1/+1
|
* readding XFree86's cvs IDsxf86-4_3_99_903Egbert Eich2004-02-261-1/+1
|
* Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004Egbert Eich2004-02-261-1/+1
|
* XFree86 4.3.0.1xf86-4_3_0_1PRE_xf86-4_3_0_1Kaleb Keithley2003-11-141-224/+6
|
* R6.6 is the Xorg base-lineXORG-MAINKaleb Keithley2003-11-141-0/+966