Use str_copy instead of strdup

Since strdup is not standardized in ANSI C, using str_copy is better.

Currently, strdup is also used in `deps`. So I'll create PR to each project.