Hello Kamil, Kamil Dudka wrote: > I ran a few series of tests with all implementations. I think the > modified version of ververcmp (from dpkg) gives the best results - consider > attached results of an example - results.tar.bz2
I agree, out-deb-patched matches most closely what one would expect from file names (in particular the file names you chose for the test case). I'm therefore in favour of adding this function to gnulib. There are still a few things to do before we can add it to gnulib: - Do you have a copyright assignment for contributions to gnulib on file? - Under which copyright is the original verrevcmp code? If it is not owned by the FSF, we can quickly redevelop it, from a formal description of this function. - Write a .h file that declares the function and describes what it does. - Write a module description. - Fix the obvious bugs, for example, you need to cast 'char' values to 'unsigned char' before passing them to <ctype.h> functions. - Streamline the operation: Can't you get rid of copying the two strings? For example, by changing verrevcmp to take 4 arguments (str1, len1, str2, len2) instead of NUL terminated arguments (str1, str2)? - Remove unnecessary casts, for example, if match_suffix took 'char *' arguments and returned a 'char *', no casts would be necessary. - GNU coding style: space between function name and opening parenthesis, write 'const char *', not 'const char*', etc. - Put the unit test in the usual form used by gnulib. See the module 'printf-posix-tests' for a test that produces some textual output and compares it to an expected output. Bruno