Makes few cleanning and adds an obi_dms C constructor

This commit is contained in:
2015-05-26 21:36:55 +02:00
parent 9f69f76704
commit d1324618b8
4 changed files with 90 additions and 53 deletions

View File

@ -579,36 +579,3 @@ OBIDMSColumn_p obi_create_column(OBIDMS_p dms,
// }
/************************************************************************
************************************************************************
************************************************************************/
/**
* @brief Reads a memory block from a file.
*
* * @param file The file that should be mapped.
* * @param size The number of bytes that should be mapped.
* * @param start The position at which the mapping should start.
* @return A pointer on the first element of the block.
*/
char* obi_map_read_only(int file, int start, int size)
{
char* map;
map = (char*) mmap(0, size, PROT_READ, MAP_PRIVATE, file, start);
if (map == MAP_FAILED)
{
fprintf(stderr, "\nmmap read-only error\n");
exit(1);
}
return(map);
}
/**
* @brief Unmaps a memory block.
*
* * @param size The size of the block that should be unmapped.
*/
void obi_unmap(int size)
{
munmap(0, size);
}