MCPcopy Create free account
hub / github.com/GenericMappingTools/gmt / batch_parse_x_option

Function batch_parse_x_option

src/batch.c:145–155  ·  view source on GitHub ↗

! -x[[-] ] parsing needed but here not related to OpenMP etc - it is just a local option */

Source from the content-addressed store, hash-verified

143
144/*! -x[[-]<ncores>] parsing needed but here not related to OpenMP etc - it is just a local option */
145GMT_LOCAL int batch_parse_x_option (struct GMT_CTRL *GMT, struct BATCH_CTRL *Ctrl, char *arg) {
146 if (!arg) return (GMT_PARSE_ERROR); /* -x requires a non-NULL argument */
147 if (arg[0])
148 Ctrl->x.n_threads = atoi (arg);
149
150 if (Ctrl->x.n_threads == 0) /* Not having any of that. At least one */
151 Ctrl->x.n_threads = 1;
152 else if (Ctrl->x.n_threads < 0) /* Meant to reduce the number of threads */
153 Ctrl->x.n_threads = MAX(GMT->parent->n_cores + Ctrl->x.n_threads, 1); /* Max-n but at least one */
154 return (GMT_NOERROR);
155}
156
157GMT_LOCAL void batch_close_files (struct BATCH_CTRL *Ctrl) {
158 /* Close all files when an error forces us to quit */

Callers 1

parseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected