Thread: broken dead code in pg_lzcompress.h
I came across the following obviously corrupt macro in pg_lzcompress.h: #define PGLZ_IS_COMPRESSED(_lzdata) ((_lzdata)->varsize != \ e (_lzdata)->rawsize + e \ sizeof(PGLZ_Header)) The reason we have not noticed its brokenness is that it's only used in macro pglz_decomp_init, which is used nowhere. In fact there seems to be quite a lot of dead code in this header. I'm inclined to remove everything that's not referenced, rather than try to fix it. regards, tom lane
On 10/5/2006 5:04 PM, Tom Lane wrote: > I came across the following obviously corrupt macro in pg_lzcompress.h: > > #define PGLZ_IS_COMPRESSED(_lzdata) ((_lzdata)->varsize != \ > e (_lzdata)->rawsize + e \ > sizeof(PGLZ_Header)) > The reason we have not noticed its brokenness is that it's only used in > macro pglz_decomp_init, which is used nowhere. In fact there seems to > be quite a lot of dead code in this header. I'm inclined to remove > everything that's not referenced, rather than try to fix it. That's quite possible that there is a fair amount of dead code in there because it was originally the header for the lztext datatype, which if memory served only existed quietly in one release to support slightly larger rewrite rules before it was replaced with TOAST. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #
Jan Wieck <JanWieck@Yahoo.com> writes: > That's quite possible that there is a fair amount of dead code in there > because it was originally the header for the lztext datatype, which if > memory served only existed quietly in one release to support slightly > larger rewrite rules before it was replaced with TOAST. Ah, I was wondering how so much of it came to be dead code, but that explains that. I will pull out whatever's not referenced anymore --- it looks like there are a couple of subroutines, not just macros, that we don't need. regards, tom lane