Overview
Comment: | of_asprintf.m: Small optimization
Don't replace the decimal point with "." if the decimal point is ".". |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e0b659378fa3bfcda716d260020795cf |
User & Date: | js on 2020-03-09 00:54:07 |
Other Links: | manifest | tags |
Context
2020-03-21
| ||
12:09 | .travis.yml: Update webhook URL check-in: 305688321e user: js tags: trunk | |
2020-03-09
| ||
00:54 | of_asprintf.m: Small optimization check-in: e0b659378f user: js tags: trunk | |
2020-03-08
| ||
13:49 | runtime/linklib: __attribute__((used)) for [cd]tor check-in: c12ca9484e user: js tags: trunk | |
Changes
Modified src/of_asprintf.m from [04c9933717] to [0f7da4996c].
︙ | ︙ | |||
350 351 352 353 354 355 356 357 358 359 360 361 362 363 | } static bool formatConversionSpecifierState(struct context *ctx) { char *tmp = NULL; int tmpLen = 0; if (!appendSubformat(ctx, ctx->format + ctx->i, 1)) return false; switch (ctx->format[ctx->i]) { case '@': if (ctx->lengthModifier != LENGTH_MODIFIER_NONE) | > > > | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | } static bool formatConversionSpecifierState(struct context *ctx) { char *tmp = NULL; int tmpLen = 0; #ifndef HAVE_ASPRINTF_L OFString *point; #endif if (!appendSubformat(ctx, ctx->format + ctx->i, 1)) return false; switch (ctx->format[ctx->i]) { case '@': if (ctx->lengthModifier != LENGTH_MODIFIER_NONE) |
︙ | ︙ | |||
549 550 551 552 553 554 555 | #ifndef HAVE_ASPRINTF_L /* * If there's no asprintf_l, we have no other choice than to * use this ugly hack to replace the locale's decimal point * back to ".". */ | > > | < < < | | > > | 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | #ifndef HAVE_ASPRINTF_L /* * If there's no asprintf_l, we have no other choice than to * use this ugly hack to replace the locale's decimal point * back to ".". */ point = [OFLocale decimalPoint]; if (!ctx->useLocale && point != nil && ![point isEqual: @"."]) { void *pool = objc_autoreleasePoolPush(); char *tmp2; @try { OFMutableString *tmpStr = [OFMutableString stringWithUTF8String: tmp length: tmpLen]; [tmpStr replaceOccurrencesOfString: point withString: @"."]; if (tmpStr.UTF8StringLength > INT_MAX) return false; tmpLen = (int)tmpStr.UTF8StringLength; tmp2 = malloc(tmpLen); memcpy(tmp2, tmpStr.UTF8String, tmpLen); } @finally { free(tmp); objc_autoreleasePoolPop(pool); } |
︙ | ︙ |