Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gcode issue1199 p2 #12

Closed
wants to merge 2 commits into from

Commits on May 13, 2015

  1. Issue 1199: Remove the vestigal traces of custom memory allocators

    1. memry removal.
    
    This should be no-brainer. These functions never seemed to do anything useful. The only oddity was with alloc_string which rounded the allocation upwards to nearest multiple of 4. Based on my review of code, I could not identify any value in this feature, so even alloc_string was simply transformed to malloc.
    
    memry.* are removed. All code is adjusted to simply call malloc and free instead.
    
    listio.* are removed. The list reading function in these files appears to have been unused, and contained the only invocation of strsave define, which was one of the alloc_string users, so I removed both of them.
    
    https://code.google.com/p/tesseract-ocr/issues/detail?id=1199
    alankila authored and jimregan committed May 13, 2015
    Configuration menu
    Copy the full SHA
    d0cb4bd View commit details
    Browse the repository at this point in the history
  2. Issue 1199: Remove the vestigal traces of custom memory allocators: 2…

    …. memry and emalloc removal.
    
    2. memry and emalloc removal.
    
    As above, but also removes emalloc* and replaces all uses of E{malloc,realloc,free} with the standard versions.
    
    This is somewhat more controversial, because the E variants bothered to check the return value from the respective function, and would perform DoError if it determined it to have failed, which terminates in message to console and err_exit(). This is arguably nicer than crashing on null pointer value, but large parts of the code have never cared about malloc's potential NULL values, so I'd say it doesn't really help that parts of it now do.
    
    Perhaps the real plan for moving forwards is to also replace malloc/free, and instead start using new/delete operators, and allow them to throw exceptions if the object construction fails due to memory allocation error. In this sense, the second patch may be considered as a stepping stone on the path towards such future version of Tesseract.
    
    Conflicts:
    	classify/flexfx.cpp
    alankila authored and jimregan committed May 13, 2015
    Configuration menu
    Copy the full SHA
    6dde670 View commit details
    Browse the repository at this point in the history