amos 9d633e9e67 Batch 15 (20261023-C-hwe-scale-15): 320 HWE-derived repair tasks
One user-space repair task per eligible HWE debug-diag / compile-deploy base
ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content
filter. Each ships a public spec with a check-to-basis table, at least two
defects with single-fix fixtures, a symptom-masking fixture and an alternative
correct implementation. Claude re-checked all 320: structure, the HWE quality
items and trace6 Docker calibration receipts against current digests
(320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120
ad-hoc family names; the next batch maps them to the canonical list.
The batch's 1,256-line progress log stays in its factory report and the
36-local branch batch15-hwe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 01:55:56 +08:00

39 lines
1.2 KiB
C

#include "render_api.h"
#include "buffer_port.h"
static struct render_result result_value(int status, size_t required, size_t emitted)
{
struct render_result result;
result.status = status;
result.required = required;
result.emitted = emitted;
return result;
}
struct render_result render_record(const struct command *command)
{
const struct record *record = &command->record;
size_t required;
size_t emitted;
char *buffer;
int published;
if (record->level > 7 || record->label_length > LABEL_LIMIT ||
command->capacity > TEXT_LIMIT) {
return result_value(RENDER_INVALID, 0, 0);
}
required = codec_record_size(record);
buffer = port_allocate(command->capacity);
if (buffer == NULL) {
return result_value(RENDER_ALLOC, required, 0);
}
if (command->capacity < required) {
port_release(buffer);
return result_value(RENDER_TRUNCATED, required, 0);
}
emitted = codec_record_write(record, buffer, command->capacity);
published = port_publish(buffer, emitted);
if (!published) {
port_release(buffer);
return result_value(RENDER_SINK, required, 0);
}
return result_value(RENDER_OK, required, emitted);
}