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

is possible write and read from file ? #10

Open
denisdemais opened this issue Jun 9, 2016 · 2 comments
Open

is possible write and read from file ? #10

denisdemais opened this issue Jun 9, 2016 · 2 comments

Comments

@denisdemais
Copy link

No description provided.

@a1880
Copy link

a1880 commented Jun 9, 2016

To write the whole hashmap to a file, you'd have to write your own serialization code. You could rewrite hashmap_iterate() to do that. The current version of hashmap_iterate() calls a function for every hashmap entry. The new version could add the item key as function parameter. To read the hashmap back, your own deserialization code would be needed. Does this answer your question?

@denisdemais
Copy link
Author

denisdemais commented Jun 10, 2016

yes, you do.

i will try save directly to disk. i will report you.

suggest #1 zlib
zlib have a crc32 code do you can add additional support if defined, i.e., HAVE_ZLIB

suggest #2 change to avoid conflit with zlib
from: unsigned long crc32(const unsigned char *s, unsigned int len)
to: static unsigned long crc32(const unsigned char *s, unsigned int len)

suggest #3 static modifier can vary between compilers

suggest #4 uses of errorno and/or hashmap_strerror()
i.e., at map_t hashmap_new()
'just' return NULL but can determine a cause of error

suggest #5 check if hashmap is valid before free()
at void hashmap_free()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants