Panu Matilainen
a931202422
Eliminate unused spec field from macro expansion state struct
2010-09-27 14:55:11 +03:00
Panu Matilainen
8082eb48db
Avoid calloc() in macro findEntry()
...
- It's just the macro name we're grabbing here, that ought to fit
on stack comfortably enough.
2010-09-27 14:55:11 +03:00
Panu Matilainen
ebc4ceaaeb
Avoid unnecessary round-trip through expandT() where possible
...
- In the cases where expandT() was called with strlen(source) we can
now just bypass it and call expandMacro() directly, avoiding an
unnecessary string copy.
2010-09-27 14:55:11 +03:00
Panu Matilainen
ccba5236a0
Use function arguments to pass, duh, arguments into functions. Duh.
...
- No functional changes, just eliminating mindless save-and-restore
ping-pong through macro expansion state struct.
2010-09-27 14:55:11 +03:00
Jindrich Novy
7f220202f2
Redirect macro stack backtrace printing to debug log.
2010-07-13 13:35:22 +02:00
Jindrich Novy
60be56e317
Fix cryptic macro evaluation error message (RhBug:613010)
2010-07-13 13:34:05 +02:00
Panu Matilainen
c16cde7a4d
Revert "Always free locally defined macros when they go out of scope"
...
- the "fix" breaks seemingly legitimate use in fedora font package
macros, possibly some funky interaction with %{lua: } macros or something
- this reverts commit f895acd285
.
2010-01-07 12:04:53 +02:00
Panu Matilainen
f895acd285
Always free locally defined macros when they go out of scope
...
- Prior to this, local defines in constructs like %{!?foo: %define foo bar}
would remain defined until a parametrized macro gets called, causing
obscure and confusing errors in specs such as RhBug:551971 and countless
others. Use of %global is now always required for such constructs.
2010-01-04 12:45:18 +02:00
Panu Matilainen
2c5ea0b188
Remove -98 vintage ifdef'ed dead code
2010-01-04 10:52:22 +02:00
Panu Matilainen
2553ca2fe3
Move getopt() portability fiddles out of system.h
...
- only macro.c needs, no point polluting includes everywhere
2009-12-23 14:02:19 +02:00
Ville Skyttä
1892984f02
Decompress lzma files with xz.
2009-10-06 10:47:36 +03:00
Panu Matilainen
f634253b32
Eliminate unused variable
2009-09-07 17:50:43 +03:00
Panu Matilainen
f4b39519d3
Replace equal/not equal uses of str[n]cmp() with rstreq[n] in io code
2009-08-31 11:15:16 +03:00
Panu Matilainen
3d63df6220
Handle XZ in %uncompress macro
...
- should've been in commit 8078d0ba24
2009-03-27 14:11:43 +02:00
Panu Matilainen
2d2bda29c1
Add built-in %getconfdir macro for getting rpmConfigDir() value
...
- define %_rpmconfigdir via %getconfdir in the main macro config, this
avoids it getting lost on macro reloads as happens when building
several packages at once
2009-03-27 14:01:47 +02:00
Panu Matilainen
947ad7acb3
Add getenv macro, use instead of $(echo $HOME) for defauls
...
- inspired by http://lists.rpm.org/pipermail/rpm-maint/2009-January/002332.html
2009-01-16 09:09:40 +02:00
Panu Matilainen
da83a562e1
Add function to retrieve rpm config base directory
...
- one-shot to determine configuration base directory path from
RPM_CONFIGDIR environement or build-time default
- rpmfileutil is a bit strange place, this would really belong to librpm
but Lua initialization needs the path so...
2008-11-22 18:06:31 +02:00
Panu Matilainen
49c515179a
Permit tab as whitespace between macro arguments (rhbz#467567)
...
- another dumb regression from macro handling cleanups
2008-10-19 01:53:03 +03:00
Panu Matilainen
9f85707825
Macro argument handling regression regression (rhbz#461180)
...
- commit f366011c42
is too simplistic and
broke other stuff in turn...
2008-09-11 16:56:50 +03:00
Panu Matilainen
1d9b4d00d7
Make rpmExpand() smarter wrt memory allocations
...
- precalculate unexpanded size and allocate enough for that plus MACROBUFSIZ
for expansion
- typical allocation is way smaller than what gets allocated "just in case",
calculate expanded size and realloc to actual size to avoid wasting
memory
2008-07-16 10:52:33 +03:00
Panu Matilainen
889f9f5b41
Eliminate another unnecessary temp variable
...
- do all the copying inside a loop
2008-07-16 10:33:57 +03:00
Panu Matilainen
1b19676027
Eliminate unnecessary variable
...
- leftover from static buffer times..
2008-07-16 10:24:05 +03:00
Panu Matilainen
f366011c42
Macro argument handling regression (rhbz#455333)
...
- expandMacro() wants the next \0 character to be returned, which might
or might not be the same as lastc passed to grabArgs()
- use memcpy() instead of memmove() for the copy, the areas can't overlap
2008-07-16 09:40:10 +03:00
Panu Matilainen
af9518dce2
Use correct type for strlen()
2008-06-10 10:02:52 +03:00
Panu Matilainen
485d195488
Plug memleak in macro doFoo()
2008-04-29 17:39:02 +03:00
Panu Matilainen
9ae911eefe
Further simplify rpmInitMacros()
...
- Use argvSplit() for splitting the macro path to components instead of
manual pointer-parsery.
- If URL's are to be supported or accepted at all (previous code attempted
to skip them), ':' is a very poor delimiter character.
2008-04-19 16:42:56 +03:00
Panu Matilainen
e336146a9e
Use argvFree() to free, well, an argv, instead of manual freeing
2008-04-19 16:04:11 +03:00
Panu Matilainen
601b4d0e6a
Avoid entirely silly rpmio FD_t use
...
- rdcl() converts to FILE internally anyway, might as well use fopen()
to begin with...
2008-04-18 16:14:15 +03:00
Panu Matilainen
38a975b157
Remove unnecessary xstrdup() of dynamically allocated buffer
...
- leftover from when target buffer was static...
2008-04-18 15:39:07 +03:00
Panu Matilainen
94e64fec18
Cosmetics: group operations more logically...
2008-04-18 15:15:05 +03:00
Panu Matilainen
2d8a27ed16
Simplify macro option + argument processing
...
- eliminate ninja-voodoo pointer-hackery parsing, replace argvSplit() +
argvJoin() and friends
- eliminate static sized buffers from the processing
2008-04-18 14:59:03 +03:00
Panu Matilainen
02939c15fa
More accurate filtering of .rpmnew etc when reading macros
...
- strstr() can give false positives, use rpmFileHasSuffix() instead
2008-04-17 17:33:30 +03:00
Panu Matilainen
3c1126b2a5
Missing decompression arguments for bzip in uncompress macro
2008-04-04 15:52:52 +03:00
Panu Matilainen
7ddab3ab8d
Dead code removal (macro stuff)
2008-03-31 10:44:23 +03:00
Panu Matilainen
c908277be2
Minimal namespacing for locale-insensitive x*() string functions
2008-03-18 09:10:13 +02:00
Panu Matilainen
05129f83dc
Make bunch of macro internal variables static
2008-02-26 22:24:28 +02:00
Panu Matilainen
cc69dd20b8
Allocate macro buffers dynamically
...
- avoids some entirely needless overflow cases
- somewhat similarly to rpm5.org but use heap instead of stack
2008-02-01 13:00:40 +02:00
Panu Matilainen
56405587f4
Allocate various macro buffers from heap not stack
2008-02-01 12:11:03 +02:00
Panu Matilainen
54ab76019e
Define + use MACROBUFSIZ for macro expansion buffer size
...
- double the buffer size while at it...
2008-02-01 11:36:13 +02:00
Panu Matilainen
d3d60512bd
Macro shell expansion fixes (rhbz#431009)
2008-02-01 11:09:13 +02:00
Panu Matilainen
eb5dc35c19
Include spring-cleaning
...
- put some consistency into include ordering
- everything (apart from bits missed ;) is now ordered like this
1. "system.h"
2. other system includes
3. rpm public headers
4. rpm private headers
5. "debug.h"
2008-01-30 17:05:29 +02:00
Panu Matilainen
95b03441cc
Rename isCompressed() -> rpmFileIsCompressed() for namespacing
2008-01-27 16:39:40 +02:00
Panu Matilainen
eec03952be
Make uncompress macros match reality (_ vs __ prefix)
2008-01-23 07:56:51 +02:00
Panu Matilainen
8e00018c88
Fix some const issues in macros
2007-12-19 12:49:52 +02:00
Panu Matilainen
78ad426f04
Remove bogus const from rpmGlob argv return type
...
- it's malloced and must be freed by caller
2007-12-18 10:17:18 +02:00
Panu Matilainen
c41f61369e
Unconstify macro contents, fully contained within macro module
2007-12-16 21:28:37 +02:00
Panu Matilainen
f5a712db5b
Remove bogus consts..
2007-12-14 15:50:17 +02:00
Panu Matilainen
9ce13e09ef
Switch to <rpm/foo.h> style for public headers
...
- adjust include paths accordingly
2007-12-08 14:02:32 +02:00
Panu Matilainen
89527785bb
Move logging related macros rpmlog, adjust includes
2007-11-30 23:08:38 +02:00
Ralf Corsépius
8ef0ca213f
Expand private include file names to be relative to $(top_srcdir)
2007-11-23 11:41:29 +01:00